[llvm-bugs] [Bug 33926] New: attribute declaration must precede definition

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 25 08:25:43 PDT 2017


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

            Bug ID: 33926
           Summary: attribute declaration must precede definition
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zahira.ammarguellat at intel.com
                CC: llvm-bugs at lists.llvm.org

bash-4.2$ cat t3.c
extern __inline int foo (int __goo) {
  return __goo;
}
extern __typeof(foo) foo __asm__("");
bash-4.2$
bash-4.2$ gcc -v
gcc version 4.8.5 (GCC)
bash-4.2$
bash-4.2$ gcc -c t3.c
bash-4.2$

bash-4.2$ ../llorg_ws/builds/llorgefi2linux_debug/llvm/bin/clang -v
clang version 6.0.0 (cfe/trunk 308973)
bash-4.2$

bash-4.2$ clang -c -Xclang -ast-dump t3.c | grep foo
t3.c:4:34: warning: attribute declaration must precede definition
      [-Wignored-attributes]
extern __typeof(foo) foo __asm__("");
                                 ^
t3.c:1:21: note: previous definition is here
extern __inline int foo (int __goo) {
                    ^
1 warning generated.
|-FunctionDecl 0xb5c40b0 <t3.c:1:1, line:3:1> line:1:21 referenced foo 'int
(int)' extern inline
`-FunctionDecl 0xb5c42e8 prev 0xb5c40b0 <line:4:1, col:36> col:22 foo 'int
(int)' extern
bash-4.2$

gcc doesn't generate a warning. clang does. We can see that foo has 2 different
attributes.

-- 
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/20170725/7c24ea57/attachment.html>


More information about the llvm-bugs mailing list