Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Improve C89/C90 compatibility by conditionally including <stdint.h>

Đang mở
#7 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@KRASTM đang làm issue này rồi.

Từ ngày 14/8/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

cmsis enhancement

https://github.com/STMicroelectronics/cmsis-core/blob/afc5ca6af0a49232fde7eb4548dd0962d119ce14/CMSIS/Core/Include/cmsis_compiler.h#L26

The current implementation unconditionally includes the standard header file <stdint.h>. While this is valid for C99 and later standards, some toolchains, such as IAR Embedded Workbench configured for C89/C90 compliance, may not provide this header, resulting in compilation errors.

To improve compatibility with older C language standards while preserving existing functionality, the inclusion of <stdint.h> should be conditioned on the detected language standard.

Current Code

#include <stdint.h>

Proposed Fix

#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
  /* C89/C90 mode: Define standard integer types locally */
#else
  /* C99 and later: Use standard stdint.h */
  #include <stdint.h>
#endif

Rationale

<stdint.h> is part of the C99 standard and is not guaranteed to be available when compiling in C89/C90 mode. The proposed change allows the code to compile in both C89/C90 and C99+ environments by only including <stdint.h> when the language standard supports it.

Expected Benefit

  • Improved compatibility with C89/C90 toolchains, including IAR Embedded Workbench.
  • No functional impact on existing C99 and newer builds.
  • Better portability across different compiler configurations.
Ngôn ngữ chính
C
Star
84
Fork
24
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của STMicroelectronics/cmsis-core

Tất cả issue của STMicroelectronics/cmsis-core

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.