forked from OSchip/llvm-project
As per discussion with Doug Gregor on the IRC channel, introduce a new compiler switch: -fms-compatility.
Microsoft specific tweaking will now fall into 2 categories: - fms-extension: Microsoft specific extensions that should never change the meaning of an otherwise well formed code. Currently map to LangOptions::Microsoft. (To be clearer, I am planning to change the name to LangOptions::MicrosoftExt). - fms-compatibility: Really a MSVC emulation mode. Map to LangOptions::MicrosoftMode. Can change the meaning of an otherwise standard conformant program. llvm-svn: 139978
This commit is contained in:
parent
c6b316acd9
commit
1b4f1637fb
|
@ -44,6 +44,7 @@
|
|||
LANGOPT(C99 , 1, 0, "C99")
|
||||
LANGOPT(C1X , 1, 0, "C1X")
|
||||
LANGOPT(Microsoft , 1, 0, "Microsoft extensions")
|
||||
LANGOPT(MicrosoftMode , 1, 0, "Microsoft compatibility mode")
|
||||
LANGOPT(Borland , 1, 0, "Borland extensions")
|
||||
LANGOPT(CPlusPlus , 1, 0, "C++")
|
||||
LANGOPT(CPlusPlus0x , 1, 0, "C++0x")
|
||||
|
|
|
@ -472,7 +472,9 @@ def stdlib_EQ : Joined<"-stdlib=">,
|
|||
def fmath_errno : Flag<"-fmath-errno">,
|
||||
HelpText<"Require math functions to indicate errors by setting errno">;
|
||||
def fms_extensions : Flag<"-fms-extensions">,
|
||||
HelpText<"Accept some non-standard constructs used in Microsoft header files ">;
|
||||
HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">;
|
||||
def fms_compatibility : Flag<"-fms-compatibility">,
|
||||
HelpText<"Enable Microsoft compatibility mode">;
|
||||
def fmsc_version : Joined<"-fmsc-version=">,
|
||||
HelpText<"Version of the Microsoft C/C++ compiler to report in _MSC_VER (0 = don't define it (default))">;
|
||||
def fborland_extensions : Flag<"-fborland-extensions">,
|
||||
|
|
|
@ -340,6 +340,7 @@ def fmath_errno : Flag<"-fmath-errno">, Group<f_Group>;
|
|||
def fmerge_all_constants : Flag<"-fmerge-all-constants">, Group<f_Group>;
|
||||
def fmessage_length_EQ : Joined<"-fmessage-length=">, Group<f_Group>;
|
||||
def fms_extensions : Flag<"-fms-extensions">, Group<f_Group>;
|
||||
def fms_compatibility : Flag<"-fms-compatibility">, Group<f_Group>;
|
||||
def fmsc_version : Joined<"-fmsc-version=">, Group<f_Group>;
|
||||
def fdelayed_template_parsing : Flag<"-fdelayed-template-parsing">, Group<f_Group>;
|
||||
def fmodule_cache_path : Separate<"-fmodule-cache-path">, Group<i_Group>,
|
||||
|
@ -382,6 +383,7 @@ def fno_lax_vector_conversions : Flag<"-fno-lax-vector-conversions">, Group<f_Gr
|
|||
def fno_math_errno : Flag<"-fno-math-errno">, Group<f_Group>;
|
||||
def fno_merge_all_constants : Flag<"-fno-merge-all-constants">, Group<f_Group>;
|
||||
def fno_ms_extensions : Flag<"-fno-ms-extensions">, Group<f_Group>;
|
||||
def fno_ms_compatibility : Flag<"-fno-ms-compatibility">, Group<f_Group>;
|
||||
def fno_delayed_template_parsing : Flag<"-fno-delayed-template-parsing">, Group<f_Group>;
|
||||
def fno_objc_default_synthesize_properties
|
||||
: Flag<"-fno-objc-default-synthesize-properties">, Group<f_Group>;
|
||||
|
|
|
@ -1785,6 +1785,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
getToolChain().getTriple().getOS() == llvm::Triple::Win32))
|
||||
CmdArgs.push_back("-fms-extensions");
|
||||
|
||||
// -fms-compatibility=0 is default.
|
||||
if (Args.hasFlag(options::OPT_fms_compatibility, options::OPT_fno_ms_compatibility,
|
||||
getToolChain().getTriple().getOS() == llvm::Triple::Win32))
|
||||
CmdArgs.push_back("-fms-compatibility");
|
||||
|
||||
// -fmsc-version=1300 is default.
|
||||
if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
|
||||
getToolChain().getTriple().getOS() == llvm::Triple::Win32) ||
|
||||
|
|
|
@ -1655,6 +1655,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||
Opts.DollarIdents);
|
||||
Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
|
||||
Opts.Microsoft = Args.hasArg(OPT_fms_extensions);
|
||||
Opts.MicrosoftMode = Args.hasArg(OPT_fms_compatibility);
|
||||
Opts.MSCVersion = Args.getLastArgIntValue(OPT_fmsc_version, 0, Diags);
|
||||
Opts.Borland = Args.hasArg(OPT_fborland_extensions);
|
||||
Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
|
||||
|
|
Loading…
Reference in New Issue