It's cool we finally have a flag for this, but overloading its meaning with the =0 behavior seems a bit strange to me. Maybe we should have a separate -fno-gnu-extensions for that part instead?
On Thu, Oct 10, 2019 at 5:02 PM Reid Kleckner via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rnk > Date: Thu Oct 10 14:04:25 2019 > New Revision: 374449 > > URL: http://llvm.org/viewvc/llvm-project?rev=374449&view=rev > Log: > Add -fgnuc-version= to control __GNUC__ and other GCC macros > > I noticed that compiling on Windows with -fno-ms-compatibility had the > side effect of defining __GNUC__, along with __GNUG__, __GXX_RTTI__, and > a number of other macros for GCC compatibility. This is undesirable and > causes Chromium to do things like mix __attribute__ and __declspec, > which doesn't work. We should have a positive language option to enable > GCC compatibility features so that we can experiment with > -fno-ms-compatibility on Windows. This change adds -fgnuc-version= to be > that option. > > My issue aside, users have, for a long time, reported that __GNUC__ > doesn't match their expectations in one way or another. We have > encouraged users to migrate code away from this macro, but new code > continues to be written assuming a GCC-only environment. There's really > nothing we can do to stop that. By adding this flag, we can allow them > to choose their own adventure with __GNUC__. > > This overlaps a bit with the "GNUMode" language option from -std=gnu*. > The gnu language mode tends to enable non-conforming behaviors that we'd > rather not enable by default, but the we want to set things like > __GXX_RTTI__ by default, so I've kept these separate. > > Helps address PR42817 > > Reviewed By: hans, nickdesaulniers, MaskRay > > Differential Revision: https://reviews.llvm.org/D68055 > > Added: > cfe/trunk/test/Driver/fgnuc-version.c > Modified: > cfe/trunk/docs/ReleaseNotes.rst > cfe/trunk/docs/UsersManual.rst > cfe/trunk/include/clang/Basic/LangOptions.def > cfe/trunk/include/clang/Driver/Options.td > cfe/trunk/lib/Driver/ToolChains/Clang.cpp > cfe/trunk/lib/Frontend/CompilerInvocation.cpp > cfe/trunk/lib/Frontend/InitPreprocessor.cpp > cfe/trunk/test/Driver/rewrite-legacy-objc.m > cfe/trunk/test/Driver/rewrite-objc.m > cfe/trunk/test/Frontend/gnu-inline.c > cfe/trunk/test/Headers/stdbool.cpp > cfe/trunk/test/Preprocessor/init.c > cfe/trunk/test/Sema/atomic-ops.c > > Modified: cfe/trunk/docs/ReleaseNotes.rst > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/docs/ReleaseNotes.rst (original) > +++ cfe/trunk/docs/ReleaseNotes.rst Thu Oct 10 14:04:25 2019 > @@ -80,7 +80,10 @@ Non-comprehensive list of changes in thi > New Compiler Flags > ------------------ > > -- ... > +- The -fgnuc-version= flag now controls the value of ``__GNUC__`` and > related > + macros. This flag does not enable or disable any GCC extensions > implemented in > + Clang. Setting the version to zero causes Clang to leave ``__GNUC__`` > and > + other GNU-namespaced macros, such as ``__GXX_WEAK__``, undefined. > > Deprecated Compiler Flags > ------------------------- > > Modified: cfe/trunk/docs/UsersManual.rst > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/docs/UsersManual.rst (original) > +++ cfe/trunk/docs/UsersManual.rst Thu Oct 10 14:04:25 2019 > @@ -701,6 +701,13 @@ Other Options > ------------- > Clang options that don't fit neatly into other categories. > > +.. option:: -fgnuc-version= > + > + This flag controls the value of ``__GNUC__`` and related macros. This > flag > + does not enable or disable any GCC extensions implemented in Clang. > Setting > + the version to zero causes Clang to leave ``__GNUC__`` and other > + GNU-namespaced macros, such as ``__GXX_WEAK__``, undefined. > + > .. option:: -MV > > When emitting a dependency file, use formatting conventions appropriate > > Modified: cfe/trunk/include/clang/Basic/LangOptions.def > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/Basic/LangOptions.def (original) > +++ cfe/trunk/include/clang/Basic/LangOptions.def Thu Oct 10 14:04:25 2019 > @@ -111,6 +111,7 @@ BENIGN_LANGOPT(DollarIdents , 1, 1, "' > BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode") > LANGOPT(GNUMode , 1, 1, "GNU extensions") > LANGOPT(GNUKeywords , 1, 1, "GNU keywords") > +VALUE_LANGOPT(GNUCVersion , 32, 0, "GNU C compatibility version") > BENIGN_LANGOPT(ImplicitInt, 1, !C99 && !CPlusPlus, "C89 implicit 'int'") > LANGOPT(Digraphs , 1, 0, "digraphs") > BENIGN_LANGOPT(HexFloats , 1, C99, "C99 hexadecimal float constants") > > Modified: cfe/trunk/include/clang/Driver/Options.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/Driver/Options.td (original) > +++ cfe/trunk/include/clang/Driver/Options.td Thu Oct 10 14:04:25 2019 > @@ -1187,6 +1187,9 @@ def fno_use_line_directives : Flag<["-"] > > def ffreestanding : Flag<["-"], "ffreestanding">, Group<f_Group>, > Flags<[CC1Option]>, > HelpText<"Assert that the compilation takes place in a freestanding > environment">; > +def fgnuc_version_EQ : Joined<["-"], "fgnuc-version=">, Group<f_Group>, > + HelpText<"Sets various macros to claim compatibility with the given GCC > version (default is 4.2.1)">, > + Flags<[CC1Option, CoreOption]>; > def fgnu_keywords : Flag<["-"], "fgnu-keywords">, Group<f_Group>, > Flags<[CC1Option]>, > HelpText<"Allow GNU-extension keywords regardless of language > standard">; > def fgnu89_inline : Flag<["-"], "fgnu89-inline">, Group<f_Group>, > Flags<[CC1Option]>, > > Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) > +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Oct 10 14:04:25 2019 > @@ -4875,13 +4875,36 @@ void Clang::ConstructJob(Compilation &C, > CmdArgs.push_back("-fuse-line-directives"); > > // -fms-compatibility=0 is default. > - if (Args.hasFlag(options::OPT_fms_compatibility, > - options::OPT_fno_ms_compatibility, > - (IsWindowsMSVC && > - Args.hasFlag(options::OPT_fms_extensions, > - options::OPT_fno_ms_extensions, true)))) > + bool IsMSVCCompat = Args.hasFlag( > + options::OPT_fms_compatibility, options::OPT_fno_ms_compatibility, > + (IsWindowsMSVC && Args.hasFlag(options::OPT_fms_extensions, > + options::OPT_fno_ms_extensions, > true))); > + if (IsMSVCCompat) > CmdArgs.push_back("-fms-compatibility"); > > + // Handle -fgcc-version, if present. > + VersionTuple GNUCVer; > + if (Arg *A = Args.getLastArg(options::OPT_fgnuc_version_EQ)) { > + // Check that the version has 1 to 3 components and the minor and > patch > + // versions fit in two decimal digits. > + StringRef Val = A->getValue(); > + Val = Val.empty() ? "0" : Val; // Treat "" as 0 or disable. > + bool Invalid = GNUCVer.tryParse(Val); > + unsigned Minor = GNUCVer.getMinor().getValueOr(0); > + unsigned Patch = GNUCVer.getSubminor().getValueOr(0); > + if (Invalid || GNUCVer.getBuild() || Minor >= 100 || Patch >= 100) { > + D.Diag(diag::err_drv_invalid_value) > + << A->getAsString(Args) << A->getValue(); > + } > + } else if (!IsMSVCCompat) { > + // Imitate GCC 4.2.1 by default if -fms-compatibility is not in > effect. > + GNUCVer = VersionTuple(4, 2, 1); > + } > + if (!GNUCVer.empty()) { > + CmdArgs.push_back( > + Args.MakeArgString("-fgnuc-version=" + GNUCVer.getAsString())); > + } > + > VersionTuple MSVT = TC.computeMSVCVersion(&D, Args); > if (!MSVT.empty()) > CmdArgs.push_back( > > Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) > +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Oct 10 14:04:25 2019 > @@ -2250,6 +2250,7 @@ void CompilerInvocation::setLangDefaults > Opts.Digraphs = Std.hasDigraphs(); > Opts.GNUMode = Std.isGNUMode(); > Opts.GNUInline = !Opts.C99 && !Opts.CPlusPlus; > + Opts.GNUCVersion = 0; > Opts.HexFloats = Std.hasHexFloats(); > Opts.ImplicitInt = Std.hasImplicitInt(); > > @@ -2574,6 +2575,21 @@ static void ParseLangArgs(LangOptions &O > (Opts.ObjCRuntime.getKind() == ObjCRuntime::FragileMacOSX); > } > > + if (Arg *A = Args.getLastArg(options::OPT_fgnuc_version_EQ)) { > + // Check that the version has 1 to 3 components and the minor and > patch > + // versions fit in two decimal digits. > + VersionTuple GNUCVer; > + bool Invalid = GNUCVer.tryParse(A->getValue()); > + unsigned Major = GNUCVer.getMajor(); > + unsigned Minor = GNUCVer.getMinor().getValueOr(0); > + unsigned Patch = GNUCVer.getSubminor().getValueOr(0); > + if (Invalid || GNUCVer.getBuild() || Minor >= 100 || Patch >= 100) { > + Diags.Report(diag::err_drv_invalid_value) > + << A->getAsString(Args) << A->getValue(); > + } > + Opts.GNUCVersion = Major * 100 * 100 + Minor * 100 + Patch; > + } > + > if (Args.hasArg(OPT_fgnu89_inline)) { > if (Opts.CPlusPlus) > Diags.Report(diag::err_drv_argument_not_allowed_with) > > Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original) > +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Thu Oct 10 14:04:25 2019 > @@ -574,13 +574,22 @@ static void InitializePredefinedMacros(c > Builder.defineMacro("__clang_version__", > "\"" CLANG_VERSION_STRING " " > + getClangFullRepositoryVersion() + "\""); > - if (!LangOpts.MSVCCompat) { > - // Currently claim to be compatible with GCC 4.2.1-5621, but only if > we're > - // not compiling for MSVC compatibility > - Builder.defineMacro("__GNUC_MINOR__", "2"); > - Builder.defineMacro("__GNUC_PATCHLEVEL__", "1"); > - Builder.defineMacro("__GNUC__", "4"); > + > + if (LangOpts.GNUCVersion != 0) { > + // Major, minor, patch, are given two decimal places each, so 4.2.1 > becomes > + // 40201. > + unsigned GNUCMajor = LangOpts.GNUCVersion / 100 / 100; > + unsigned GNUCMinor = LangOpts.GNUCVersion / 100 % 100; > + unsigned GNUCPatch = LangOpts.GNUCVersion % 100; > + Builder.defineMacro("__GNUC__", Twine(GNUCMajor)); > + Builder.defineMacro("__GNUC_MINOR__", Twine(GNUCMinor)); > + Builder.defineMacro("__GNUC_PATCHLEVEL__", Twine(GNUCPatch)); > Builder.defineMacro("__GXX_ABI_VERSION", "1002"); > + > + if (LangOpts.CPlusPlus) { > + Builder.defineMacro("__GNUG__", Twine(GNUCMajor)); > + Builder.defineMacro("__GXX_WEAK__"); > + } > } > > // Define macros for the C11 / C++11 memory orderings > @@ -619,7 +628,7 @@ static void InitializePredefinedMacros(c > if (!LangOpts.GNUMode && !LangOpts.MSVCCompat) > Builder.defineMacro("__STRICT_ANSI__"); > > - if (!LangOpts.MSVCCompat && LangOpts.CPlusPlus11) > + if (LangOpts.GNUCVersion && LangOpts.CPlusPlus11) > Builder.defineMacro("__GXX_EXPERIMENTAL_CXX0X__"); > > if (LangOpts.ObjC) { > @@ -699,7 +708,7 @@ static void InitializePredefinedMacros(c > > if (!LangOpts.MSVCCompat && LangOpts.Exceptions) > Builder.defineMacro("__EXCEPTIONS"); > - if (!LangOpts.MSVCCompat && LangOpts.RTTI) > + if (LangOpts.GNUCVersion && LangOpts.RTTI) > Builder.defineMacro("__GXX_RTTI"); > > if (LangOpts.SjLjExceptions) > @@ -713,11 +722,8 @@ static void InitializePredefinedMacros(c > if (LangOpts.Deprecated) > Builder.defineMacro("__DEPRECATED"); > > - if (!LangOpts.MSVCCompat && LangOpts.CPlusPlus) { > - Builder.defineMacro("__GNUG__", "4"); > - Builder.defineMacro("__GXX_WEAK__"); > + if (!LangOpts.MSVCCompat && LangOpts.CPlusPlus) > Builder.defineMacro("__private_extern__", "extern"); > - } > > if (LangOpts.MicrosoftExt) { > if (LangOpts.WChar) { > @@ -927,7 +933,7 @@ static void InitializePredefinedMacros(c > else > Builder.defineMacro("__FINITE_MATH_ONLY__", "0"); > > - if (!LangOpts.MSVCCompat) { > + if (LangOpts.GNUCVersion) { > if (LangOpts.GNUInline || LangOpts.CPlusPlus) > Builder.defineMacro("__GNUC_GNU_INLINE__"); > else > @@ -964,7 +970,7 @@ static void InitializePredefinedMacros(c > #undef DEFINE_LOCK_FREE_MACRO > }; > addLockFreeMacros("__CLANG_ATOMIC_"); > - if (!LangOpts.MSVCCompat) > + if (LangOpts.GNUCVersion) > addLockFreeMacros("__GCC_ATOMIC_"); > > if (LangOpts.NoInlineDefine) > > Added: cfe/trunk/test/Driver/fgnuc-version.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fgnuc-version.c?rev=374449&view=auto > > ============================================================================== > --- cfe/trunk/test/Driver/fgnuc-version.c (added) > +++ cfe/trunk/test/Driver/fgnuc-version.c Thu Oct 10 14:04:25 2019 > @@ -0,0 +1,26 @@ > +// > +// Verify -fgnuc-version parsing > +// > + > +// RUN: %clang -c %s -target i686-linux -### 2>&1 | FileCheck %s > -check-prefix GNUC-DEFAULT > +// GNUC-DEFAULT: "-fgnuc-version=4.2.1" > + > +// RUN: %clang -c %s -target i686-linux -fgnuc-version=100.99.99 -### > 2>&1 | FileCheck %s -check-prefix GNUC-OVERRIDE > +// GNUC-OVERRIDE: "-fgnuc-version=100.99.99" > + > +// RUN: %clang -c %s -target i686-linux -fgnuc-version=0 -### 2>&1 | > FileCheck %s -check-prefix GNUC-DISABLE > +// RUN: %clang -c %s -target i686-linux -fgnuc-version= -### 2>&1 | > FileCheck %s -check-prefix GNUC-DISABLE > +// GNUC-DISABLE-NOT: "-fgnuc-version= > + > +// RUN: not %clang -c %s -target i686-linux -fgnuc-version=100.100.10 > 2>&1 | FileCheck %s -check-prefix GNUC-INVALID > +// RUN: not %clang -c %s -target i686-linux -fgnuc-version=100.10.100 > 2>&1 | FileCheck %s -check-prefix GNUC-INVALID > +// RUN: not %clang -c %s -target i686-linux -fgnuc-version=-1.0.0 2>&1 | > FileCheck %s -check-prefix GNUC-INVALID > +// GNUC-INVALID: error: invalid value {{.*}} in '-fgnuc-version={{.*}}' > + > +// RUN: %clang -fgnuc-version=100.99.99 %s -dM -E -o - | FileCheck %s > -check-prefix GNUC-LARGE > +// GNUC-LARGE: #define __GNUC_MINOR__ 99 > +// GNUC-LARGE: #define __GNUC_PATCHLEVEL__ 99 > +// GNUC-LARGE: #define __GNUC__ 100 > + > +// RUN: %clang -fgnuc-version=100.99.99 -x c++ %s -dM -E -o - | FileCheck > %s -check-prefix GXX-LARGE > +// GXX-LARGE: #define __GNUG__ 100 > > Modified: cfe/trunk/test/Driver/rewrite-legacy-objc.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/rewrite-legacy-objc.m?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/test/Driver/rewrite-legacy-objc.m (original) > +++ cfe/trunk/test/Driver/rewrite-legacy-objc.m Thu Oct 10 14:04:25 2019 > @@ -3,11 +3,11 @@ > // TEST0: clang{{.*}}" "-cc1" > // TEST0: "-rewrite-objc" > // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check > adjacency instead. > -// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" > "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" > "-fobjc-runtime=macosx-fragile" "-fno-objc-infer-related-result-type" > "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" > "-fdiagnostics-show-option" > +// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" > "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" > "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" > "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" > "-fmax-type-align=16" "-fdiagnostics-show-option" > // TEST0: rewrite-legacy-objc.m" > // RUN: %clang -no-canonical-prefixes -target i386-apple-macosx10.9.0 > -rewrite-legacy-objc %s -o - -### 2>&1 | \ > // RUN: FileCheck -check-prefix=TEST1 %s > // RUN: %clang -no-canonical-prefixes -target i386-apple-macosx10.6.0 > -rewrite-legacy-objc %s -o - -### 2>&1 | \ > // RUN: FileCheck -check-prefix=TEST2 %s > -// TEST1: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" > "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" > "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" > "-fno-objc-infer-related-result-type" "-fobjc-exceptions" > "-fmax-type-align=16" "-fdiagnostics-show-option" > -// TEST2: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" > "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" > "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" > "-fno-objc-infer-related-result-type" "-fobjc-exceptions" > "-fmax-type-align=16" "-fdiagnostics-show-option" > +// TEST1: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" > "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" > "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" > "-fobjc-subscripting-legacy-runtime" "-fno-objc-infer-related-result-type" > "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" > +// TEST2: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" > "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" > "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" > "-fobjc-subscripting-legacy-runtime" "-fno-objc-infer-related-result-type" > "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" > > Modified: cfe/trunk/test/Driver/rewrite-objc.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/rewrite-objc.m?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/test/Driver/rewrite-objc.m (original) > +++ cfe/trunk/test/Driver/rewrite-objc.m Thu Oct 10 14:04:25 2019 > @@ -3,4 +3,4 @@ > // TEST0: clang{{.*}}" "-cc1" > // TEST0: "-rewrite-objc" > // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check > adjacency instead. > -// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" > "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" > "-fobjc-runtime=macosx" "-fno-objc-infer-related-result-type" > "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" > "-fdiagnostics-show-option" > +// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" > "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" > "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx" > "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" > "-fmax-type-align=16" "-fdiagnostics-show-option" > > Modified: cfe/trunk/test/Frontend/gnu-inline.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/gnu-inline.c?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/test/Frontend/gnu-inline.c (original) > +++ cfe/trunk/test/Frontend/gnu-inline.c Thu Oct 10 14:04:25 2019 > @@ -1,9 +1,9 @@ > -// RUN: %clang_cc1 -std=c89 -fsyntax-only -x c -E -dM %s | FileCheck > --check-prefix=GNU-INLINE %s > -// RUN: %clang_cc1 -std=c99 -fsyntax-only -x c -E -dM %s | FileCheck > --check-prefix=STDC-INLINE %s > -// RUN: %clang_cc1 -std=c99 -fgnu89-inline -fsyntax-only -x c -E -dM %s | > FileCheck --check-prefix=GNU-INLINE %s > -// RUN: %clang_cc1 -fsyntax-only -x c++ -E -dM %s | FileCheck > --check-prefix=GNU-INLINE %s > -// RUN: not %clang_cc1 -fgnu89-inline -fsyntax-only -x c++ %s 2>&1 | > FileCheck --check-prefix=CXX %s > -// RUN: not %clang_cc1 -fgnu89-inline -fsyntax-only -x objective-c++ %s > 2>&1 | FileCheck --check-prefix=OBJCXX %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -std=c89 -fsyntax-only -x c -E > -dM %s | FileCheck --check-prefix=GNU-INLINE %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -std=c99 -fsyntax-only -x c -E > -dM %s | FileCheck --check-prefix=STDC-INLINE %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -std=c99 -fgnu89-inline > -fsyntax-only -x c -E -dM %s | FileCheck --check-prefix=GNU-INLINE %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -fsyntax-only -x c++ -E -dM %s | > FileCheck --check-prefix=GNU-INLINE %s > +// RUN: not %clang_cc1 -fgnu89-inline -fgnuc-version=4.2.1 -fsyntax-only > -x c++ %s 2>&1 | FileCheck --check-prefix=CXX %s > +// RUN: not %clang_cc1 -fgnu89-inline -fgnuc-version=4.2.1 -fsyntax-only > -x objective-c++ %s 2>&1 | FileCheck --check-prefix=OBJCXX %s > > // CXX: '-fgnu89-inline' not allowed with 'C++' > // OBJCXX: '-fgnu89-inline' not allowed with 'Objective-C++' > > Modified: cfe/trunk/test/Headers/stdbool.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/stdbool.cpp?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/test/Headers/stdbool.cpp (original) > +++ cfe/trunk/test/Headers/stdbool.cpp Thu Oct 10 14:04:25 2019 > @@ -1,7 +1,7 @@ > -// RUN: %clang_cc1 -std=gnu++98 -E -dM %s | FileCheck > --check-prefix=CHECK-GNU-COMPAT-98 %s > -// RUN: %clang_cc1 -std=gnu++11 -E -dM %s | FileCheck > --check-prefix=CHECK-GNU-COMPAT-11 %s > -// RUN: %clang_cc1 -std=c++98 -E -dM %s | FileCheck > --check-prefix=CHECK-CONFORMING %s > -// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -verify -Weverything %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -std=gnu++98 -E -dM %s | > FileCheck --check-prefix=CHECK-GNU-COMPAT-98 %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -std=gnu++11 -E -dM %s | > FileCheck --check-prefix=CHECK-GNU-COMPAT-11 %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -std=c++98 -E -dM %s | FileCheck > --check-prefix=CHECK-CONFORMING %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -fsyntax-only -std=gnu++98 > -verify -Weverything %s > #include <stdbool.h> > #define zzz > > > Modified: cfe/trunk/test/Preprocessor/init.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/test/Preprocessor/init.c (original) > +++ cfe/trunk/test/Preprocessor/init.c Thu Oct 10 14:04:25 2019 > @@ -9,18 +9,18 @@ > // BLOCKS:#define __block __attribute__((__blocks__(byref))) > // > // > -// RUN: %clang_cc1 -x c++ -std=c++2a -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix CXX2A %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++2a -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix CXX2A %s > // > -// CXX2A:#define __GNUG__ {{.*}} > +// CXX2A:#define __GNUG__ 4 > // CXX2A:#define __GXX_EXPERIMENTAL_CXX0X__ 1 > // CXX2A:#define __GXX_RTTI 1 > // CXX2A:#define __GXX_WEAK__ 1 > // CXX2A:#define __cplusplus 201707L > // CXX2A:#define __private_extern__ extern > // > -// RUN: %clang_cc1 -x c++ -std=c++1z -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix CXX1Z %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++1z -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix CXX1Z %s > // > -// CXX1Z:#define __GNUG__ {{.*}} > +// CXX1Z:#define __GNUG__ 4 > // CXX1Z:#define __GXX_EXPERIMENTAL_CXX0X__ 1 > // CXX1Z:#define __GXX_RTTI 1 > // CXX1Z:#define __GXX_WEAK__ 1 > @@ -28,9 +28,9 @@ > // CXX1Z:#define __private_extern__ extern > // > // > -// RUN: %clang_cc1 -x c++ -std=c++1y -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix CXX1Y %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++1y -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix CXX1Y %s > // > -// CXX1Y:#define __GNUG__ {{.*}} > +// CXX1Y:#define __GNUG__ 4 > // CXX1Y:#define __GXX_EXPERIMENTAL_CXX0X__ 1 > // CXX1Y:#define __GXX_RTTI 1 > // CXX1Y:#define __GXX_WEAK__ 1 > @@ -38,9 +38,9 @@ > // CXX1Y:#define __private_extern__ extern > // > // > -// RUN: %clang_cc1 -x c++ -std=c++11 -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix CXX11 %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++11 -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix CXX11 %s > // > -// CXX11:#define __GNUG__ {{.*}} > +// CXX11:#define __GNUG__ 4 > // CXX11:#define __GXX_EXPERIMENTAL_CXX0X__ 1 > // CXX11:#define __GXX_RTTI 1 > // CXX11:#define __GXX_WEAK__ 1 > @@ -48,9 +48,9 @@ > // CXX11:#define __private_extern__ extern > // > // > -// RUN: %clang_cc1 -x c++ -std=c++98 -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix CXX98 %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++98 -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix CXX98 %s > // > -// CXX98:#define __GNUG__ {{.*}} > +// CXX98:#define __GNUG__ 4 > // CXX98:#define __GXX_RTTI 1 > // CXX98:#define __GXX_WEAK__ 1 > // CXX98:#define __cplusplus 199711L > @@ -87,7 +87,7 @@ > // C11-NOT: __cplusplus > // > // > -// RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -match-full-lines > -check-prefix COMMON %s > +// RUN: %clang_cc1 -fgnuc-version=4.2.1 -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix COMMON %s > // > // COMMON:#define __CONSTANT_CFSTRINGS__ 1 > // COMMON:#define __FINITE_MATH_ONLY__ 0 > @@ -119,41 +119,41 @@ > // RUN: %clang_cc1 -ffreestanding -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix FREESTANDING %s > // FREESTANDING:#define __STDC_HOSTED__ 0 > // > -// RUN: %clang_cc1 -x c++ -std=gnu++2a -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix GXX2A %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=gnu++2a -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix GXX2A %s > // > -// GXX2A:#define __GNUG__ {{.*}} > +// GXX2A:#define __GNUG__ 4 > // GXX2A:#define __GXX_WEAK__ 1 > // GXX2A:#define __cplusplus 201707L > // GXX2A:#define __private_extern__ extern > // > // > -// RUN: %clang_cc1 -x c++ -std=gnu++1z -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix GXX1Z %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=gnu++1z -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix GXX1Z %s > // > -// GXX1Z:#define __GNUG__ {{.*}} > +// GXX1Z:#define __GNUG__ 4 > // GXX1Z:#define __GXX_WEAK__ 1 > // GXX1Z:#define __cplusplus 201703L > // GXX1Z:#define __private_extern__ extern > // > // > -// RUN: %clang_cc1 -x c++ -std=gnu++1y -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix GXX1Y %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=gnu++1y -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix GXX1Y %s > // > -// GXX1Y:#define __GNUG__ {{.*}} > +// GXX1Y:#define __GNUG__ 4 > // GXX1Y:#define __GXX_WEAK__ 1 > // GXX1Y:#define __cplusplus 201402L > // GXX1Y:#define __private_extern__ extern > // > // > -// RUN: %clang_cc1 -x c++ -std=gnu++11 -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix GXX11 %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=gnu++11 -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix GXX11 %s > // > -// GXX11:#define __GNUG__ {{.*}} > +// GXX11:#define __GNUG__ 4 > // GXX11:#define __GXX_WEAK__ 1 > // GXX11:#define __cplusplus 201103L > // GXX11:#define __private_extern__ extern > // > // > -// RUN: %clang_cc1 -x c++ -std=gnu++98 -E -dM < /dev/null | FileCheck > -match-full-lines -check-prefix GXX98 %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=gnu++98 -E -dM < > /dev/null | FileCheck -match-full-lines -check-prefix GXX98 %s > // > -// GXX98:#define __GNUG__ {{.*}} > +// GXX98:#define __GNUG__ 4 > // GXX98:#define __GXX_WEAK__ 1 > // GXX98:#define __cplusplus 199711L > // GXX98:#define __private_extern__ extern > @@ -2845,9 +2845,9 @@ > // I386:#define __i386__ 1 > // I386:#define i386 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-pc-linux-gnu > -target-cpu pentium4 < /dev/null | FileCheck -match-full-lines > -check-prefix I386-LINUX -check-prefix I386-LINUX-ALIGN32 %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=i386-pc-linux-gnu > -target-cpu pentium4 < /dev/null | FileCheck -match-full-lines > -check-prefix I386-LINUX -check-prefix I386-LINUX-CXX -check-prefix > I386-LINUX-ALIGN32 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-pc-linux-gnu > -target-cpu pentium4 -malign-double < /dev/null | FileCheck > -match-full-lines -check-prefix I386-LINUX -check-prefix I386-LINUX-ALIGN64 > %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=i386-pc-linux-gnu -target-cpu pentium4 < /dev/null | FileCheck > -match-full-lines -check-prefix I386-LINUX -check-prefix I386-LINUX-ALIGN32 > %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=i386-pc-linux-gnu -target-cpu pentium4 < /dev/null | FileCheck > -match-full-lines -check-prefix I386-LINUX -check-prefix I386-LINUX-CXX > -check-prefix I386-LINUX-ALIGN32 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=i386-pc-linux-gnu -target-cpu pentium4 -malign-double < /dev/null | > FileCheck -match-full-lines -check-prefix I386-LINUX -check-prefix > I386-LINUX-ALIGN64 %s > // > // I386-LINUX-NOT:#define _LP64 > // I386-LINUX:#define __BIGGEST_ALIGNMENT__ 16 > @@ -3047,9 +3047,9 @@ > // I386-LINUX:#define __i386__ 1 > // I386-LINUX:#define i386 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd -target-cpu > i486 < /dev/null | FileCheck -match-full-lines -check-prefix I386-NETBSD %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=i386-netbsd > -target-cpu i486 < /dev/null | FileCheck -match-full-lines -check-prefix > I386-NETBSD -check-prefix I386-NETBSD-CXX %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd -target-cpu > i486 -malign-double < /dev/null | FileCheck -match-full-lines -check-prefix > I386-NETBSD %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=i386-netbsd -target-cpu i486 < /dev/null | FileCheck > -match-full-lines -check-prefix I386-NETBSD %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=i386-netbsd -target-cpu i486 < /dev/null | FileCheck > -match-full-lines -check-prefix I386-NETBSD -check-prefix I386-NETBSD-CXX %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=i386-netbsd -target-cpu i486 -malign-double < /dev/null | FileCheck > -match-full-lines -check-prefix I386-NETBSD %s > // > // > // I386-NETBSD-NOT:#define _LP64 > @@ -3263,8 +3263,8 @@ > // I386-DECLSPEC: #define __declspec{{.*}} > > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips-none-none < > /dev/null | FileCheck -match-full-lines -check-prefix MIPS32BE > -check-prefix MIPS32BE-C %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=mips-none-none < > /dev/null | FileCheck -match-full-lines -check-prefix MIPS32BE > -check-prefix MIPS32BE-CXX %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=mips-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix MIPS32BE -check-prefix MIPS32BE-C %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=mips-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix MIPS32BE -check-prefix MIPS32BE-CXX %s > // > // MIPS32BE:#define MIPSEB 1 > // MIPS32BE:#define _ABIO32 1 > @@ -3682,10 +3682,10 @@ > // MIPS32EL:#define _mips 1 > // MIPS32EL:#define mips 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 \ > // RUN: -triple=mips64-none-none -target-abi n32 < /dev/null \ > // RUN: | FileCheck -match-full-lines -check-prefix MIPSN32BE > -check-prefix MIPSN32BE-C %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding \ > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 \ > // RUN: -triple=mips64-none-none -target-abi n32 < /dev/null \ > // RUN: | FileCheck -match-full-lines -check-prefix MIPSN32BE > -check-prefix MIPSN32BE-CXX %s > // > @@ -3993,7 +3993,7 @@ > // MIPSN32BE: #define _mips 1 > // MIPSN32BE: #define mips 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 \ > // RUN: -triple=mips64el-none-none -target-abi n32 < /dev/null > \ > // RUN: | FileCheck -match-full-lines -check-prefix MIPSN32EL %s > // > @@ -4300,8 +4300,8 @@ > // MIPSN32EL: #define _mips 1 > // MIPSN32EL: #define mips 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-none-none < > /dev/null | FileCheck -match-full-lines -check-prefix MIPS64BE %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=mips64-none-none > < /dev/null | FileCheck -match-full-lines -check-prefix MIPS64BE > -check-prefix MIPS64BE-CXX %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=mips64-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix MIPS64BE %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=mips64-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix MIPS64BE -check-prefix MIPS64BE-CXX %s > // > // MIPS64BE:#define MIPSEB 1 > // MIPS64BE:#define _ABI64 3 > @@ -6838,13 +6838,13 @@ > // PPC64-LINUX:#define __ppc64__ 1 > // PPC64-LINUX:#define __ppc__ 1 > > -// RUN: %clang_cc1 -E -dM -ffreestanding > -triple=powerpc64-unknown-linux-gnu < /dev/null | FileCheck > -match-full-lines -check-prefix PPC64-ELFv1 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding > -triple=powerpc64-unknown-linux-gnu -target-abi elfv1 < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv1 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding > -triple=powerpc64-unknown-linux-gnu -target-abi elfv1-qpx < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv1 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding > -triple=powerpc64-unknown-linux-gnu -target-abi elfv2 < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv2 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding > -triple=powerpc64le-unknown-linux-gnu < /dev/null | FileCheck > -match-full-lines -check-prefix PPC64-ELFv2 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding > -triple=powerpc64le-unknown-linux-gnu -target-abi elfv1 < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv1 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding > -triple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv2 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=powerpc64-unknown-linux-gnu < /dev/null | FileCheck > -match-full-lines -check-prefix PPC64-ELFv1 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=powerpc64-unknown-linux-gnu -target-abi elfv1 < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv1 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=powerpc64-unknown-linux-gnu -target-abi elfv1-qpx < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv1 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=powerpc64-unknown-linux-gnu -target-abi elfv2 < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv2 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=powerpc64le-unknown-linux-gnu < /dev/null | FileCheck > -match-full-lines -check-prefix PPC64-ELFv2 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=powerpc64le-unknown-linux-gnu -target-abi elfv1 < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv1 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < /dev/null | > FileCheck -match-full-lines -check-prefix PPC64-ELFv2 %s > // PPC64-ELFv1:#define _CALL_ELF 1 > // PPC64-ELFv2:#define _CALL_ELF 2 > // > @@ -7980,12 +7980,12 @@ > // S390X:#define __s390__ 1 > // S390X:#define __s390x__ 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-none < > /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix > SPARC-DEFAULT %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-rtems-elf < > /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix > SPARC-DEFAULT %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-netbsd < > /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix > SPARC-NETOPENBSD %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-openbsd < > /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix > SPARC-NETOPENBSD %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=sparc-none-none < > /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix > SPARC-DEFAULT -check-prefix SPARC-DEFAULT-CXX %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding > -triple=sparc-none-openbsd < /dev/null | FileCheck -match-full-lines > -check-prefix SPARC -check-prefix SPARC-NETOPENBSD -check-prefix > SPARC-NETOPENBSD-CXX %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=sparc-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix SPARC -check-prefix SPARC-DEFAULT %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=sparc-rtems-elf < /dev/null | FileCheck -match-full-lines > -check-prefix SPARC -check-prefix SPARC-DEFAULT %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=sparc-none-netbsd < /dev/null | FileCheck -match-full-lines > -check-prefix SPARC -check-prefix SPARC-NETOPENBSD %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=sparc-none-openbsd < /dev/null | FileCheck -match-full-lines > -check-prefix SPARC -check-prefix SPARC-NETOPENBSD %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=sparc-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix SPARC -check-prefix SPARC-DEFAULT -check-prefix > SPARC-DEFAULT-CXX %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=sparc-none-openbsd < /dev/null | FileCheck -match-full-lines > -check-prefix SPARC -check-prefix SPARC-NETOPENBSD -check-prefix > SPARC-NETOPENBSD-CXX %s > // > // SPARC-NOT:#define _LP64 > // SPARC:#define __BIGGEST_ALIGNMENT__ 8 > @@ -8185,8 +8185,8 @@ > // SPARC:#define __sparcv8 1 > // SPARC:#define sparc 1 > > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=tce-none-none < > /dev/null | FileCheck -match-full-lines -check-prefix TCE %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=tce-none-none < > /dev/null | FileCheck -match-full-lines -check-prefix TCE -check-prefix > TCE-CXX %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=tce-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix TCE %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=tce-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix TCE -check-prefix TCE-CXX %s > // > // TCE-NOT:#define _LP64 > // TCE:#define __BIGGEST_ALIGNMENT__ 4 > @@ -8354,8 +8354,8 @@ > // TCE:#define __tce__ 1 > // TCE:#define tce 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-none-none < > /dev/null | FileCheck -match-full-lines -check-prefix X86_64 %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-none-none > < /dev/null | FileCheck -match-full-lines -check-prefix X86_64 > -check-prefix X86_64-CXX %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=x86_64-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix X86_64 %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=x86_64-none-none < /dev/null | FileCheck -match-full-lines > -check-prefix X86_64 -check-prefix X86_64-CXX %s > // > // X86_64:#define _LP64 1 > // X86_64-NOT:#define _LP32 1 > @@ -8562,8 +8562,8 @@ > // RUN: %clang -xc - -E -dM -mcmodel=medium --target=i386-unknown-linux < > /dev/null | FileCheck -match-full-lines -check-prefix X86_MEDIUM %s > // X86_MEDIUM:#define __code_model_medium_ 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-none-none-gnux32 > < /dev/null | FileCheck -match-full-lines -check-prefix X32 %s > -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding > -triple=x86_64-none-none-gnux32 < /dev/null | FileCheck -match-full-lines > -check-prefix X32 -check-prefix X32-CXX %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=x86_64-none-none-gnux32 < /dev/null | FileCheck -match-full-lines > -check-prefix X32 %s > +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=x86_64-none-none-gnux32 < /dev/null | FileCheck -match-full-lines > -check-prefix X32 -check-prefix X32-CXX %s > // > // X32:#define _ILP32 1 > // X32-NOT:#define _LP64 1 > @@ -8759,7 +8759,7 @@ > // X32:#define __x86_64 1 > // X32:#define __x86_64__ 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-unknown-cloudabi > < /dev/null | FileCheck -match-full-lines -check-prefix X86_64-CLOUDABI %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=x86_64-unknown-cloudabi < /dev/null | FileCheck -match-full-lines > -check-prefix X86_64-CLOUDABI %s > // > // X86_64-CLOUDABI:#define _LP64 1 > // X86_64-CLOUDABI:#define __ATOMIC_ACQUIRE 2 > @@ -9064,7 +9064,7 @@ > // X86_64-CLOUDABI:#define __x86_64 1 > // X86_64-CLOUDABI:#define __x86_64__ 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-pc-linux-gnu < > /dev/null | FileCheck -match-full-lines -check-prefix X86_64-LINUX %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=x86_64-pc-linux-gnu < /dev/null | FileCheck -match-full-lines > -check-prefix X86_64-LINUX %s > // > // X86_64-LINUX:#define _LP64 1 > // X86_64-LINUX:#define __BIGGEST_ALIGNMENT__ 16 > @@ -9277,7 +9277,7 @@ > // X86_64-FREEBSD:#define __LDBL_DECIMAL_DIG__ 21 > // X86_64-FREEBSD:#define __STDC_MB_MIGHT_NEQ_WC__ 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-netbsd < > /dev/null | FileCheck -match-full-lines -check-prefix X86_64-NETBSD %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=x86_64-netbsd < /dev/null | FileCheck -match-full-lines > -check-prefix X86_64-NETBSD %s > // > // X86_64-NETBSD:#define _LP64 1 > // X86_64-NETBSD:#define __BIGGEST_ALIGNMENT__ 16 > @@ -9481,7 +9481,7 @@ > // X86_64-NETBSD:#define __x86_64 1 > // X86_64-NETBSD:#define __x86_64__ 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-scei-ps4 < > /dev/null | FileCheck -match-full-lines -check-prefix PS4 %s > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=x86_64-scei-ps4 < /dev/null | FileCheck -match-full-lines > -check-prefix PS4 %s > // > // PS4:#define _LP64 1 > // PS4:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > @@ -9641,7 +9641,7 @@ > // RUN: %clang_cc1 -x objective-c -triple i386-unknown-freebsd > -fobjc-runtime=gnustep-2.5 -E -dM < /dev/null | FileCheck -match-full-lines > -check-prefix GNUSTEP2 %s > // GNUSTEP2:#define __OBJC_GNUSTEP_RUNTIME_ABI__ 20 > // > -// RUN: %clang_cc1 -x c++ -std=c++98 -fno-rtti -E -dM < /dev/null | > FileCheck -match-full-lines -check-prefix NORTTI %s > +// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++98 -fno-rtti -E > -dM < /dev/null | FileCheck -match-full-lines -check-prefix NORTTI %s > // NORTTI: #define __GXX_ABI_VERSION {{.*}} > // NORTTI-NOT:#define __GXX_RTTI > // NORTTI:#define __STDC__ 1 > @@ -9700,16 +9700,16 @@ > // XCORE:#define __LITTLE_ENDIAN__ 1 > // XCORE:#define __XS1B__ 1 > // > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=wasm32-unknown-unknown \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=wasm32-unknown-unknown \ > // RUN: < /dev/null \ > // RUN: | FileCheck -match-full-lines > -check-prefixes=WEBASSEMBLY,WEBASSEMBLY32 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=wasm64-unknown-unknown \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=wasm64-unknown-unknown \ > // RUN: < /dev/null \ > // RUN: | FileCheck -match-full-lines > -check-prefixes=WEBASSEMBLY,WEBASSEMBLY64 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=wasm32-wasi \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=wasm32-wasi \ > // RUN: < /dev/null \ > // RUN: | FileCheck -match-full-lines > -check-prefixes=WEBASSEMBLY,WEBASSEMBLY32,WEBASSEMBLY-WASI %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=wasm64-wasi \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=wasm64-wasi \ > // RUN: < /dev/null \ > // RUN: | FileCheck -match-full-lines > -check-prefixes=WEBASSEMBLY,WEBASSEMBLY64,WEBASSEMBLY-WASI %s > // > @@ -10087,7 +10087,7 @@ > // RUN: %clang_cc1 -E -dM -ffreestanding -triple x86_64-windows-cygnus < > /dev/null | FileCheck -match-full-lines -check-prefix CYGWIN-X64 %s > // CYGWIN-X64: #define __USER_LABEL_PREFIX__ > > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=avr \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 -triple=avr > \ > // RUN: < /dev/null \ > // RUN: | FileCheck -match-full-lines -check-prefix=AVR %s > // > @@ -10295,10 +10295,10 @@ > // MSVC-X64:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16ULL > > // RUN: %clang_cc1 -E -dM -ffreestanding \ > -// RUN: -triple=aarch64-apple-ios9 < /dev/null \ > +// RUN: -fgnuc-version=4.2.1 -triple=aarch64-apple-ios9 < /dev/null > \ > // RUN: | FileCheck -check-prefix=DARWIN %s > // RUN: %clang_cc1 -E -dM -ffreestanding \ > -// RUN: -triple=aarch64-apple-macosx10.12 < /dev/null \ > +// RUN: -fgnuc-version=4.2.1 -triple=aarch64-apple-macosx10.12 < > /dev/null \ > // RUN: | FileCheck -check-prefix=DARWIN %s > > // DARWIN:#define __STDC_NO_THREADS__ 1 > @@ -10364,11 +10364,11 @@ > // ARM-DARWIN-BAREMETAL-64: #define __PTRDIFF_TYPE__ long int > // ARM-DARWIN-BAREMETAL-64: #define __SIZE_TYPE__ long unsigned int > > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=riscv32 < /dev/null \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=riscv32 < /dev/null \ > // RUN: | FileCheck -match-full-lines -check-prefix=RISCV32 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=riscv32-unknown-linux < > /dev/null \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=riscv32-unknown-linux < /dev/null \ > // RUN: | FileCheck -match-full-lines > -check-prefixes=RISCV32,RISCV32-LINUX %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=riscv32 \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=riscv32 \ > // RUN: -fforce-enable-int128 < /dev/null | FileCheck -match-full-lines \ > // RUN: -check-prefixes=RISCV32,RISCV32-INT128 %s > // RISCV32: #define _ILP32 1 > @@ -10575,9 +10575,9 @@ > // RISCV32-LINUX: #define linux 1 > // RISCV32-LINUX: #define unix 1 > > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=riscv64 < /dev/null \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=riscv64 < /dev/null \ > // RUN: | FileCheck -match-full-lines -check-prefix=RISCV64 %s > -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=riscv64-unknown-linux < > /dev/null \ > +// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 > -triple=riscv64-unknown-linux < /dev/null \ > // RUN: | FileCheck -match-full-lines > -check-prefixes=RISCV64,RISCV64-LINUX %s > // RISCV64: #define _LP64 1 > // RISCV64: #define __ATOMIC_ACQUIRE 2 > > Modified: cfe/trunk/test/Sema/atomic-ops.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/atomic-ops.c?rev=374449&r1=374448&r2=374449&view=diff > > ============================================================================== > --- cfe/trunk/test/Sema/atomic-ops.c (original) > +++ cfe/trunk/test/Sema/atomic-ops.c Thu Oct 10 14:04:25 2019 > @@ -1,4 +1,4 @@ > -// RUN: %clang_cc1 %s -verify -ffreestanding -fsyntax-only > -triple=i686-linux-gnu -std=c11 > +// RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding > -fsyntax-only -triple=i686-linux-gnu -std=c11 > > // Basic parsing/Sema tests for __c11_atomic_* > > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits