Ah the bit about -isystem and suppressing warnings was good to know. For a few cases in our build system we didn’t have -isystem for /usr/lib64/clang/7.0.1/include.
- k > On Mar 14, 2019, at 11:23 AM, Peter Smith <peter.sm...@linaro.org> wrote: > > Hello Kumar, (reposting as I wasn't subscribed to cfe-users). > > Yes I think that these warnings are expected when the clang stdint.h > is included via -I. Normally it is included as a system header which > suppresses the warnings (-isystem). From the comment in > https://github.com/llvm-mirror/clang/blob/master/lib/Headers/stdint.h#L89 > it looks like the redefinitions are expected and that clang is relying > on the warnings to be suppressed. > > Another way to reproduce is to turn on warnings in system headers: > clang -c foo.c -ffreestanding -Wsystem-headers > > Peter > > On Thu, 14 Mar 2019 at 15:39, Kumar Gala <kumar.g...@linaro.org> wrote: >> >> I’m trying to build for ARM and was surprised to get warnings from the >> stdint.h. Is this expected behavior? >> >> Here’s what my c file looks like: >> >> foo.c: >> #include <stdint.h> >> >> How I’m invoking the compiler: >> >> /usr/bin/clang --target=arm-none-eabi -I/usr/lib64/clang/7.0.1/include >> -nostdinc -c foo.c >> >> I’m surprised to see the following warnings get generated with >> /usr/lib64/clang/7.0.1/include/stdint.h: >> >> In file included from foo.c:1: >> /usr/lib64/clang/7.0.1/include/stdint.h:186:10: warning: '__int_least32_t' >> macro redefined [-Wmacro-redefined] >> # define __int_least32_t int32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:112:10: note: previous definition is >> here >> # define __int_least32_t int64_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:187:10: warning: '__uint_least32_t' >> macro redefined [-Wmacro-redefined] >> # define __uint_least32_t uint32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:113:10: note: previous definition is >> here >> # define __uint_least32_t uint64_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:188:10: warning: '__int_least16_t' >> macro redefined [-Wmacro-redefined] >> # define __int_least16_t int32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:114:10: note: previous definition is >> here >> # define __int_least16_t int64_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:189:10: warning: '__uint_least16_t' >> macro redefined [-Wmacro-redefined] >> # define __uint_least16_t uint32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:115:10: note: previous definition is >> here >> # define __uint_least16_t uint64_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:190:10: warning: '__int_least8_t' >> macro redefined [-Wmacro-redefined] >> # define __int_least8_t int32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:116:10: note: previous definition is >> here >> # define __int_least8_t int64_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:191:10: warning: '__uint_least8_t' >> macro redefined [-Wmacro-redefined] >> # define __uint_least8_t uint32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:117:10: note: previous definition is >> here >> # define __uint_least8_t uint64_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:219:10: warning: '__int_least16_t' >> macro redefined [-Wmacro-redefined] >> # define __int_least16_t int16_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:188:10: note: previous definition is >> here >> # define __int_least16_t int32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:220:10: warning: '__uint_least16_t' >> macro redefined [-Wmacro-redefined] >> # define __uint_least16_t uint16_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:189:10: note: previous definition is >> here >> # define __uint_least16_t uint32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:221:10: warning: '__int_least8_t' >> macro redefined [-Wmacro-redefined] >> # define __int_least8_t int16_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:190:10: note: previous definition is >> here >> # define __int_least8_t int32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:222:10: warning: '__uint_least8_t' >> macro redefined [-Wmacro-redefined] >> # define __uint_least8_t uint16_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:191:10: note: previous definition is >> here >> # define __uint_least8_t uint32_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:238:10: warning: '__int_least8_t' >> macro redefined [-Wmacro-redefined] >> # define __int_least8_t int8_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:221:10: note: previous definition is >> here >> # define __int_least8_t int16_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:239:10: warning: '__uint_least8_t' >> macro redefined [-Wmacro-redefined] >> # define __uint_least8_t uint8_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:222:10: note: previous definition is >> here >> # define __uint_least8_t uint16_t >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:376:11: warning: '__int32_c_suffix' >> macro redefined [-Wmacro-redefined] >> # define __int32_c_suffix __INT32_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:301:11: note: previous definition is >> here >> # define __int32_c_suffix __INT64_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:377:11: warning: '__int16_c_suffix' >> macro redefined [-Wmacro-redefined] >> # define __int16_c_suffix __INT32_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:302:11: note: previous definition is >> here >> # define __int16_c_suffix __INT64_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:378:11: warning: '__int8_c_suffix' >> macro redefined [-Wmacro-redefined] >> # define __int8_c_suffix __INT32_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:303:12: note: previous definition is >> here >> # define __int8_c_suffix __INT64_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:414:11: warning: '__int16_c_suffix' >> macro redefined [-Wmacro-redefined] >> # define __int16_c_suffix __INT16_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:377:11: note: previous definition is >> here >> # define __int16_c_suffix __INT32_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:415:11: warning: '__int8_c_suffix' >> macro redefined [-Wmacro-redefined] >> # define __int8_c_suffix __INT16_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:378:11: note: previous definition is >> here >> # define __int8_c_suffix __INT32_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:435:11: warning: '__int8_c_suffix' >> macro redefined [-Wmacro-redefined] >> # define __int8_c_suffix __INT8_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:415:11: note: previous definition is >> here >> # define __int8_c_suffix __INT16_C_SUFFIX__ >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:569:10: warning: '__INT_LEAST32_MIN' >> macro redefined >> [-Wmacro-redefined] >> # define __INT_LEAST32_MIN INT32_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:478:10: note: previous definition is >> here >> # define __INT_LEAST32_MIN INT64_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:570:10: warning: '__INT_LEAST32_MAX' >> macro redefined >> [-Wmacro-redefined] >> # define __INT_LEAST32_MAX INT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:479:10: note: previous definition is >> here >> # define __INT_LEAST32_MAX INT64_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:571:10: warning: >> '__UINT_LEAST32_MAX' macro redefined >> [-Wmacro-redefined] >> # define __UINT_LEAST32_MAX UINT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:480:10: note: previous definition is >> here >> # define __UINT_LEAST32_MAX UINT64_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:572:10: warning: '__INT_LEAST16_MIN' >> macro redefined >> [-Wmacro-redefined] >> # define __INT_LEAST16_MIN INT32_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:481:10: note: previous definition is >> here >> # define __INT_LEAST16_MIN INT64_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:573:10: warning: '__INT_LEAST16_MAX' >> macro redefined >> [-Wmacro-redefined] >> # define __INT_LEAST16_MAX INT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:482:10: note: previous definition is >> here >> # define __INT_LEAST16_MAX INT64_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:574:10: warning: >> '__UINT_LEAST16_MAX' macro redefined >> [-Wmacro-redefined] >> # define __UINT_LEAST16_MAX UINT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:483:10: note: previous definition is >> here >> # define __UINT_LEAST16_MAX UINT64_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:575:10: warning: '__INT_LEAST8_MIN' >> macro redefined [-Wmacro-redefined] >> # define __INT_LEAST8_MIN INT32_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:484:10: note: previous definition is >> here >> # define __INT_LEAST8_MIN INT64_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:576:10: warning: '__INT_LEAST8_MAX' >> macro redefined [-Wmacro-redefined] >> # define __INT_LEAST8_MAX INT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:485:10: note: previous definition is >> here >> # define __INT_LEAST8_MAX INT64_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:577:10: warning: '__UINT_LEAST8_MAX' >> macro redefined >> [-Wmacro-redefined] >> # define __UINT_LEAST8_MAX UINT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:486:10: note: previous definition is >> here >> # define __UINT_LEAST8_MAX UINT64_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:613:10: warning: '__INT_LEAST16_MIN' >> macro redefined >> [-Wmacro-redefined] >> # define __INT_LEAST16_MIN INT16_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:572:10: note: previous definition is >> here >> # define __INT_LEAST16_MIN INT32_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:614:10: warning: '__INT_LEAST16_MAX' >> macro redefined >> [-Wmacro-redefined] >> # define __INT_LEAST16_MAX INT16_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:573:10: note: previous definition is >> here >> # define __INT_LEAST16_MAX INT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:615:10: warning: >> '__UINT_LEAST16_MAX' macro redefined >> [-Wmacro-redefined] >> # define __UINT_LEAST16_MAX UINT16_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:574:10: note: previous definition is >> here >> # define __UINT_LEAST16_MAX UINT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:616:10: warning: '__INT_LEAST8_MIN' >> macro redefined [-Wmacro-redefined] >> # define __INT_LEAST8_MIN INT16_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:575:10: note: previous definition is >> here >> # define __INT_LEAST8_MIN INT32_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:617:10: warning: '__INT_LEAST8_MAX' >> macro redefined [-Wmacro-redefined] >> # define __INT_LEAST8_MAX INT16_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:576:10: note: previous definition is >> here >> # define __INT_LEAST8_MAX INT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:618:10: warning: '__UINT_LEAST8_MAX' >> macro redefined >> [-Wmacro-redefined] >> # define __UINT_LEAST8_MAX UINT16_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:577:10: note: previous definition is >> here >> # define __UINT_LEAST8_MAX UINT32_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:635:10: warning: '__INT_LEAST8_MIN' >> macro redefined [-Wmacro-redefined] >> # define __INT_LEAST8_MIN INT8_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:616:10: note: previous definition is >> here >> # define __INT_LEAST8_MIN INT16_MIN >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:636:10: warning: '__INT_LEAST8_MAX' >> macro redefined [-Wmacro-redefined] >> # define __INT_LEAST8_MAX INT8_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:617:10: note: previous definition is >> here >> # define __INT_LEAST8_MAX INT16_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:637:10: warning: '__UINT_LEAST8_MAX' >> macro redefined >> [-Wmacro-redefined] >> # define __UINT_LEAST8_MAX UINT8_MAX >> ^ >> /usr/lib64/clang/7.0.1/include/stdint.h:618:10: note: previous definition is >> here >> # define __UINT_LEAST8_MAX UINT16_MAX >> ^ >> 36 warnings generated. >> [galak@spiff zephyr]$ /usr/lib64/clang/7.0.1/include/stdint.h: >> _______________________________________________ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users