-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
| Bugzilla Link | 11256 |
| Version | trunk |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
On our project, one of the aspects that we enjoy about LLVM is the fact that it compiles cleanly with –Wall with gcc. We were previously running with a gcc 4.1.x compiler, but we recently upgraded to gcc/g++ 4.5.3. We were glad to see that LLVM 2.9 still compiles cleanly with this version, even though the gnu folks have added several warnings in the intervening time.
Just this week, I decided to try the latest LLVM – the current trunk version (3.1svn) and I also tried the tags/RELEASE_30 version. I was surprised and disappointed to see that, combined with the new gcc, and the changes to the headers in the intervening time, our code no longer compiles cleanly. In particular, we are suffering a spate of “-Wshadow” warnings in the new versions of the headers. See a discussion of this issue at: http://stackoverflow.com/questions/2958457/gcc-wshadow-is-too-strict for some simple examples of this warning.
Whether gcc’s –Wshadow is too strict or not, I found I was able to suppress all these warnings by the simple expedient of changing the spelling of the variables (mostly parameters) mentioned in these warnings. I just added a “1” suffix to each name that appears in a warning, and all uses of the name in any code bodies that appear in the headers.
Since we haven’t systematically attempted to use all the LLVM and Clang headers, we obviously don’t have a complete list of the instances of this issue, but I’ll provide a list of the headers, line numbers associated with the warnings, and names associated with the warnings, for which we’re seeing this problem:
Header line number(s) variable name(s)
llvm/GlobalValue.h 62 Name
llvm/Instructions.h 611,1265,1274,2739 SubclassData, Value
llvm/ADT/StringRef.h 72 data
llvm/ADT/ilist_node.h 81, 92 Next
llvm/ADT/ArrayRef.h 57, 61 data, begin, end
llvm/ADT/FoldingSet.h 481 Context
llvm/ADT/ValueMap.h 95, 203, 278, 326 Data, Map, I
llvm/Analysis/CFGPrinter.h 29 isSimple
llvm/CodeGen/MachineInstr.h 365 isKill
llvm/ExecutionEngine/ExecutionEngine.h 531 M
llvm/MC/MCDisassembler.h 58 STI
llvm/Support/CFG.h 103 idx
llvm/Support/TimeValue.h 89,266,315,323,333 seconds, microseconds, milliseconds
llvm/Support/GraphWriter.h 65 O
llvm/Support/ValueHandle.h 284 VP
llvm/Support/IRBuilder.h 138 InsertPoint
In all cases except one, the files are identical between the 3.0 rc1 and the 3.1svn versions (rev 143124). The exception is Instructions.h, where there are 7 additional lines added in the 3.1svn version, prior to the last instance of the problem.
I'd be glad to attach my edited versions of these files upon request.
There are at least 2 open problem reports against -Wshadow behavior in Clang, but this is not related - it is strictly an LLVM header compilation issue.
It would be great if these name changes could be included in the final release version of 3.0. Thanks in advance,
-Kevin