[clang] a844378 - Change default C dialect for PS5 to gnu17/gnu18.

Sunil Srivastava via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 12 11:15:09 PDT 2022


Author: Sunil Srivastava
Date: 2022-07-12T11:14:56-07:00
New Revision: a844378b2bc2c0a7f18e8d7cdd259b6c4d443128

URL: https://github.com/llvm/llvm-project/commit/a844378b2bc2c0a7f18e8d7cdd259b6c4d443128
DIFF: https://github.com/llvm/llvm-project/commit/a844378b2bc2c0a7f18e8d7cdd259b6c4d443128.diff

LOG: Change default C dialect for PS5 to gnu17/gnu18.

Differential Revision: https://reviews.llvm.org/D129404

Added: 
    

Modified: 
    clang/lib/Basic/LangStandards.cpp
    clang/test/Preprocessor/init.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/LangStandards.cpp b/clang/lib/Basic/LangStandards.cpp
index 5bacc3b16496..a21898dd3c62 100644
--- a/clang/lib/Basic/LangStandards.cpp
+++ b/clang/lib/Basic/LangStandards.cpp
@@ -61,8 +61,8 @@ LangStandard::Kind clang::getDefaultLanguageStandard(clang::Language Lang,
     if (CLANG_DEFAULT_STD_C != LangStandard::lang_unspecified)
       return CLANG_DEFAULT_STD_C;
 
-    // The PS4 and PS5 use C99 as the default C standard.
-    if (T.isPS())
+    // The PS4 uses C99 as the default C standard.
+    if (T.isPS4())
       return LangStandard::lang_gnu99;
     return LangStandard::lang_gnu17;
   case Language::ObjC:

diff  --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 61324fd5e43d..e3a24824ff19 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -1342,7 +1342,8 @@
 // PS4:#define __SSE2__ 1
 // PS4:#define __SSE_MATH__ 1
 // PS4:#define __SSE__ 1
-// PS4:#define __STDC_VERSION__ 199901L
+// PS4ONLY:#define __STDC_VERSION__ 199901L
+// PS5ONLY:#define __STDC_VERSION__ 201710L
 // PS4:#define __UINTMAX_TYPE__ long unsigned int
 // PS4:#define __USER_LABEL_PREFIX__
 // PS4:#define __WCHAR_MAX__ 65535


        


More information about the cfe-commits mailing list