Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#7 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@KRASTM ci sta già lavorando.

Dal 14/8/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.
Lingua principale
C
Stelle
84
Fork
24
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di STMicroelectronics/cmsis-core

Tutte le issue di STMicroelectronics/cmsis-core

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.