[LLVMbugs] [Bug 23071] New: MS-compatibility: XAudio2.h fails to compile due to spaces in GUID

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 30 07:36:28 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23071

            Bug ID: 23071
           Summary: MS-compatibility: XAudio2.h fails to compile due to
                    spaces in GUID
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathan.sauer at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code (excerpted from Microsoft's DirectX header XAudio2.h) fails
to compile with Windows compatibility:

#define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x))

#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  class
DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8)
className

DEFINE_CLSID(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af);
//DEFINE_CLSID(XAudio2,5a508685,a254,4fba,9b,82,9a,24,b0,03,06,af);


This results in: 

% clang++ -fms-extensions -Wno-invalid-token-paste -c clang.cpp 
clang.cpp:6:1: error: uuid attribute contains a malformed GUID
DEFINE_CLSID(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af);
^
clang.cpp:4:8: note: expanded from macro 'DEFINE_CLSID'
        class
DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8)
className
              ^
clang.cpp:1:50: note: expanded from macro 'DECLSPEC_UUID_WRAPPER'
#define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x))
                                                 ^
<scratch space>:16:1: note: expanded from here
"5a508685- a254- 4fba- 9b82- 9a24b00306af"
^
1 error generated.


When using the commented DEFINE_CLSID-line without the spaces, the code
compiles successfully.

-- 
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/20150330/e43ce82e/attachment.html>


More information about the llvm-bugs mailing list