[LLVMbugs] [Bug 14049] New: Confusing 'expanded from macro' note diagnostic with token pasting

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 10 03:59:16 PDT 2012


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

             Bug #: 14049
           Summary: Confusing 'expanded from macro' note diagnostic with
                    token pasting
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matti.niemenmaa+llvmbugs at iki.fi
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Consider the following:


#define M(a,b) a##b
#define xyzzy M(foo,bar)
int xyzzy = 0;
int xyzzy = 0; // Just to cause an error


For this, clang -fsyntax-only (both 3.1 and r165611, the former being also
affected by bug 12674 here) gives:


asdf.c:4:5: error: redefinition of 'foobar'
int xyzzy = 0; // Just to generate an error
    ^
asdf.c:2:17: note: expanded from macro 'xyzzy'
#define xyzzy M(foo,bar)
                ^
asdf.c:1:16: note: expanded from macro 'M'
#define M(a,b) a##b
               ^
<scratch space>:3:1: note: expanded from macro 'foo'
foobar
^
asdf.c:3:5: note: previous definition is here
int xyzzy = 0;
    ^
asdf.c:2:17: note: expanded from macro 'xyzzy'
#define xyzzy M(foo,bar)
                ^
asdf.c:1:16: note: expanded from macro 'M'
#define M(a,b) a##b
               ^
<scratch space>:2:1: note: expanded from macro 'foo'
foobar
^
1 error generated.


This seems mostly fine, but I find the scratch space notes somewhat confusing.
'foo' isn't a macro, it's just an identifier used in the definition of 'f'.

I'm not sure what that note is trying to say in any case - it seems like it's
redundant. We already know the end result is 'foobar', as it was stated in the
error message, and we've been shown the definition of the "last" macro (M) so
it doesn't seem like we need a separate note saying "... and the end result of
this process is 'foobar'".

-- 
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