[LLVMbugs] [Bug 11256] New: Lots of headers don't compile clean with gcc 4.5.3 with -Wall

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 28 11:06:27 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=11256

           Summary: Lots of headers don't compile clean with gcc 4.5.3
                    with -Wall
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: Kevin.Harris at unisys.com
                CC: llvmbugs at cs.uiuc.edu


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

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list