[LLVMbugs] [Bug 19141] New: ##__VA_ARGS__ does not expand inner macros, whereas __VA_ARGS__ works as expected

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 14 05:21:08 PDT 2014


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

            Bug ID: 19141
           Summary: ##__VA_ARGS__ does not expand inner macros, whereas
                    __VA_ARGS__ works as expected
           Product: clang
           Version: 3.4
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jeffery.thomas at gm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

##__VA_ARGS__ does not expand inner macros, whereas __VA_ARGS__ works as
expected.

This input file (foo.m):

[--
#define F1(...) [NSString stringWithFormat:__VA_ARGS__]
#define F2(format, ...) [NSString stringWithFormat:(format), ##__VA_ARGS__]

    NSLog(F1(@"%@", F1(@"%@", @"a")));
    NSLog(F2(@"%@", F2(@"%@", @"a")));
--]

when processed with `clang -E -o foo.i foo.m`, produces the following output:

[--
# 1 "foo.m"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 178 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "foo.m" 2



    NSLog([NSString stringWithFormat:@"%@", [NSString stringWithFormat:@"%@",
@"a"]]);
    NSLog([NSString stringWithFormat:(@"%@"), F2(@"%@", @"a")]);
--]

Version Details:

[--
$ clang --version
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
--]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140314/91e63310/attachment.html>


More information about the llvm-bugs mailing list