/usr/include/stdatomic.h is not self-contained

kikairoya kikairoya@gmail.com
Sun Feb 8 02:02:48 GMT 2026


Hello,

I noticed that /usr/include/stdatomic.h is not self-contained due to lack 
of including <stdint.h>.


$ echo '#include "/usr/include/stdatomic.h"' | gcc -xc - -fsyntax-only
In file included from <stdin>:1:
/usr/include/stdatomic.h:207:17: error: unknown type name 'int_least8_t'
   207 | typedef _Atomic(int_least8_t)           atomic_int_least8_t;
       |                 ^~~~~~~~~~~~
/usr/include/stdatomic.h:208:17: error: unknown type name 'uint_least8_t'
   208 | typedef _Atomic(uint_least8_t)          atomic_uint_least8_t;
       |                 ^~~~~~~~~~~~~
(snip)

$ echo '#include "/usr/include/stdatomic.h"' | gcc -xc - -fsyntax-only 
-include stdint.h




It's normally unaffected since gcc uses its own <stdatomic.h>.


$ echo '#include <stdatomic.h>' | gcc -xc - -fsyntax-only


$ echo '#include <stdatomic.h>' | gcc -xc - -fsyntax-only -H
. /usr/lib/gcc/x86_64-pc-cygwin/13/include/stdatomic.h


However, clang delegates to system provided <stdatomic.h> if available, so
including <stdatomic.h> before other headers causes syntax errors.


$ echo '#include <stdatomic.h>' | clang -xc - -fsyntax-only
In file included from <stdin>:1:
In file included from /usr/lib/clang/21/include/stdatomic.h:24:
/usr/include/stdatomic.h:207:17: error: unknown type name 'int_least8_t'; 
did you mean '__int_least8_t'?
   207 | typedef _Atomic(int_least8_t)           atomic_int_least8_t;
       |                 ^
/usr/include/machine/_default_types.h:134:29: note: '__int_least8_t' 
declared here
   134 | typedef __INT_LEAST8_TYPE__ __int_least8_t;
       |                             ^
(snip)


$ echo '#include <stdatomic.h>' | clang -xc - -fsyntax-only  -H
. /usr/lib/clang/21/include/stdatomic.h
.. /usr/include/stdatomic.h
(snip)

$ echo '#include <stdatomic.h>' | clang -xc - -fsyntax-only -include 
stdint.h




Could it be fixed to make /usr/include/stdatomic.h self-contained?

--
Tomohiro Kashiwada (@kikairoya)



More information about the Cygwin mailing list