r184968 - Match MSVC's handling of commas during macro argument expansion

Reid Kleckner rnk at google.com
Wed Jun 26 10:42:46 PDT 2013


Nico got it in r184972.


On Wed, Jun 26, 2013 at 1:34 PM, Dmitri Gribenko <gribozavr at gmail.com>wrote:

> On Wed, Jun 26, 2013 at 10:16 AM, Reid Kleckner <reid at kleckner.net> wrote:
> > Author: rnk
> > Date: Wed Jun 26 12:16:08 2013
> > New Revision: 184968
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=184968&view=rev
> > Log:
> > Match MSVC's handling of commas during macro argument expansion
> >
> > This allows clang to parse the type_traits header in Visual Studio 2012,
> > which is included widely in practice.
> >
> > This is a rework of r163022 by João Matos.  The original patch broke
> > preprocessing of gtest headers, which this patch addresses.
> >
> > Patch by Will Wilson!
> >
> > Modified:
> >     cfe/trunk/include/clang/Lex/Token.h
> >     cfe/trunk/lib/Lex/PPMacroExpansion.cpp
> >     cfe/trunk/lib/Lex/TokenLexer.cpp
> >     cfe/trunk/test/Preprocessor/microsoft-ext.c
> >
> > Modified: cfe/trunk/include/clang/Lex/Token.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Token.h?rev=184968&r1=184967&r2=184968&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/include/clang/Lex/Token.h (original)
> > +++ cfe/trunk/include/clang/Lex/Token.h Wed Jun 26 12:16:08 2013
> > @@ -77,7 +77,8 @@ public:
> >      NeedsCleaning = 0x08,  // Contained an escaped newline or trigraph.
> >      LeadingEmptyMacro = 0x10, // Empty macro exists before this token.
> >      HasUDSuffix = 0x20,    // This string or character literal has a
> ud-suffix.
> > -    HasUCN = 0x40          // This identifier contains a UCN.
> > +    HasUCN = 0x40,         // This identifier contains a UCN.
> > +    IgnoredComma = 0x80,   // This comma is not a macro argument
> separator (MS).
>
> Hi Reid,
>
> Clang complains:
>
> warning: commas at the end of enumerator lists are a C++11 extension
> [-Wc++11-extensions]
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130626/00edb14f/attachment.html>


More information about the cfe-commits mailing list