[llvm-bugs] [Bug 50614] New: __has_declspec_attribute falsely reports some attrs as supported for MinGW and Cygwin targets

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 8 00:56:47 PDT 2021


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

            Bug ID: 50614
           Summary: __has_declspec_attribute falsely reports some attrs as
                    supported for MinGW and Cygwin targets
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xtkoba at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 24923
  --> https://bugs.llvm.org/attachment.cgi?id=24923&action=edit
Repro

It is true that the warnings for this specific repro can be silenced by adding
the -fms-extensions option, but this option causes other problems in practice
(causing function redefinition errors) and so I think I cannot use it.


$ cat mingw-declspec.c

#if __has_declspec_attribute(noalias)
__declspec(noalias)
#else
#warning no declspec noalias
#endif
void foo(void *a, void *b);

struct
#if __has_declspec_attribute(align)
__declspec(align(8))
#else
#warning no declspec align
#endif
bar { int i, j; } baz;

$ clang --target=x86_64-w64-mingw32 -fdeclspec -c mingw-declspec.c
mingw-declspec.c:3:12: warning: unknown attribute 'noalias' ignored
[-Wunknown-attributes]
__declspec(noalias)
           ^~~~~~~
<built-in>:343:38: note: expanded from here
#define __declspec(a) __attribute__((a))
                                     ^
mingw-declspec.c:11:12: warning: unknown attribute 'align' ignored
[-Wunknown-attributes]
__declspec(align(8))
           ^~~~~~~~
<built-in>:343:38: note: expanded from here
#define __declspec(a) __attribute__((a))
                                     ^
2 warnings 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/20210608/90102152/attachment.html>


More information about the llvm-bugs mailing list