[LLVMbugs] [Bug 4438] New: Using the preprocessor from within macros fails

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jun 24 01:13:03 PDT 2009


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

           Summary: Using the preprocessor from within macros fails
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ed at 80386.nl
                CC: llvmbugs at cs.uiuc.edu
            Blocks: 3696


The following code doesn't seem to build with Clang, but it does work with GCC:

#include <stdio.h>

#define DOIT(x, y, z)   puts(x y z)
#define YES 1

int
main(int argc, char *argv[])
{
        DOIT("Hello ",
#if YES >= 1
             "World",
#endif
#if YES > 1
             "?",
#endif
             "!");

        return (0);
}

test.c:16:10: error: too few arguments provided to function-like macro
invocation
             "!");
                ^
test.c:9:2: error: use of undeclared identifier 'DOIT'
        DOIT("Hello ",
        ^
2 diagnostics generated.


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