2012-06-14 11 views
8

Nie mogę zabrać głosu c++-analyzer do pracy nad zabawkowym plikiem C++.scan-build clanga nie działa dla prostego pliku cpp

#include <iostream> 

using namespace std; 

int main() 
{ 
    int t[4]; 
    int x,y; 

    t[5]=1; 
    if(x) 
     y = 5; 
    x = t[y]; 
}   

makefile jest tylko

all: t.cpp 
    $(CXX) t.cpp 

scan-build make wyjściowa:

scan-build: 'clang' executable not found in '/usr/share/clang/scan-build/bin'. 
scan-build: Using 'clang' from path: /usr/bin/clang 
/usr/share/clang/scan-build/c++-analyzer t.cpp 
scan-build: Removing directory '/tmp/scan-build-2012-06-14-6' because it contains no reports. 

Jak C++ - praca analizatora? Wersja Clanga to 2.9 na Ubuntu 11.10.

EDYCJA: Mam świadomość, że kod jest niepoprawny. Chodzi o to, że Clang nie narzeka na oczywiste błędy. Jeśli wkleję powyższy kod do pliku .c (bez using ...), klang poprawnie emituje ostrzeżenia.

Odpowiedz

7

Oto powód:

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-September/011194.html

>>> When I run "clang --analyze" on my c++ source files individually I get reports, 
>>> but none when using the scan-build tool. 
>> 
>> This is intended behavior. C++ support is still alpha and so it isn't enabled 
>> by default in scan-build. It's really only intended to be used by those 
>> currently hacking on the analyzer. 
>> 
>> If you want to enable C++ analysis, you must define the environment variable 
>> CCC_ANALYZER_CPLUSPLUS. 
+3

Co powinno być ustawione? Próbowałem ustawić 1, ale nadal nie ma pracy. Google nie pojawia się przysadzisty. –

+2

Czy ta odpowiedź jest nadal aktualna? –

Powiązane problemy