[LLVMbugs] [Bug 17198] New: Clang can't compile sys/std.h that comes with systemtap

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 11 11:55:45 PDT 2013


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

            Bug ID: 17198
           Summary: Clang can't compile sys/std.h that comes with
                    systemtap
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: martin at martincmartin.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang's preprocessor fails on systemtap's sys/std.h.

The following code:

#include <sys/sdt.h>

int main() {
    DTRACE_PROBE(a, b);
}

compiles with with G++, but when compiled with clang++ 3.3 gives the error
output below.

See also:

https://bugzilla.redhat.com/show_bug.cgi?id=999419
https://sourceware.org/bugzilla/show_bug.cgi?id=13974


clang++ dtrace_probe.cpp
dtrace_probe.cpp:4:5: error: unknown flag
    DTRACE_PROBE(a, b);
    ^
/usr/include/sys/sdt.h:362:3: note: expanded from macro 'DTRACE_PROBE'
  STAP_PROBE(provider,probe)
  ^
/usr/include/sys/sdt.h:254:3: note: expanded from macro 'STAP_PROBE'
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/include/sys/sdt.h:36:27: note: expanded from macro '_SDT_PROBE'
    __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \
                          ^
note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)
/usr/include/sys/sdt.h:43:31: note: expanded from macro '_SDT_ASM_3'
# define _SDT_ASM_3(a, b, c)            _SDT_S(a) "," _SDT_S(b) "," \
                                        ^
/usr/include/sys/sdt.h:40:22: note: expanded from macro '_SDT_S'
# define _SDT_S(x)                      #x
                                        ^
<scratch space>:9:2: note: expanded from here
".pushsection .note.stapsdt"
 ^
<inline asm>:2:31: note: instantiated into assembly here
.pushsection .note.stapsdt,"?","note"
                              ^
dtrace_probe.cpp:4:5: error: .popsection without corresponding .pushsection
    DTRACE_PROBE(a, b);
    ^
/usr/include/sys/sdt.h:362:3: note: expanded from macro 'DTRACE_PROBE'
  STAP_PROBE(provider,probe)
  ^
/usr/include/sys/sdt.h:254:3: note: expanded from macro 'STAP_PROBE'
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/include/sys/sdt.h:36:27: note: expanded from macro '_SDT_PROBE'
    __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \
                          ^
note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)
/usr/include/sys/sdt.h:41:26: note: expanded from macro '_SDT_ASM_1'
# define _SDT_ASM_1(x)                  _SDT_S(x) "\n"
                                        ^
/usr/include/sys/sdt.h:40:22: note: expanded from macro '_SDT_S'
# define _SDT_S(x)                      #x
                                        ^
<scratch space>:29:2: note: expanded from here
".popsection"
 ^
<inline asm>:14:12: note: instantiated into assembly here
.popsection
           ^
dtrace_probe.cpp:4:5: error: expected '@' or '%' before type
    DTRACE_PROBE(a, b);
    ^
/usr/include/sys/sdt.h:362:3: note: expanded from macro 'DTRACE_PROBE'
  STAP_PROBE(provider,probe)
  ^
/usr/include/sys/sdt.h:254:3: note: expanded from macro 'STAP_PROBE'
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/include/sys/sdt.h:38:27: note: expanded from macro '_SDT_PROBE'
    __asm__ __volatile__ (_SDT_ASM_BASE);                                   \
                          ^
note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)
/usr/include/sys/sdt.h:45:36: note: expanded from macro '_SDT_ASM_5'
# define _SDT_ASM_5(a, b, c, d, e)      _SDT_S(a) "," _SDT_S(b) "," \
                                        ^
/usr/include/sys/sdt.h:40:22: note: expanded from macro '_SDT_S'
# define _SDT_S(x)                      #x
                                        ^
<scratch space>:32:2: note: expanded from here
".pushsection .stapsdt.base"
 ^
<inline asm>:2:33: note: instantiated into assembly here
.pushsection .stapsdt.base,"aG","progbits",.stapsdt.base,comdat
                                ^
dtrace_probe.cpp:4:5: error: .popsection without corresponding .pushsection
    DTRACE_PROBE(a, b);
    ^
/usr/include/sys/sdt.h:362:3: note: expanded from macro 'DTRACE_PROBE'
  STAP_PROBE(provider,probe)
  ^
/usr/include/sys/sdt.h:254:3: note: expanded from macro 'STAP_PROBE'
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/include/sys/sdt.h:38:27: note: expanded from macro '_SDT_PROBE'
    __asm__ __volatile__ (_SDT_ASM_BASE);                                   \
                          ^
note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)
/usr/include/sys/sdt.h:41:26: note: expanded from macro '_SDT_ASM_1'
# define _SDT_ASM_1(x)                  _SDT_S(x) "\n"
                                        ^
/usr/include/sys/sdt.h:40:22: note: expanded from macro '_SDT_S'
# define _SDT_S(x)                      #x
                                        ^
<scratch space>:42:2: note: expanded from here
".popsection"
 ^
<inline asm>:7:12: note: instantiated into assembly here
.popsection
           ^
4 errors generated.

$ clang++ --version
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-unknown-linux-gnu
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/20130911/b754c7d9/attachment.html>


More information about the llvm-bugs mailing list