r368170 - [OPENMP]Add standard macro value _OPENMP for OpenMP 5.0.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 07:02:11 PDT 2019


Author: abataev
Date: Wed Aug  7 07:02:11 2019
New Revision: 368170

URL: http://llvm.org/viewvc/llvm-project?rev=368170&view=rev
Log:
[OPENMP]Add standard macro value _OPENMP for OpenMP 5.0.

According to the OpenMP standard, compiler must define _OPENMP macro,
which has value in format yyyymm, where yyyy is the year of the standard
and mm is the month of the standard. For OpenMP 5.0 this value must be
set to 201811.

Modified:
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/test/OpenMP/driver.c
    cfe/trunk/test/OpenMP/predefined_macro.c

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=368170&r1=368169&r2=368170&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Aug  7 07:02:11 2019
@@ -1038,6 +1038,9 @@ static void InitializePredefinedMacros(c
     case 45:
       Builder.defineMacro("_OPENMP", "201511");
       break;
+    case 50:
+      Builder.defineMacro("_OPENMP", "201811");
+      break;
     default:
       // Default version is OpenMP 3.1
       Builder.defineMacro("_OPENMP", "201107");

Modified: cfe/trunk/test/OpenMP/driver.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/driver.c?rev=368170&r1=368169&r2=368170&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/driver.c (original)
+++ cfe/trunk/test/OpenMP/driver.c Wed Aug  7 07:02:11 2019
@@ -28,6 +28,9 @@
 // CHECK-45-VERSION: #define _OPENMP 201511
 // CHECK-45-VERSION2: #define _OPENMP 201511
 
+// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=50 | FileCheck --check-prefix=CHECK-50-VERSION %s
+// CHECK-50-VERSION: #define _OPENMP 201811
+
 // RUN: %clang %s -c -E -dM -fopenmp-version=1 | FileCheck --check-prefix=CHECK-VERSION %s
 // RUN: %clang %s -c -E -dM -fopenmp-version=31 | FileCheck --check-prefix=CHECK-VERSION %s
 // RUN: %clang %s -c -E -dM -fopenmp-version=40 | FileCheck --check-prefix=CHECK-VERSION %s

Modified: cfe/trunk/test/OpenMP/predefined_macro.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/predefined_macro.c?rev=368170&r1=368169&r2=368170&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/predefined_macro.c (original)
+++ cfe/trunk/test/OpenMP/predefined_macro.c Wed Aug  7 07:02:11 2019
@@ -3,6 +3,7 @@
 
 // RUN: %clang_cc1 -fopenmp-simd -verify -o - %s
 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -verify -o - %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -verify -o - %s
 // expected-no-diagnostics
 #ifdef FOPENMP
 // -fopenmp option is specified




More information about the cfe-commits mailing list