<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - __has_declspec_attribute falsely reports some attrs as supported for MinGW and Cygwin targets"
   href="https://bugs.llvm.org/show_bug.cgi?id=50614">50614</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__has_declspec_attribute falsely reports some attrs as supported for MinGW and Cygwin targets
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>xtkoba@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24923" name="attach_24923" title="Repro">attachment 24923</a> <a href="attachment.cgi?id=24923&action=edit" title="Repro">[details]</a></span>
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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>