r236423 - [analyzer] scan-build: support spaces in compiler path and arguments.
Ahmed Bougacha
ahmed.bougacha at gmail.com
Tue May 5 19:31:27 PDT 2015
On Tue, May 5, 2015 at 12:52 PM, Anton Yartsev <anton.yartsev at gmail.com> wrote:
> r236533 should fix an issue. This is the first variant of the patch that
> wraps an argument with quotes only if an argument has spaces, otherwise an
> argument is left unmodified.
Hi Anton,
Seems like this is still causing problems, on stuff like:
ccc-analyzer -fno-vectorize -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -I../../../src/include
-DVAL_CONFIGURE="\"'CFLAGS=-fno-vectorize' 'CC=ccc-analyzer'\""
-DVAL_CC="\"ccc-analyzer\"" -DVAL_CPPFLAGS="\"\""
-DVAL_CFLAGS="\"-fno-vectorize -Wall -Wmissing-prototypes
-Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-Wformat-security -fno-strict-aliasing -fwrapv\""
-DVAL_CFLAGS_SL="\"\"" -DVAL_LDFLAGS="\"-Wl,-dead_strip_dylibs\""
-DVAL_LDFLAGS_EX="\"\"" -DVAL_LDFLAGS_SL="\"\"" -DVAL_LIBS="\"-lpgport
-lz -lreadline -lm \"" -c -o pg_config.o pg_config.c
Which leads to a funky looking command line:
#SHELL (cd ... && 'clang' '-cc1' '-triple'
'x86_64-apple-macosx10.10.0' '-analyze' ... '-D'
'"VAL_CONFIGURE="'CFLAGS=-fno-vectorize' 'CC=ccc-analyzer'""'
and finally to a bunch of errors:
In file included from <built-in>:325:
<command line>:1:9: error: macro name must be an identifier
#define "VAL_CONFIGURE "'CFLAGS=-fno-vectorize' 'CC=ccc-analyzer'""
I went ahead and reverted this in r236562. I believe the first part
is fine, but I don't see why you need the second part: from what I've
seen, clang -### generates the line, and it always single-quotes
everything. When are spaces a problem there?
-Ahmed
>
>> Anton,
>>
>> This has caused regressions on our internal ASan builedbot while analyzing
>> openssl. (Please, revert until the issue is solved.)
>>
>>
>> /Users/buildslave/jenkins/workspace/Static_Analyzer_master/scan-build/ccc-analyzer
>> -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN
>> -DHAVE_DLFCN_H -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN
>> -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT
>> -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM
>> -DWHIRLPOOL_ASM -c -o cryptlib.o cryptlib.c
>> clang: error: no such file or directory: '"-cc1"'
>> clang: error: no such file or directory: '"-triple"'
>> clang: error: no such file or directory: '"i386-apple-macosx10.10.0"'
>> clang: error: no such file or directory: '"-analyze"'
>> clang: error: no such file or directory: '"-disable-free"'
>> clang: error: no such file or directory: '"-disable-llvm-verifier"'
>> clang: error: no such file or directory: '"-main-file-name"'
>> clang: error: no such file or directory: '"cryptlib.c"'
>> clang: error: no such file or directory: '"-analyzer-store=region"'
>> clang: error: no such file or directory:
>> '"-analyzer-opt-analyze-nested-blocks"'
>> clang: error: no such file or directory: '"-analyzer-eagerly-assume"'
>> clang: error: no such file or directory: '"-analyzer-checker=c
>> ....
>>>
>>> On May 4, 2015, at 6:37 AM, Anton Yartsev <anton.yartsev at gmail.com>
>>> wrote:
>>>
>>> Author: ayartsev
>>> Date: Mon May 4 08:37:36 2015
>>> New Revision: 236423
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=236423&view=rev
>>> Log:
>>> [analyzer] scan-build: support spaces in compiler path and arguments.
>>>
>>> This fixes errors that occur if a path to the default compiler has spaces
>>> or if an argument with spaces is given to compiler (e.g. via -I).
>>> (http://reviews.llvm.org/D9357)
>>>
>>> Modified:
>>> cfe/trunk/tools/scan-build/ccc-analyzer
>>>
>>> Modified: cfe/trunk/tools/scan-build/ccc-analyzer
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/ccc-analyzer?rev=236423&r1=236422&r2=236423&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/tools/scan-build/ccc-analyzer (original)
>>> +++ cfe/trunk/tools/scan-build/ccc-analyzer Mon May 4 08:37:36 2015
>>> @@ -145,7 +145,7 @@ sub ProcessClangFailure {
>>> print OUT "@$Args\n";
>>> close OUT;
>>> `uname -a >> $PPFile.info.txt 2>&1`;
>>> - `$Compiler -v >> $PPFile.info.txt 2>&1`;
>>> + `"$Compiler" -v >> $PPFile.info.txt 2>&1`;
>>> rename($ofile, "$PPFile.stderr.txt");
>>> return (basename $PPFile);
>>> }
>>> @@ -179,7 +179,7 @@ sub GetCCArgs {
>>> die "could not find clang line\n" if (!defined $line);
>>> # Strip leading and trailing whitespace characters.
>>> $line =~ s/^\s+|\s+$//g;
>>> - my @items = quotewords('\s+', 0, $line);
>>> + my @items = quotewords('\s+', 1, $line);
>>> my $cmd = shift @items;
>>> die "cannot find 'clang' in 'clang' command\n" if (!($cmd =~
>>> /clang/));
>>> return \@items;
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
> --
> Anton
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list