Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-03-21 Thread Reid Kleckner via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL263947: clang-cl: support __cdecl-on-struct anachronism 
(authored by rnk).

Changed prior to commit:
  http://reviews.llvm.org/D16628?vs=46228=51176#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16628

Files:
  cfe/trunk/lib/Parse/ParseDeclCXX.cpp
  cfe/trunk/test/Parser/ms-anachronism.c

Index: cfe/trunk/test/Parser/ms-anachronism.c
===
--- cfe/trunk/test/Parser/ms-anachronism.c
+++ cfe/trunk/test/Parser/ms-anachronism.c
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -fsyntax-only 
-verify %s
+
+struct {} __cdecl s; // expected-warning {{'__cdecl' only applies to function 
types; type here is 'struct}}
Index: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
===
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp
@@ -1103,6 +1103,15 @@
 return true;
   case tok::colon:
 return CouldBeBitfield; // enum E { ... }   : 2;
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl  x;
+  case tok::kw___fastcall:  // struct foo {...} __fastcall   x;
+  case tok::kw___stdcall:   // struct foo {...} __stdcallx;
+  case tok::kw___thiscall:  // struct foo {...} __thiscall   x;
+  case tok::kw___vectorcall:// struct foo {...} __vectorcall x;
+// We will diagnose these calling-convention specifiers on non-function
+// declarations later, so claim they are valid after a type specifier.
+return getLangOpts().MicrosoftExt;
   // Type qualifiers
   case tok::kw_const:   // struct foo {...} const x;
   case tok::kw_volatile:// struct foo {...} volatile  x;


Index: cfe/trunk/test/Parser/ms-anachronism.c
===
--- cfe/trunk/test/Parser/ms-anachronism.c
+++ cfe/trunk/test/Parser/ms-anachronism.c
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -fsyntax-only -verify %s
+
+struct {} __cdecl s; // expected-warning {{'__cdecl' only applies to function types; type here is 'struct}}
Index: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
===
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp
@@ -1103,6 +1103,15 @@
 return true;
   case tok::colon:
 return CouldBeBitfield; // enum E { ... }   : 2;
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl  x;
+  case tok::kw___fastcall:  // struct foo {...} __fastcall   x;
+  case tok::kw___stdcall:   // struct foo {...} __stdcallx;
+  case tok::kw___thiscall:  // struct foo {...} __thiscall   x;
+  case tok::kw___vectorcall:// struct foo {...} __vectorcall x;
+// We will diagnose these calling-convention specifiers on non-function
+// declarations later, so claim they are valid after a type specifier.
+return getLangOpts().MicrosoftExt;
   // Type qualifiers
   case tok::kw_const:   // struct foo {...} const x;
   case tok::kw_volatile:// struct foo {...} volatile  x;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-03-21 Thread Stephan Bergmann via cfe-commits
sberg added a comment.

friendly ping


http://reviews.llvm.org/D16628



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-03-03 Thread Stephan Bergmann via cfe-commits
sberg added a comment.

Can you please push this, I do not have commit access.  Thanks


http://reviews.llvm.org/D16628



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-03-02 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

Thanks, lgtm.


http://reviews.llvm.org/D16628



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-03-02 Thread Stephan Bergmann via cfe-commits
sberg added a comment.

friendly ping


http://reviews.llvm.org/D16628



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-01-27 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


Comment at: lib/Parse/ParseDeclCXX.cpp:1108-1110
@@ -1106,1 +1107,5 @@
+  case tok::kw___cdecl: // struct foo {...} __cdecl   x; // C4229
+if (!getLangOpts().MicrosoftExt)
+  break;
+// fall through
   // Type qualifiers

I think this would be clearer as:
  // We will diagnose __cdecl on non-function declarations later, so claim that 
is valid
  // after a type specifier.
  return getLangOpts().MicrosoftExt;
Unpacking what the fallthrough does is a little tricky.


http://reviews.llvm.org/D16628



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-01-27 Thread Stephan Bergmann via cfe-commits
sberg updated this revision to Diff 46228.
sberg added a comment.

updated as discussed in the comments


http://reviews.llvm.org/D16628

Files:
  lib/Parse/ParseDeclCXX.cpp
  test/Parser/ms-anachronism.c

Index: test/Parser/ms-anachronism.c
===
--- /dev/null
+++ test/Parser/ms-anachronism.c
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -fsyntax-only 
-verify %s
+
+struct {} __cdecl s; // expected-warning {{'__cdecl' only applies to function 
types; type here is 'struct}}
Index: lib/Parse/ParseDeclCXX.cpp
===
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -1103,6 +1103,15 @@
 return true;
   case tok::colon:
 return CouldBeBitfield; // enum E { ... }   : 2;
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl  x;
+  case tok::kw___fastcall:  // struct foo {...} __fastcall   x;
+  case tok::kw___stdcall:   // struct foo {...} __stdcallx;
+  case tok::kw___thiscall:  // struct foo {...} __thiscall   x;
+  case tok::kw___vectorcall:// struct foo {...} __vectorcall x;
+// We will diagnose these calling-convention specifiers on non-function
+// declarations later, so claim they are valid after a type specifier.
+return getLangOpts().MicrosoftExt;
   // Type qualifiers
   case tok::kw_const:   // struct foo {...} const x;
   case tok::kw_volatile:// struct foo {...} volatile  x;


