[llvm-bugs] [Bug 28578] New: Unusual attribute behavior when specifying __declspec(noreturn) attribute

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 15 16:51:34 PDT 2016


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

            Bug ID: 28578
           Summary: Unusual attribute behavior when specifying
                    __declspec(noreturn) attribute
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: keyboardsmoke at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
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/20160715/2e9fc9d1/attachment.html>


More information about the llvm-bugs mailing list