[cfe-dev] I get no reports from running "scan-build <args...> make -k

Anna Zaks ganna at apple.com
Wed Jun 26 09:54:03 PDT 2013


Hi Mikhail,

You seem to have some custom set up. Have you tried downloading the latest analyzer package and following the instructions on running scan-build on your project?
http://clang-analyzer.llvm.org/scan-build.html

Cheers,
Anna.

On Jun 24, 2013, at 1:44 AM, Duglas Mikle <drongoa6 at yandex.ru> wrote:

> 
> Hi Ted,
> 
> my name is Mikhail, I'm trying to adopt clang for my project. It works with "C", but I couldn't achieve success with C++.
> I saw similar thread, tried set environment, without success yet. 
> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-September/011194.html
> Let me describe what I have and if you can help it will be very appreciated.
> 
> 
> linux - Ubuntu
> g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
> 
> clang --version
> clang version 3.3 (tags/RELEASE_33/final)
> 
> which clang
> /usr/local/bin/clang
> 
> /usr/share/clang/scan-build/scan-build
> 
> People doesn't like get letters in attachment, so I used several source files from here:
> http://mrbook.org/tutorials/make/
> 
> 
> Then create in the same directory Makefile:
> all:
> 	g++ main.cpp hello.cpp factorial.cpp -o hello
> 
> allclang:
> 	clang++ main.cpp hello.cpp factorial.cpp -o hello
> 
> 
> clean:
> 	rm -rf hello 
> 
> Then create script for scan-build:
> clang_example.sh
> ===========
> #!/bin/sh
> 
> export CC="/usr/share/clang/scan-build/ccc-analyzer"
> export CXX="/usr/share/clang/scan-build/c++-analyzer"
> export CXXAnalyzer="c++-analyzer"
> 
> #CLANG_PATH="--use-analyzer=/usr/local/bin/clang++"
> CLANG_PATH="--use-analyzer=/usr/share/clang/scan-build/c++-analyzer"
> VERBOSE="-v -v"
> 
> export PATH=/usr/share/clang/scan-build:/usr/local/bin:$PATH
> export CCC_ANALYZER_CPLUSPLUS=1
> 
> 
> export LDPLUSPLUS=/usr/share/clang/scan-build/c++-analyzer
> 
> scan-build $VERBOSE $CLANG_PATH  -o ./scan_report -k -V make clean allclang
> ===========
> 
> I did small tuning in source files:
> 1) added "using namespace std;" for successful compilation and then
> 2) factorial.cpp
> replace
> return(n * factorial(n-1));
> to
> return(n * factorial(n-1)/0);
> 
> After these changes I get:
> ----------------------------------------
>> make allclang
> clang++ main.cpp hello.cpp factorial.cpp -o hello
> factorial.cpp:5:27: warning: division by zero is undefined [-Wdivision-by-zero]
>        return(n * factorial(n-1)/0);
>                                 ^~
> 1 warning generated.
> -----------------------------------------
> Perfect! Clan++ works and point to the Error, but
> 
>> sh clang_example.sh
> 
> doesn't create report which contains the error.
> scan-build: Removing directory 'SimpleProject/scan_report/2013-06-24-1' because it contains no reports.
> 
> I tried different workarounds, but it doesn't work. May be I need to install all tools in /usr/bin/ and try to do it one more time, I don't know.
> Ted, if you have time please help to resolve the issue.
> 
> Best Regards,
> Mikhail.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130626/ad5d3dfc/attachment.html>


More information about the cfe-dev mailing list