build warnings

Hi,

I want to see any warning that are produced when I build llvm (in
particular, those in code I'm writing). Before I do something quick and
dirty with tee and grep, I was wondering if there was already something
available to, for example, reprint warnings after a build completes?

Thanks,
--Paul

Hi Paul,

That should be easy enough, because the LLVM build has no warnings in it!

Some of us build with -Werror, and even with those of us that don't warnings are not tolerated. You're already seeing all the warnings that are coming out of the build :slight_smile:

Cheers,

James

So, all the "variable might be used uninitialized" warnings are in clang ?

Csaba

Hi,

I haven't seen those errors. Clang and LLVM both build with no warnings on the 3 versions of GCC I test with. MSVC reports loads of warnings however.

Cheers,

James

$ make happiness
...
Updated to revision 142790.
...
make[4]: Entering directory
`/home/ecsardu/LLVM/build-tcclab1/tools/clang/tools/libclang'
llvm[4]: Compiling CIndex.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CIndexCXX.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CIndexCodeCompletion.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CIndexDiagnostic.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CIndexHigh.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CIndexInclusionStack.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CIndexUSRs.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CIndexer.cpp for Release+Asserts build (PIC)
/home/ecsardu/LLVM/llvm/tools/clang/tools/libclang/CIndexUSRs.cpp: In
function 'bool clang::cxcursor::getDeclCursorUSR(const clang::Decl*,
llvm::SmallVectorImpl<char>&)':
/home/ecsardu/LLVM/llvm/tools/clang/tools/libclang/CIndexUSRs.cpp:820:22:
warning: cast from type 'const clang::Decl*' to type 'clang::Decl*'
casts away qualifiers
llvm[4]: Compiling CXCursor.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CXString.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling CXType.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling IndexBody.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling IndexDecl.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling IndexTypeSourceInfo.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling Indexing.cpp for Release+Asserts build (PIC)
llvm[4]: Compiling IndexingContext.cpp for Release+Asserts build (PIC)
/home/ecsardu/LLVM/llvm/tools/clang/tools/libclang/IndexingContext.cpp:
In member function 'void
clang::cxindex::IndexingContext::handleReference(const
clang::NamedDecl*, clang::SourceLocation, const clang::NamedDecl*,
const clang::DeclContext*, const clang::Expr*, CXIdxEntityRefKind)':
/home/ecsardu/LLVM/llvm/tools/clang/tools/libclang/IndexingContext.cpp:401:68:
warning: cast from type 'const clang::Decl*' to type 'clang::Decl*'
casts away qualifiers
llvm[4]: Linking Release+Asserts Shared Library libclang.so

This is with gcc version 4.5.0 20100604 [gcc-4_5-branch revision
160292] (SUSE Linux) on openSUSE 11.3 "Teal"
Also gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) on Ubuntu 10.04 LTS

That's interesting, what version of GCC are you using?

[ 94%] [ 94%] Building CXX object
tools/clang/tools/libclang/CMakeFiles/libclang.dir/IndexingContext.cpp.o
Building CXX object
tools/clang/lib/StaticAnalyzer/Core/CMakeFiles/clangStaticAnalyzerCore.dir/M
emRegion.cpp.o
Linking CXX shared library ../../../../lib/liblibclang.so

James,

[ 94%] [ 94%] Building CXX object
tools/clang/tools/libclang/CMakeFiles/libclang.dir/IndexingContext.cpp.o
Building CXX object
tools/clang/lib/StaticAnalyzer/Core/CMakeFiles/clangStaticAnalyzerCore.dir/M
emRegion.cpp.o
Linking CXX shared library ../../../../lib/liblibclang.so

I am suspicious, I guess you might not enable optimization on cmake build.

1) make sure with "make VERBOSE=1"
2) make sure you would set proper CMAKE_BUILD_TYPE, or CMAKE_CXX_FLAGS.

...Takumi

Takumi,

VERBOSE=1 only changes the makefile to not output colour and to output the
entire command line. AFAIK it does not unsurpress any warnings.

AFAIK no warnings are surpressed, although that is of course possible.

Cheers,

James

The warnings would not be in the released LLVM, but rather in the code
that I am developing inside of LLVM (eg, a new pass).

-Werror is a good call, and probably the simplest thing I can do too.

Thanks
--Paul

As I said, gcc version 4.5.0 20100604 [gcc-4_5-branch revision
160292] (SUSE Linux) on openSUSE 11.3 "Teal"
Also gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) on Ubuntu 10.04 LTS