Index: test/Parser/ms-anachronism.c
===
--- /dev/null
+++ test/Parser/ms-anachronism.c
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -fsyntax-only -verify %s
+
+struct {} __cdecl s; // expected-warning {{'__cdecl' only applies to function types; type here is 'struct}}
Index: lib/Parse/ParseDeclCXX.cpp
===
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -1103,6 +1103,15 @@
 return true;
   case tok::colon:
 return CouldBeBitfield; // enum E { ... }   : 2;
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl  x;
+  case tok::kw___fastcall:  // struct foo {...} __fastcall   x;
+  case tok::kw___stdcall:   // struct foo {...} __stdcallx;
+  case tok::kw___thiscall:  // struct foo {...} __thiscall   x;
+  case tok::kw___vectorcall:// struct foo {...} __vectorcall x;
+// We will diagnose these calling-convention specifiers on non-function
+// declarations later, so claim they are valid after a type specifier.
+return getLangOpts().MicrosoftExt;
   // Type qualifiers
   case tok::kw_const:   // struct foo {...} const x;
   case tok::kw_volatile:// struct foo {...} volatile  x;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-01-27 Thread David Majnemer via cfe-commits
majnemer added a subscriber: majnemer.


Comment at: lib/Parse/ParseDeclCXX.cpp:1107
@@ +1106,3 @@
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl   x; // C4229
+if (!getLangOpts().MicrosoftExt)

What about __fastcall, etc.


http://reviews.llvm.org/D16628



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-01-27 Thread Stephan Bergmann via cfe-commits
sberg added inline comments.


Comment at: lib/Parse/ParseDeclCXX.cpp:1107
@@ +1106,3 @@
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl   x; // C4229
+if (!getLangOpts().MicrosoftExt)

majnemer wrote:
> What about __fastcall, etc.
To be honest, I have no idea what the full set of keywords is that would need 
to be taken care of here (so hoped I would get away with just the one I 
happened to come across ;)


http://reviews.llvm.org/D16628



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-01-27 Thread David Majnemer via cfe-commits
majnemer added inline comments.


Comment at: lib/Parse/ParseDeclCXX.cpp:1107
@@ +1106,3 @@
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl   x; // C4229
+if (!getLangOpts().MicrosoftExt)

sberg wrote:
> majnemer wrote:
> > What about __fastcall, etc.
> To be honest, I have no idea what the full set of keywords is that would need 
> to be taken care of here (so hoped I would get away with just the one I 
> happened to come across ;)
The complete list is 
https://msdn.microsoft.com/en-us/library/984x0h58.aspx#mainBody


http://reviews.llvm.org/D16628



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-01-27 Thread Stephan Bergmann via cfe-commits
sberg created this revision.
sberg added a reviewer: rnk.
sberg added a subscriber: cfe-commits.

The Microsoft compiler emits

  warning C4229: anachronism used : modifiers on data are ignored

for

  struct {} __cdecl s;

but ICU's gendict can generate such (and does when building LibreOffice), so 
accepting this in clang-cl too would be useful.

http://reviews.llvm.org/D16628

Files:
  lib/Parse/ParseDeclCXX.cpp
  test/Parser/ms-anachronism.c

Index: test/Parser/ms-anachronism.c
===
--- /dev/null
+++ test/Parser/ms-anachronism.c
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -fsyntax-only 
-verify %s
+
+struct {} __cdecl s; // expected-warning {{'__cdecl' only applies to function 
types; type here is 'struct}}
Index: lib/Parse/ParseDeclCXX.cpp
===
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -1103,6 +1103,11 @@
 return true;
   case tok::colon:
 return CouldBeBitfield; // enum E { ... }   : 2;
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl   x; // C4229
+if (!getLangOpts().MicrosoftExt)
+  break;
+// fall through
   // Type qualifiers
   case tok::kw_const:   // struct foo {...} const x;
   case tok::kw_volatile:// struct foo {...} volatile  x;


Index: test/Parser/ms-anachronism.c
===
--- /dev/null
+++ test/Parser/ms-anachronism.c
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -fsyntax-only -verify %s
+
+struct {} __cdecl s; // expected-warning {{'__cdecl' only applies to function types; type here is 'struct}}
Index: lib/Parse/ParseDeclCXX.cpp
===
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -1103,6 +1103,11 @@
 return true;
   case tok::colon:
 return CouldBeBitfield; // enum E { ... }   : 2;
+  // Microsoft compatibility
+  case tok::kw___cdecl: // struct foo {...} __cdecl   x; // C4229
+if (!getLangOpts().MicrosoftExt)
+  break;
+// fall through
   // Type qualifiers
   case tok::kw_const:   // struct foo {...} const x;
   case tok::kw_volatile:// struct foo {...} volatile  x;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits