r265359 - Set the default C standard to C99 when targeting the PS4.
Sean Silva via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 6 14:14:42 PDT 2016
I've had to revert this in r265601 because it was breaking the PS4 bots.
In the future, please keep an eye on them! It's a total bummer leaving them
red for 2 days.
http://lab.llvm.org:8011/waterfall?builder=llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast&builder=llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast&reload=120
-- Sean Silva
On Mon, Apr 4, 2016 at 3:56 PM, Sunil Srivastava via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: ssrivastava
> Date: Mon Apr 4 17:56:05 2016
> New Revision: 265359
>
> URL: http://llvm.org/viewvc/llvm-project?rev=265359&view=rev
> Log:
> Set the default C standard to C99 when targeting the PS4.
>
> Patch by Douglas Yung!
>
> Differential Revision: http://reviews.llvm.org/D18708
>
> Modified:
> cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/test/Preprocessor/init.c
>
> Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=265359&r1=265358&r2=265359&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
> +++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Mon Apr 4
> 17:56:05 2016
> @@ -153,8 +153,10 @@ public:
> ///
> /// \param Opts - The LangOptions object to set up.
> /// \param IK - The input language.
> + /// \param T - The target triple.
> /// \param LangStd - The input language standard.
> static void setLangDefaults(LangOptions &Opts, InputKind IK,
> + const llvm::Triple &T,
> LangStandard::Kind LangStd =
> LangStandard::lang_unspecified);
>
> /// \brief Retrieve a module hash string that is suitable for uniquely
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=265359&r1=265358&r2=265359&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Apr 4 17:56:05 2016
> @@ -1355,6 +1355,7 @@ static void ParseHeaderSearchArgs(Header
> }
>
> void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
> + const llvm::Triple &T,
> LangStandard::Kind LangStd) {
> // Set some properties which depend solely on the input kind; it would
> be nice
> // to move these to the language standard, and have the driver resolve
> the
> @@ -1387,7 +1388,11 @@ void CompilerInvocation::setLangDefaults
> case IK_PreprocessedC:
> case IK_ObjC:
> case IK_PreprocessedObjC:
> - LangStd = LangStandard::lang_gnu11;
> + // The PS4 uses C99 as the default C standard.
> + if (T.isPS4())
> + LangStd = LangStandard::lang_gnu99;
> + else
> + LangStd = LangStandard::lang_gnu11;
> break;
> case IK_CXX:
> case IK_PreprocessedCXX:
> @@ -1541,7 +1546,8 @@ static void ParseLangArgs(LangOptions &O
> LangStd = OpenCLLangStd;
> }
>
> - CompilerInvocation::setLangDefaults(Opts, IK, LangStd);
> + llvm::Triple T(TargetOpts.Triple);
> + CompilerInvocation::setLangDefaults(Opts, IK, T, LangStd);
>
> // We abuse '-f[no-]gnu-keywords' to force overriding all GNU-extension
> // keywords. This behavior is provided by GCC's poorly named '-fasm'
> flag,
> @@ -1861,7 +1867,6 @@ static void ParseLangArgs(LangOptions &O
> // Provide diagnostic when a given target is not expected to be an
> OpenMP
> // device or host.
> if (Opts.OpenMP && !Opts.OpenMPIsDevice) {
> - llvm::Triple T(TargetOpts.Triple);
> switch (T.getArch()) {
> default:
> break;
>
> Modified: cfe/trunk/test/Preprocessor/init.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=265359&r1=265358&r2=265359&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Preprocessor/init.c (original)
> +++ cfe/trunk/test/Preprocessor/init.c Mon Apr 4 17:56:05 2016
> @@ -8358,6 +8358,7 @@
> // PS4:#define __SSE2__ 1
> // PS4:#define __SSE_MATH__ 1
> // PS4:#define __SSE__ 1
> +// PS4:#define __STDC_VERSION__ 199901L
> // PS4:#define __UINTMAX_TYPE__ long unsigned int
> // PS4:#define __USER_LABEL_PREFIX__
> // PS4:#define __WCHAR_MAX__ 65535
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160406/f2c7b1be/attachment.html>
More information about the cfe-commits
mailing list