[llvm-bugs] [Bug 34319] New: Attribute names enclosed by __ are sometimes rejected

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 25 01:07:36 PDT 2017


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

            Bug ID: 34319
           Summary: Attribute names enclosed by __ are sometimes rejected
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sebastian.huber at embedded-brains.de
                CC: llvm-bugs at lists.llvm.org

>From the GCC documentation we have

https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax

"You may optionally specify attribute names with ‘__’ preceding and following
the name. This allows you to use them in header files without being concerned
about a possible macro of the same name. For example, you may use the attribute
name __noreturn__ instead of noreturn."

It would be nice if this is also supported by clang, e.g. for use in standard C
library header files. We have for example:

void f0(void) __attribute__((noreturn));
void f1(void) __attribute__((__noreturn__));
void f2(int *l) __attribute__((exclusive_lock_function(*l)));
void f3(int *l) __attribute__((__exclusive_lock_function__(*l)));

Which yields:

clang -c test.c
test.c:4:61: error: use of undeclared identifier 'l'
void f3(int *l) __attribute__((__exclusive_lock_function__(*l)));
                                                            ^
1 error generated.

-- 
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/20170825/3dbe945a/attachment.html>


More information about the llvm-bugs mailing list