<html>
    <head>
      <base href="https://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 --- - Unusual attribute behavior when specifying __declspec(noreturn) attribute"
   href="https://llvm.org/bugs/show_bug.cgi?id=28578">28578</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unusual attribute behavior when specifying __declspec(noreturn) attribute
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>keyboardsmoke@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When I'm printing a function from AST data, the following function:

__forceinline __declspec(noalias, deprecated("GO AWAY"), dllexport, nothrow,
noinline) void bodyFunction() {
    printf("Hello, world!\n");
}

will result in the following:
inline void bodyFunction() __declspec(noinline) __declspec(nothrow)
__declspec(dllexport) __declspec(deprecated("GO AWAY")) __declspec(noalias)
__forceinline {
    printf("Hello, world!\n");
}

Ignoring the incorrect visual studio formatting, this is "correct"
However, when you add "noreturn" to the declspec, it inserts duplicates of
declared attributes.

So this function:
__forceinline __declspec(noalias, deprecated("GO AWAY"), dllexport, nothrow,
noinline, noreturn) void bodyFunction() {
    printf("Hello, world!\n");
}

Now results in this:
inline void bodyFunction() __declspec(noinline) __declspec(nothrow)
__declspec(dllexport) __declspec(deprecated("GO AWAY")) __declspec(noalias)
__forceinline __declspec(noinline) __declspec(nothrow)
__declspec(deprecated("GO AWAY")) __declspec(noalias) {
    printf("Hello, world!\n");
}


I am unsure if noreturn is the cause of this, specifically, but it seems to be
duplicating existing attributes (or inserting them multiple times), when I
iterate the attributes the duplicates do indeed exist, so it isn't a printing
issue.</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>