On Mon, Aug 07, 2017 at 02:17:17PM +0100, Pedro Alves wrote: > I happened to skim this patch and notice a couple issues. > See below.
Note I've just posted updated patch based on this to gcc-patches. > > +/* Set the C++ 202a draft standard (without GNU extensions if ISO). */ > > +static void > > +set_std_cxx2a (int iso) > > +{ > > + cpp_set_lang (parse_in, iso ? CLK_CXX2A: CLK_GNUCXX2A); > > + flag_no_gnu_keywords = iso; > > + flag_no_nonansi_builtin = iso; > > + flag_iso = iso; > > + /* C++1z includes the C99 standard library. */ > > + flag_isoc94 = 1; > > + flag_isoc99 = 1; > > + flag_isoc11 = 1; > > + cxx_dialect = cxx2a; > > + lang_hooks.name = "GNU C++17"; /* Pretend C++17 until standardization. > > */ > > Did you mean to write C++20 here? No, that matches what we did with C++1z until the patch I've just posted. > > --- a/libcpp/include/cpplib.h > > +++ b/libcpp/include/cpplib.h > > @@ -171,7 +171,8 @@ enum cpp_ttype > > enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, > > CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11, > > CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, > > - CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX1Z, CLK_CXX1Z, CLK_ASM}; > > + CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX1Z, CLK_CXX1Z, > > + CLK_GNUCXX2A, CLK_CXX2A, CLK_ASM}; > > Tabs vs spaces? Fixed. > > > @@ -497,7 +499,10 @@ cpp_init_builtins (cpp_reader *pfile, int hosted) > > > > if (CPP_OPTION (pfile, cplusplus)) > > { > > - if (CPP_OPTION (pfile, lang) == CLK_CXX1Z > > + if (CPP_OPTION (pfile, lang) == CLK_CXX2A > > + || CPP_OPTION (pfile, lang) == CLK_GNUCXX2A) > > + _cpp_define_builtin (pfile, "__cplusplus 201707L"); > > I think you wanted 202007L here. The documentation states some unspecified value strictly greater than 201703L. In the patch I've posted it is 201709L, because that is this month, 202007L would be just a wild guess. People aren't supposed to rely on a particular value until C++2z is finalized, so just use (__cplusplus > 201703L) for features beyond C++17. Jakub