[cfe-dev] [static checker] unexpected strip -std=gnu99

Дмитрий Дьяченко dimhen at gmail.com
Sun Sep 8 22:23:48 PDT 2013


Steve,

thank you for clarification.

Dmitry

2013/9/9 Steve McCoy <mccoyst at gmail.com>:
> According to the autoconf docs, AC_PROG_CC_C99 will put the flag in the CC
> variable. I am not yet sure what is the right thing for scan-build to do,
> but in the meantime you may be able to work around this with
>
>     scan-build make CFLAGS=-std=gnu99
>
> or by putting the flag in AM_CFLAGS in configure.ac.
>
> The autoconf people seem to believe that CC should not be overridden except
> via the environment variable during ./configure, so they feel free to add
> flags to it. However, there is currently no way for scan-build to be passed
> a "make" command and know whether it will run a handwritten makefile or one
> generated by autoconf. Therefore, with or without r189372, some user will
> have to do extra work. From what I understand, running an autoconf-generated
> make through scan-build is only necessary to collect and generate the bug
> reports and not to override CC with ccc-analyzer, as that step is done when
> running "scan-build ./configure". If I'm right, maybe the solution would be
> to simply add another flag to scan-build, e.g. -a, which will prevent
> scan-build from passing CC and CXX to make, and the autoconf example of
> scan-build.html could change to use this flag. Anybody have thoughts on
> that?
>
>
>
> On Sun, Sep 8, 2013 at 4:04 PM, Дмитрий Дьяченко <dimhen at gmail.com> wrote:
>>
>> I use autoconf/libtool.
>> In configure.ac I have 'AC_PROG_CC_C99'
>>
>> After all Makefile contains
>> CC =
>> /home/dimhen/src/llvm_189371/tools/clang/tools/scan-build/ccc-analyzer
>> -std=gnu99
>> CFLAGS =   -g -DNO_ASN1_RT_REDUNDANT -D_COMPACT -fvar-tracking
>> -fvar-tracking-assignments -fno-builtin -fno-common -O0 -pipe -m64
>> -DUSE_JEMALLOC -DUSE_XMLSEC
>>
>> 2013/9/8 Steve McCoy <mccoyst at gmail.com>:
>> > Are you setting 'CC=gcc -std=gnu99' in your build script, rather than
>> > putting the -std flag inCFLAGS
>> >
>> >
>> > On Sunday, September 8, 2013, Дмитрий Дьяченко wrote:
>> >>
>> >> Jordan,
>> >>
>> >> Now I know problem commit -- 189372, but I don't have a little testcase
>> >> yet.
>> >>
>> >> [ clang]$ svn log -r189372
>> >>
>> >> ------------------------------------------------------------------------
>> >> r189372 | jrose | 2013-08-27 20:59:33 +0400 (Вт., 27 авг. 2013) | 6
>> >> lines
>> >>
>> >> scan-build: Set CC and CXX as make variables when wrapping make builds.
>> >> [...]
>> >>
>> >> A bit more about my project's build:
>> >> 1) autoreconf
>> >> 2) '... scan-build configure ...'
>> >> After step 2) build trees are identical for scan-build-189371 and
>> >> scan-build-189372
>> >>
>> >> 3) '... scan-build make'
>> >> Difference in command line is: no '-std=gnu99' in rev.189372
>> >>
>> >> rev.189372 (FAIL)
>> >> $ ~/src/llvm_189372/tools/clang/tools/scan-build/scan-build
>> >> --use-analyzer=/home/dimhen/build/csa_189372/Release+Asserts/bin/clang
>> >> make
>> >> scan-build: Using
>> >> '/home/dimhen/build/csa_189372/Release+Asserts/bin/clang' for static
>> >> analysis
>> >> /bin/sh ../../../../libtool  --tag=CC --tag=disable-static
>> >> --mode=compile
>> >> /home/dimhen/src/llvm_189372/tools/clang/tools/scan-build/ccc-analyzer
>> >> -DHAVE_CONFIG_H ..... x.c
>> >>
>> >> rev.189371 (OK)
>> >> $ ~/src/llvm_189371/tools/clang/tools/scan-build/scan-build
>> >> --use-analyzer=/home/dimhen/build/csa_189371/Release+Asserts/bin/clang
>> >> make
>> >> scan-build: Using
>> >> '/home/dimhen/build/csa_189371/Release+Asserts/bin/clang' for static
>> >> analysis
>> >> /bin/sh ../../../../libtool  --tag=CC --tag=disable-static
>> >> --mode=compile
>> >> /home/dimhen/src/llvm_189371/tools/clang/tools/scan-build/ccc-analyzer
>> >> -std=gnu99 -DHAVE_CONFIG_H ... x.c
>> >>
>> >>
>> >> A bit more about my environment
>> >>
>> >> Fedora 19/x86_64
>> >> make 3.82
>> >> autoconf 2.69
>> >> libtool 2.4.2
>> >> m4 1.4.16
>> >>
>> >> Thank you,
>> >> Dmitry
>> >>
>> >> 2013/9/6 Дмитрий Дьяченко <dimhen at gmail.com>:
>> >> > Thank you, Jordan
>> >> >
>> >> > I'll try to reduce project to something reasonable.
>> >> >
>> >> > Dmitry
>> >> >
>> >> > 2013/9/6 Jordan Rose <jordan_rose at apple.com>:
>> >> >> I don't see this in a simple test. Can you send a test project that
>> >> >> exhibits this behavior?
>> >> >>
>> >> >> Jordan
>> >> >>
>> >> >>
>> >> >> On Sep 6, 2013, at 11:25 , Дмитрий Дьяченко <dimhen at gmail.com>
>> >> >> wrote:
>> >> >>
>> >> >>> Hello!
>> >> >>>
>> >> >>> Sounds like sometimes after 2013-aug-23 (probably before 28 aug)
>> >> >>> scan-build  (or maybe clang) starts strip '-std=gnu99' from command
>> >> >>> line.
>> >> >>>
>> >> >>> I configure/make project using gcc for build and static checker for
>> >> >>> analyze.
>> >> >>>
>> >> >>> make with gcc has '-std=gnu99' in command line, but with
>> >> >>> scan-build/ccc-analyzer not.
>> >> >>>
>> >> >>> Anybody can confirm this?
>> >> >>>
>> >> >>> Thank you,
>> >> >>> Dmitry
>> >> >>> _______________________________________________
>> >> >>> cfe-dev mailing list
>> >> >>> cfe-dev at cs.uiuc.edu
>> >> >>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>> >> >>
>> >>
>> >> _______________________________________________
>> >> cfe-dev mailing list
>> >> cfe-dev at cs.uiuc.edu
>> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>




More information about the cfe-dev mailing list