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

kikairoya via Cygwin <[email protected]>
Newsgroups gmane.os.cygwin
Message-ID <[email protected]>
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?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.