[LLVMbugs] [Bug 7486] New: clang: hard to understand error message for missing macro declaration

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 24 12:55:04 PDT 2010


           Summary: clang: hard to understand error message for missing
                    macro declaration
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu

This compiles fine with clang:
#define FO0(X) unsigned X = 0;

struct Bar {
    int x;

However this gives an undecipherable error message (without looking at the
source code at least):
struct Bar {
    int x;

$ clang foo.c -c
foo.c:2:8: warning: declaration of 'struct Bar' will not be visible outside of
this function
struct Bar {
foo.c:2:1: error: declaration does not declare a parameter                      
struct Bar {
foo.c:4:3: error: expected function body after function declarator              
3 diagnostics generated.  

The error is that the header defining FO0 was not included (or the name of the
macro was typoed).
Clang's error says nothing about FO0. 
One of the notes should show the "function"'s name at least.

Also clang has plenty of clues that this really isn't a function declaration,
so it could hint that maybe you wanted to invoke an undeclared macro.

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