Driver: Add -std-default= option.

- This can be used to supply a default value for -std=; the idea is
   that this can be used in conjunction with CCC_ADD_ARGS or
   QA_OVERRIDE_GCC3_OPTIONS to change the default without having to
   modify the build system.

llvm-svn: 70102
This commit is contained in:
Daniel Dunbar 2009-04-26 01:10:38 +00:00
parent 3ba94d8778
commit 72a6090dc4
2 changed files with 19 additions and 1 deletions

View File

@ -354,6 +354,7 @@ OPTION("-fasm-blocks", fasm_blocks, Flag, clang_ignored_f_Group, INVALID, "", 0,
OPTION("-fastcp", fastcp, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fastf", fastf, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fast", fast, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fasynchronous-unwind-tables", fasynchronous_unwind_tables, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fblocks", fblocks, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fbootclasspath=", fbootclasspath_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fbuiltin", fbuiltin, Flag, f_Group, INVALID, "", 0, 0, 0)
@ -392,6 +393,7 @@ OPTION("-fmudflapth", fmudflapth, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fmudflap", fmudflap, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fnested-functions", fnested_functions, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fnext-runtime", fnext_runtime, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-asynchronous-unwind-tables", fno_asynchronous_unwind_tables, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-blocks", fno_blocks, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-builtin", fno_builtin, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-caret-diagnostics", fno_caret_diagnostics, Flag, f_Group, INVALID, "", 0, 0, 0)
@ -581,6 +583,7 @@ OPTION("-specs=", specs_EQ, Joined, INVALID, INVALID, "", 0, 0, 0)
OPTION("-specs", specs, Separate, INVALID, INVALID, "u", 0, 0, 0)
OPTION("-static-libgcc", static_libgcc, Flag, INVALID, INVALID, "", 0, 0, 0)
OPTION("-static", static, Flag, INVALID, INVALID, "q", 0, 0, 0)
OPTION("-std-default=", std_default_EQ, Joined, INVALID, INVALID, "", 0, 0, 0)
OPTION("-std=", std_EQ, Joined, INVALID, INVALID, "", 0, 0, 0)
OPTION("-sub_library", sub__library, JoinedOrSeparate, INVALID, INVALID, "", 0, 0, 0)
OPTION("-sub_umbrella", sub__umbrella, JoinedOrSeparate, INVALID, INVALID, "", 0, 0, 0)

View File

@ -438,8 +438,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_trigraphs))
if (A->getIndex() > Std->getIndex())
A->render(Args, CmdArgs);
} else
} else {
// Honor -std-default.
Args.AddAllArgsTranslated(CmdArgs, options::OPT_std_default_EQ,
"-std=", /*Joined=*/true);
Args.AddLastArg(CmdArgs, options::OPT_trigraphs);
}
if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_)) {
CmdArgs.push_back("-ftemplate-depth");
@ -825,6 +829,12 @@ void darwin::CC1::AddCC1OptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
Args.AddLastArg(CmdArgs, options::OPT_w);
Args.AddAllArgs(CmdArgs, options::OPT_std_EQ, options::OPT_ansi,
options::OPT_trigraphs);
if (!Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi)) {
// Honor -std-default.
Args.AddAllArgsTranslated(CmdArgs, options::OPT_std_default_EQ,
"-std=", /*Joined=*/true);
}
if (Args.hasArg(options::OPT_v))
CmdArgs.push_back("-version");
if (Args.hasArg(options::OPT_pg))
@ -880,6 +890,11 @@ void darwin::CC1::AddCPPOptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
Args.AddAllArgs(CmdArgs, options::OPT_m_Group);
Args.AddAllArgs(CmdArgs, options::OPT_std_EQ, options::OPT_ansi,
options::OPT_trigraphs);
if (!Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi)) {
// Honor -std-default.
Args.AddAllArgsTranslated(CmdArgs, options::OPT_std_default_EQ,
"-std=", /*Joined=*/true);
}
Args.AddAllArgs(CmdArgs, options::OPT_W_Group, options::OPT_pedantic_Group);
Args.AddLastArg(CmdArgs, options::OPT_w);