[PATCH] Only provide MS builtins when -fms-extensions is on

Reid Kleckner rnk at google.com
Mon Nov 11 16:31:29 PST 2013


  We don't support __declspec or __stdcall without -fms-extensions, so it seemed consistent to not parse MS builtins.

  However, the real reason I sent this out now is because I want to add _alloca (http://llvm-reviews.chandlerc.com/D1989).  If you lack a declaration for malloc, we'll suggest a typo correction to _alloca, which is definitely not what you wanted.  I could abandon this and maybe avoid typo corrections a different way.


================
Comment at: include/clang/Basic/Builtins.def:674
@@ +673,3 @@
+// Microsoft builtins.  These are only active with -fms-extensions.
+// They are not library builtins despire our use of LIBBUILTIN.
+LIBBUILTIN(__assume,     "vb",  "n", 0, ALL_MS_LANGUAGES)
----------------
Richard Smith wrote:
> This isn't particularly great. Can you find a cleaner approach? Maybe:
> 
>   #ifndef RESTRICTED_BUILTIN
>   #define RESTRICTED_BUILTIN(a, b, c, d) BUILTIN(a, b, c)
>   #endif
> 
> ... and then explicitly handle this in the one place where we care (in Builtins.cpp)? (Better macro name welcome!)
Sure.  LANG_BUILTIN(), since its a builtin plus a language restriction?


http://llvm-reviews.chandlerc.com/D2128



More information about the cfe-commits mailing list