[cfe-users] Clang issues warning in system header

Pavel Chuprikov via cfe-users cfe-users at lists.llvm.org
Thu Jun 2 07:16:01 PDT 2016


Hello again,

I finally found out what was the issue. It was the *#line compiler
directive*, that caused all the trouble

So it seems, that I cannot possibly make clang think that the header like
below is a system one, so it would automatically suppress the warning:

#line 1 "some/garbage"
static char a = 0xfff;

Could any one suggest how to force clang to ignore *#line* or to anyhow
solve the problem?

Regards,
Pavel Chuprikov

чт, 2 июн. 2016 г. в 4:28, Pavel Chuprikov <pschuprikov at gmail.com>:

> Hello,
>
> I'm trying to compile a test library, that uses boost.asio using clang,
> But clang issues* a warning in a boost's header*, despite the fact that
> it is passed using "*-isystem*".
> I would be glad to investigate the problem further, but I just don't know
> where to dig, since everything seems OK to me.
>
> I use NixOS linux distribution, so that's where all the other parameters
> are from (NixOS uses some kind of wrapper). But I don't see anything that
> could affect warnings.
>
> An output from a clang execution follows:
>
> clang version 3.7.1 (tags/RELEASE_371/final)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> Found candidate GCC installation:
> /nix/store/d2ljpb414jpmzik3cvl0xlmr5m4aggp7-gcc-5.3.0/lib/gcc/x86_64-unknown-linux-gnu/5.3.0
> Found candidate GCC installation:
> /nix/store/d2ljpb414jpmzik3cvl0xlmr5m4aggp7-gcc-5.3.0/lib64/gcc/x86_64-unknown-linux-gnu/5.3.0
> Selected GCC installation:
> /nix/store/d2ljpb414jpmzik3cvl0xlmr5m4aggp7-gcc-5.3.0/lib64/gcc/x86_64-unknown-linux-gnu/5.3.0
> Candidate multilib: .;@m64
> Selected multilib: .;@m64
>  "/nix/store/x5v3p89l3i8v0jfnilr71yjv2vxqcfk5-clang-3.7.1/bin/clang-3.7"
> -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
> -disable-llvm-verifier -main-file-name test.cpp -mrelocation-model static
> -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
> -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
> -v -dwarf-column-info -coverage-file
> /home/pschuprikov/test/build/CMakeFiles/test.dir/test.o -nostdsysteminc
> -resource-dir
> /nix/store/x5v3p89l3i8v0jfnilr71yjv2vxqcfk5-clang-3.7.1/bin/../lib/clang/3.7.1
> *-isystem
> /nix/store/n6q76296i7vv03a6w07ii5q17vgn331x-boost-1.59.0-dev/include*
> -idirafter /nix/store/bb32xf954imhdrzn7j8h82xs1bx7p3fr-glibc-2.23/include
> -idirafter
> /nix/store/x5v3p89l3i8v0jfnilr71yjv2vxqcfk5-clang-3.7.1/lib/gcc/*/*/include-fixed
> *-isystem
> /nix/store/n6q76296i7vv03a6w07ii5q17vgn331x-boost-1.59.0-dev/include*
> -isystem
> /nix/store/d2ljpb414jpmzik3cvl0xlmr5m4aggp7-gcc-5.3.0/include/c++/5.3.0
> -isystem
> /nix/store/d2ljpb414jpmzik3cvl0xlmr5m4aggp7-gcc-5.3.0/include/c++/5.3.0/x86_64-unknown-linux-gnu
> -internal-isystem
> /nix/store/x5v3p89l3i8v0jfnilr71yjv2vxqcfk5-clang-3.7.1/bin/../lib/clang/3.7.1/include
> -Weverything -Wall -fdeprecated-macro -fdebug-compilation-dir
> /home/pschuprikov/test/build -ferror-limit 19 -fmessage-length 239
> -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
> -fdiagnostics-show-option -fcolor-diagnostics -o CMakeFiles/test.dir/test.o
> -x c++ /home/pschuprikov/test/test.cpp
> clang -cc1 version 3.7.1 based upon LLVM 3.7.1 default target
> x86_64-unknown-linux-gnu
> ignoring nonexistent directory
> "/nix/store/x5v3p89l3i8v0jfnilr71yjv2vxqcfk5-clang-3.7.1/lib/gcc/*/*/include-fixed"
> ignoring duplicate directory
> "/nix/store/n6q76296i7vv03a6w07ii5q17vgn331x-boost-1.59.0-dev/include"
> #include "..." search starts here:
> #include <...> search starts here:
>  /nix/store/n6q76296i7vv03a6w07ii5q17vgn331x-boost-1.59.0-dev/include
>  /nix/store/d2ljpb414jpmzik3cvl0xlmr5m4aggp7-gcc-5.3.0/include/c++/5.3.0
>
>  /nix/store/d2ljpb414jpmzik3cvl0xlmr5m4aggp7-gcc-5.3.0/include/c++/5.3.0/x86_64-unknown-linux-gnu
>
>  /nix/store/x5v3p89l3i8v0jfnilr71yjv2vxqcfk5-clang-3.7.1/bin/../lib/clang/3.7.1/include
>  /nix/store/bb32xf954imhdrzn7j8h82xs1bx7p3fr-glibc-2.23/include
> End of search list.
> In file included from /home/pschuprikov/test/test.cpp:1:
> In file included from include/boost/system/error_code.hpp:15:
> *include/boost/cstdint.hpp:33:11: warning: macro name is a reserved
> identifier [-Wreserved-id-macro]*
> #  define __STDC_CONSTANT_MACROS
>
> Thank you,
> Pavel Chuprikov
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160602/621fc731/attachment.html>


More information about the cfe-users mailing list