AMDG

Douglas Gregor wrote:
On May 20, 2010, at 10:25 AM, Steven Watanabe wrote:
The attached patch deals with the fact the yvals.h
in the standard library that ships with msvc contains
typedef bool _Bool;
However, i'd really prefer to disable the _Bool keyword
in Microsoft compatibility mode.  Is there a good
way to do this?


It should be easy to do directly. Check check out include/clang/TokenKinds.def 
and its uses; the _Bool keyword could probably be tagged with some new flag 
(e.g., KEYNOMS) that enables it unless -fms-extensions is provided.

Okay.  Is this better?

In Christ,
Steven Watanabe

Index: tools/clang/include/clang/Basic/TokenKinds.def
===================================================================
--- tools/clang/include/clang/Basic/TokenKinds.def	(revision 104222)
+++ tools/clang/include/clang/Basic/TokenKinds.def	(working copy)
@@ -220,7 +220,7 @@
 KEYWORD(void                        , KEYALL)
 KEYWORD(volatile                    , KEYALL)
 KEYWORD(while                       , KEYALL)
-KEYWORD(_Bool                       , KEYALL)
+KEYWORD(_Bool                       , KEYNOMS)
 KEYWORD(_Complex                    , KEYALL)
 KEYWORD(_Imaginary                  , KEYALL)
 KEYWORD(__func__                    , KEYALL)
Index: tools/clang/lib/Basic/IdentifierTable.cpp
===================================================================
--- tools/clang/lib/Basic/IdentifierTable.cpp	(revision 104222)
+++ tools/clang/lib/Basic/IdentifierTable.cpp	(working copy)
@@ -70,7 +70,8 @@
     KEYGNU = 16,
     KEYMS = 32,
     BOOLSUPPORT = 64,
-    KEYALTIVEC = 128
+    KEYALTIVEC = 128,
+    KEYNOMS = 256
   };
 }
 
@@ -94,6 +95,7 @@
   else if (LangOpts.Microsoft && (Flags & KEYMS)) AddResult = 1;
   else if (LangOpts.Bool && (Flags & BOOLSUPPORT)) AddResult = 2;
   else if (LangOpts.AltiVec && (Flags & KEYALTIVEC)) AddResult = 2;
+  else if (!LangOpts.Microsoft && (Flags & KEYNOMS)) AddResult = 2;
 
   // Don't add this keyword if disabled in this language.
   if (AddResult == 0) return;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to