]> granicus.if.org Git - clang/commitdiff
[OPENMP]Add standard macro value _OPENMP for OpenMP 5.0.
authorAlexey Bataev <a.bataev@hotmail.com>
Wed, 7 Aug 2019 14:02:11 +0000 (14:02 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Wed, 7 Aug 2019 14:02:11 +0000 (14:02 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368170 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/OpenMP/driver.c
test/OpenMP/predefined_macro.c

index 3906e2ae1b9855756ac9cde99d3d4aba67095bfd..79b5395372fd354ea5396111bc33f6ecaef76dd9 100644 (file)
@@ -1038,6 +1038,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
     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");
index 4c8b1df538ea1d6fd89378b31a13db30c917802f..58d5538e64f2bb0ecef9279cae3e5a86ca61f4c5 100644 (file)
@@ -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
index b27b32b561fd51605768cfea93686f63b80bf6e9..c9722d596d4d68466e3bf94fa75003035ede87dd 100644 (file)
@@ -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