Is there a list of extensions you want to support? Could the go standard library not use plan9 extensions, if it's interested in being compiled with more than 1 compiler?
On Tue, May 20, 2014 at 1:59 PM, Peter Collingbourne <[email protected]>wrote: > This makes a start on implementing a number of extensions provided by the > Plan > 9 C compiler, from which Go's "cc" C compiler is derived. These extensions > are required for building some parts of the Go standard library. > > This patch introduces the -fplan9-extensions flag and causes it to enable > an extension which allows typedefs to be declared multiple times. > > http://reviews.llvm.org/D3853 > > Files: > include/clang/Basic/LangOptions.def > include/clang/Driver/Options.td > lib/Driver/Tools.cpp > lib/Frontend/CompilerInvocation.cpp > lib/Sema/SemaDecl.cpp > test/Sema/c11-typedef-redef.c > > Index: include/clang/Basic/LangOptions.def > =================================================================== > --- include/clang/Basic/LangOptions.def > +++ include/clang/Basic/LangOptions.def > @@ -47,6 +47,7 @@ > LANGOPT(MicrosoftExt , 1, 0, "Microsoft C++ extensions") > LANGOPT(AsmBlocks , 1, 0, "Microsoft inline asm blocks") > LANGOPT(Borland , 1, 0, "Borland extensions") > +LANGOPT(Plan9Ext , 1, 0, "Plan 9 extensions") > LANGOPT(CPlusPlus , 1, 0, "C++") > LANGOPT(CPlusPlus11 , 1, 0, "C++11") > LANGOPT(CPlusPlus1y , 1, 0, "C++1y") > Index: include/clang/Driver/Options.td > =================================================================== > --- include/clang/Driver/Options.td > +++ include/clang/Driver/Options.td > @@ -775,6 +775,8 @@ > def fno_pic : Flag<["-"], "fno-pic">, Group<f_Group>; > def fpie : Flag<["-"], "fpie">, Group<f_Group>; > def fno_pie : Flag<["-"], "fno-pie">, Group<f_Group>; > +def fplan9_extensions : Flag<["-"], "fplan9-extensions">, Group<f_Group>, > Flags<[CC1Option]>; > +def fno_plan9_extensions : Flag<["-"], "fno-plan9-extensions">, > Group<f_Group>; > def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group<f_Group>; > def fprofile_generate : Flag<["-"], "fprofile-generate">, Group<f_Group>; > def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>; > Index: lib/Driver/Tools.cpp > =================================================================== > --- lib/Driver/Tools.cpp > +++ lib/Driver/Tools.cpp > @@ -3678,6 +3678,11 @@ > options::OPT_fno_borland_extensions, false)) > CmdArgs.push_back("-fborland-extensions"); > > + // -fno-plan9-extensions is default. > + if (Args.hasFlag(options::OPT_fplan9_extensions, > + options::OPT_fno_plan9_extensions, false)) > + CmdArgs.push_back("-fplan9-extensions"); > + > // -fno-delayed-template-parsing is default, except for Windows where > MSVC STL > // needs it. > if (Args.hasFlag(options::OPT_fdelayed_template_parsing, > Index: lib/Frontend/CompilerInvocation.cpp > =================================================================== > --- lib/Frontend/CompilerInvocation.cpp > +++ lib/Frontend/CompilerInvocation.cpp > @@ -1351,6 +1351,7 @@ > Opts.MSCVersion = getLastArgIntValue(Args, OPT_fmsc_version, 0, Diags); > Opts.VtorDispMode = getLastArgIntValue(Args, OPT_vtordisp_mode_EQ, 1, > Diags); > Opts.Borland = Args.hasArg(OPT_fborland_extensions); > + Opts.Plan9Ext = Args.hasArg(OPT_fplan9_extensions); > Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings); > Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, > OPT_fno_const_strings, > Opts.ConstStrings); > Index: lib/Sema/SemaDecl.cpp > =================================================================== > --- lib/Sema/SemaDecl.cpp > +++ lib/Sema/SemaDecl.cpp > @@ -1769,8 +1769,8 @@ > return New->setInvalidDecl(); > } > > - // Modules always permit redefinition of typedefs, as does C11. > - if (getLangOpts().Modules || getLangOpts().C11) > + // Modules always permit redefinition of typedefs, as does C11 and Plan > 9. > + if (getLangOpts().Modules || getLangOpts().C11 || > getLangOpts().Plan9Ext) > return; > > // If we have a redefinition of a typedef in C, emit a warning. This > warning > Index: test/Sema/c11-typedef-redef.c > =================================================================== > --- test/Sema/c11-typedef-redef.c > +++ test/Sema/c11-typedef-redef.c > @@ -1,4 +1,5 @@ > // RUN: %clang_cc1 -std=c11 %s -verify > +// RUN: %clang_cc1 -fplan9-extensions %s -verify > > typedef int type; > typedef type type; > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
