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