<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 integrated assembler does not handle :vararg macro arguments"
   href="http://llvm.org/bugs/show_bug.cgi?id=18919">18919</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang integrated assembler does not handle :vararg macro arguments
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>simon.hosie@arm.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>Created <span class=""><a href="attachment.cgi?id=12095" name="attach_12095" title="example assembly code (ARM).">attachment 12095</a> <a href="attachment.cgi?id=12095&action=edit" title="example assembly code (ARM).">[details]</a></span>
example assembly code (ARM).

I use an assembly macro like this:
.if cc
            \zzz
.endif
.endm

.set cc,1 /* normally something complicated */
...
    ifcc    sub         r12, r5, LSL #6
            bx          r12

This way I can stub out several instructions in a routine without needing to
cloud the code with lots of conditional assembly.  Typically I set cc to some
macro parameter to get different variants without excessive copy-paste.

Unfortunately:
 % clang --target=arm-linux-gnueabihf -integrated-as ifcc.S
ifcc.S:1:17: error: vararg is not a valid parameter qualifier for 'zzz' in
macro 'ifcc'
.macro ifcc zzz:vararg
                ^
ifcc.S:2:5: error: expected absolute expression
.if cc
    ^
ifcc.S:3:13: error: unexpected token at start of statement
            \zzz
            ^
ifcc.S:5:6: error: unexpected '.endm' in file, no current macro definition
.endm
     ^
ifcc.S:12:14: error: unexpected token in argument list
    ifcc sub r12, r5, LSL #6
             ^

While the GNU assembler sees no problems.</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>