[clang] [Clang] Add predefined macros for integer constants to implement section 7.18.4 of ISO/IEC 9899:1999 in `<stdint.h>` in a safe way (PR #123514)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 22 06:55:39 PST 2025


https://github.com/AaronBallman commented:

Thank you for the fix! Can you also add test coverage for the changes to `clang/test/Headers` and a release note so users know about the fix to `clang/docs/ReleaseNotes.rst`?

Also, precommit CI found relevant failures:
```
******************** TEST 'Clang :: Preprocessor/init-aarch64.c' FAILED ********************
Exit Code: 1
Command Output (stderr):
--
RUN: at line 1: /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/build/lib/clang/20/include -nostdsysteminc -E -dM -triple=aarch64 -xc /dev/null > /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/build/tools/clang/test/Preprocessor/Output/init-aarch64.c.tmp.aarch64
+ /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/build/lib/clang/20/include -nostdsysteminc -E -dM -triple=aarch64 -xc /dev/null
RUN: at line 2: /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/build/bin/FileCheck --check-prefixes=AARCH64,AARCH64_LE,AARCH64_C /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/clang/test/Preprocessor/init-aarch64.c --match-full-lines < /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/build/tools/clang/test/Preprocessor/Output/init-aarch64.c.tmp.aarch64
+ /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/build/bin/FileCheck --check-prefixes=AARCH64,AARCH64_LE,AARCH64_C /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/clang/test/Preprocessor/init-aarch64.c --match-full-lines
/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/clang/test/Preprocessor/init-aarch64.c:138:18: error: AARCH64-NEXT: is not on the line after the previous match
// AARCH64-NEXT: #define __INT16_C_SUFFIX__
                 ^
<stdin>:124:1: note: 'next' match was here
#define __INT16_C_SUFFIX__
^
<stdin>:122:43: note: previous match ended here
#define __HAVE_FUNCTION_MULTI_VERSIONING 1
                                          ^
<stdin>:123:1: note: non-matching line after previous match is here
#define __INT16_C(c) c
^
Input file: <stdin>
Check file: /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-jfggl-1/llvm-project/github-pull-requests/clang/test/Preprocessor/init-aarch64.c
-dump-input=help explains the following input dump.
Input was:
<<<<<<
          .
          .
          .
        119: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
        120: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
        121: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
        122: #define __HAVE_FUNCTION_MULTI_VERSIONING 1
        123: #define __INT16_C(c) c
        124: #define __INT16_C_SUFFIX__
next:138     !~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        125: #define __INT16_FMTd__ "hd"
        126: #define __INT16_FMTi__ "hi"
        127: #define __INT16_MAX__ 32767
        128: #define __INT16_TYPE__ short
        129: #define __INT32_C(c) c
          .
          .
          .
>>>>>>
--
********************
```
(and similar in init.c)

https://github.com/llvm/llvm-project/pull/123514


More information about the cfe-commits mailing list