2012-06-14 9 views
8

Non riesco a ottenere clang c++-analyzer per lavorare su un file C++ giocattolo.clang's scan-build non funziona per il semplice file 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 è solo

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

scan-build make uscita:

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. 

Come rendere C++ - lavoro analizzatore? La versione di Clang è 2.9 su Ubuntu 11.10.

EDIT: Sono a conoscenza che il codice non è corretto. Il punto è che Clang non si lamenta degli errori evidenti. Se si incolla il codice precedente in un file .c (senza il valore using ...), il clang emette correttamente gli avvisi.

risposta

7

Ecco il motivo:

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

cosa dovrebbe essere impostata su? Ho provato a impostarlo su 1 ma ancora non funziona. Google non sta diventando tozzo. –

+2

Questa risposta è ancora attuale? –

Problemi correlati