Improve C89/C90 compatibility by conditionally including <stdint.h>
@KRASTM ci sta già lavorando.
Dal 14/8/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di STMicroelectronics/cmsis-core
-
[Bug]: Discrepancy in __NVIC_PRIO_BITS default value between core_cm4.h and CMSIS-Core Documentation Apertabug cmsis
STMicroelectronics/cmsis-core#9 · 1 commento · 1 assegnatario ·
Tutte le issue di STMicroelectronics/cmsis-core
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NVIDIA/k8s-device-plugin#2061 · 1 commento ·
-
task
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
vsanthanam/JBird#429 ·