[llvm-bugs] [Bug 32993] New: [[gnu::init_priority(N)]] generates "unknown attribute" warning while __attribute__((init_priority(N))) works

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 10 15:47:30 PDT 2017


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

            Bug ID: 32993
           Summary: [[gnu::init_priority(N)]] generates "unknown
                    attribute" warning while
                    __attribute__((init_priority(N))) works
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: romain.geissler at amadeus.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Hi,

The following snippet (built with -std=gnu++14) will yield a "unknown
attribute" warning:

struct A{};

A A1 [[gnu::init_priority(1000)]]; // warning generated here
A A2 __attribute__((init_priority(1000))); // no warning here


<source>:3:8: warning: unknown attribute 'init_priority' ignored
[-Wunknown-attributes]
A A1 [[gnu::init_priority(1000)]];
       ^
1 warning generated.

According to the documentation here
https://clang.llvm.org/docs/LanguageExtensions.html#non-standard-c-11-attributes
[[gnu::init_priority(1000)]] should be an alias for
__attribute__((init_priority(1000))), but it doesn't seem to be the case.

Tested on clang 4.0. See here https://godbolt.org/g/xvqO1z

Cheers,
Romain

-- 
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/20170510/290c1c36/attachment.html>


More information about the llvm-bugs mailing list