<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang can't compile sys/std.h that comes with systemtap"
   href="http://llvm.org/bugs/show_bug.cgi?id=17198">17198</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang can't compile sys/std.h that comes with systemtap
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>martin@martincmartin.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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:

<a href="https://bugzilla.redhat.com/show_bug.cgi?id=999419">https://bugzilla.redhat.com/show_bug.cgi?id=999419</a>
<a href="https://sourceware.org/bugzilla/show_bug.cgi?id=13974">https://sourceware.org/bugzilla/show_bug.cgi?id=13974</a>


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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>