[clang] 543ffb4 - [OPENMP]Reorganize OpenMP warning groups.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 6 10:33:51 PST 2019


Author: Alexey Bataev
Date: 2019-12-06T13:31:02-05:00
New Revision: 543ffb4a2d6435004f7e41f2b3d9040aeb3e78ef

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

LOG: [OPENMP]Reorganize OpenMP warning groups.

openmp-mapping group is a subgroup of openmp-target warning group. Also,
added global openmp group to control all other OpenMP warning groups.

Added: 
    

Modified: 
    clang/include/clang/Basic/DiagnosticGroups.td
    clang/include/clang/Basic/DiagnosticSemaKinds.td
    clang/test/OpenMP/nesting_of_regions.cpp
    clang/test/OpenMP/simd_aligned_messages.cpp
    clang/test/OpenMP/simd_loop_messages.cpp
    clang/test/OpenMP/target_map_messages.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index dec293f45af7..e999ba10a003 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1057,7 +1057,11 @@ def ASM : DiagGroup<"asm", [
 def SourceUsesOpenMP : DiagGroup<"source-uses-openmp">;
 def OpenMPClauses : DiagGroup<"openmp-clauses">;
 def OpenMPLoopForm : DiagGroup<"openmp-loop-form">;
-def OpenMPTarget : DiagGroup<"openmp-target">;
+def OpenMPMapping : DiagGroup<"openmp-mapping">;
+def OpenMPTarget : DiagGroup<"openmp-target", [OpenMPMapping]>;
+def OpenMP : DiagGroup<"openmp", [
+    SourceUsesOpenMP, OpenMPClauses, OpenMPLoopForm, OpenMPTarget, OpenMPMapping
+  ]>;
 
 // Backend warnings.
 def BackendInlineAsm : DiagGroup<"inline-asm">;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 61dfd548e120..a2e4cf51232b 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9577,7 +9577,7 @@ def err_omp_linear_distribute_var_non_loop_iteration : Error<
   "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
 def warn_omp_non_trivial_type_mapped : Warning<
   "Non-trivial type %0 is mapped, only trivial types are guaranteed to be mapped correctly">,
-  InGroup<DiagGroup<"openmp-mapping">>;
+  InGroup<OpenMPMapping>;
 def err_omp_requires_clause_redeclaration : Error <
   "Only one %0 clause can appear on a requires directive in a single translation unit">;
 def note_omp_requires_previous_clause : Note <

diff  --git a/clang/test/OpenMP/nesting_of_regions.cpp b/clang/test/OpenMP/nesting_of_regions.cpp
index d80a06a8476b..ac9ed96eb94c 100644
--- a/clang/test/OpenMP/nesting_of_regions.cpp
+++ b/clang/test/OpenMP/nesting_of_regions.cpp
@@ -1,7 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify=expected,omp45 %s
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify=expected,omp45,omp45warn %s
 // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 -Wno-openmp %s
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 -Wno-source-uses-openmp %s
 
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify=expected,omp45 %s
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify=expected,omp45,omp45warn %s
 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s
 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
 
@@ -234,7 +236,7 @@ void foo() {
   }
 #pragma omp simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -763,7 +765,7 @@ void foo() {
   }
 #pragma omp for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -2726,7 +2728,7 @@ void foo() {
   }
 #pragma omp parallel for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -6226,7 +6228,7 @@ void foo() {
 #pragma omp teams
 #pragma omp distribute parallel for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -6538,7 +6540,7 @@ void foo() {
   }
 #pragma omp target simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -7314,7 +7316,7 @@ void foo() {
 #pragma omp target
 #pragma omp teams distribute simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -7597,7 +7599,7 @@ void foo() {
 #pragma omp target
 #pragma omp teams distribute parallel for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -8866,7 +8868,7 @@ void foo() {
   }
 #pragma omp target teams distribute parallel for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -9109,7 +9111,7 @@ void foo() {
   }
 #pragma omp target teams distribute simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -9552,7 +9554,7 @@ void foo() {
   }
 #pragma omp simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -10042,7 +10044,7 @@ void foo() {
   }
 #pragma omp for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -11923,7 +11925,7 @@ void foo() {
   }
 #pragma omp parallel for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -14869,7 +14871,7 @@ void foo() {
 #pragma omp teams
 #pragma omp distribute parallel for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -15181,7 +15183,7 @@ void foo() {
 #pragma omp teams
 #pragma omp distribute simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -15485,7 +15487,7 @@ void foo() {
   }
 #pragma omp target simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -16009,7 +16011,7 @@ void foo() {
 #pragma omp target
 #pragma omp teams distribute simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -16292,7 +16294,7 @@ void foo() {
 #pragma omp target
 #pragma omp teams distribute parallel for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -17561,7 +17563,7 @@ void foo() {
   }
 #pragma omp target teams distribute parallel for simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }
@@ -17804,7 +17806,7 @@ void foo() {
   }
 #pragma omp target teams distribute simd
   for (int i = 0; i < 10; ++i) {
-#pragma omp simd // omp45-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
+#pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
     for (int i = 0; i < 10; ++i)
       ;
   }

diff  --git a/clang/test/OpenMP/simd_aligned_messages.cpp b/clang/test/OpenMP/simd_aligned_messages.cpp
index 44679b3373ae..8b5edb81d7fb 100644
--- a/clang/test/OpenMP/simd_aligned_messages.cpp
+++ b/clang/test/OpenMP/simd_aligned_messages.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp %s -Wuninitialized
+// RUN: %clang_cc1 -x c++ -std=c++11 -verify=expected,expectedw -fopenmp %s -Wuninitialized
+// RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp %s -Wuninitialized -Wno-openmp-clauses
+// RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp %s -Wuninitialized -Wno-openmp
 
-// RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp-simd %s -Wuninitialized
+// RUN: %clang_cc1 -x c++ -std=c++11 -verify=expected,expectedw -fopenmp-simd %s -Wuninitialized
 
 struct B {
   static int ib[20]; // expected-note 0 {{'B::ib' declared here}}
@@ -41,7 +43,7 @@ void test_aligned_colons(int *&rp)
   // expected-error at +1 {{expected variable name}}
   #pragma omp simd aligned(B::bfoo())
   for (int i = 0; i < 10; ++i) ;
-  // expected-warning at +1 {{aligned clause will be ignored because the requested alignment is not a power of 2}}
+  // expectedw-warning at +1 {{aligned clause will be ignored because the requested alignment is not a power of 2}}
   #pragma omp simd aligned(B::ib,B:C1+C2)
   for (int i = 0; i < 10; ++i) ;
 }
@@ -125,7 +127,7 @@ template<class I, class C> int foomain(I argc, C **argv) {
 // FIXME: Should argc really be a pointer?
   #pragma omp simd aligned (*argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
   for (I k = 0; k < argc; ++k) ++k;
-  #pragma omp simd aligned (argc : 5) // expected-warning {{aligned clause will be ignored because the requested alignment is not a power of 2}}
+  #pragma omp simd aligned (argc : 5) // expectedw-warning {{aligned clause will be ignored because the requested alignment is not a power of 2}}
   for (I k = 0; k < argc; ++k) ++k;
   #pragma omp simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
   for (I k = 0; k < argc; ++k) ++k;

diff  --git a/clang/test/OpenMP/simd_loop_messages.cpp b/clang/test/OpenMP/simd_loop_messages.cpp
index 5a98be537615..d90599168282 100644
--- a/clang/test/OpenMP/simd_loop_messages.cpp
+++ b/clang/test/OpenMP/simd_loop_messages.cpp
@@ -1,7 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp5 %s -fopenmp-version=50 -DOMP50 -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp5 %s -fopenmp-version=50 -DOMP50 -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4,expectedw %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4,expectedw %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp5,expectedw %s -fopenmp-version=50 -DOMP50 -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp5,expectedw %s -fopenmp-version=50 -DOMP50 -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4 %s -Wuninitialized -Wno-openmp-loop-form
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4 %s -Wuninitialized -Wno-openmp
 
 static int sii;
 // expected-note at +1 {{defined as threadprivate or thread local}}
@@ -318,7 +320,7 @@ int test_iteration_spaces() {
   for (int (*p)[4] = lb; p < lb + 8; ++p) {
   }
 
-  // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
+  // expectedw-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
   #pragma omp simd
   for (int a{0}; a<10; ++a) {
   }
@@ -399,19 +401,19 @@ int test_with_random_access_iterator() {
   #pragma omp simd
   for (GoodIter I = begin; I >= end; --I)
     ++I;
-  // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
+  // expectedw-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
   #pragma omp simd
   for (GoodIter I(begin); I < end; ++I)
     ++I;
-  // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
+  // expectedw-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
   #pragma omp simd
   for (GoodIter I(nullptr); I < end; ++I)
     ++I;
-  // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
+  // expectedw-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
   #pragma omp simd
   for (GoodIter I(0); I < end; ++I)
     ++I;
-  // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
+  // expectedw-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
   #pragma omp simd
   for (GoodIter I(1,2); I < end; ++I)
     ++I;
@@ -466,7 +468,7 @@ int test_with_random_access_iterator() {
     ++I;
 
   // Initializer is constructor without params.
-  // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
+  // expectedw-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
   #pragma omp simd
   for (Iter0 I; I < end0; ++I)
     ++I;
@@ -486,7 +488,7 @@ int test_with_random_access_iterator() {
   // Initializer is constructor with all default params.
   // expected-error at +4 {{invalid operands to binary expression ('Iter1' and 'float')}}
   // expected-error at +3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
-  // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
+  // expectedw-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
   #pragma omp simd
   for (Iter1 I; I < end1; ++I) {
   }

diff  --git a/clang/test/OpenMP/target_map_messages.cpp b/clang/test/OpenMP/target_map_messages.cpp
index e8fba3bd8985..486a4de4bdd4 100644
--- a/clang/test/OpenMP/target_map_messages.cpp
+++ b/clang/test/OpenMP/target_map_messages.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized
-// RUN: %clang_cc1 -DCCODE -verify -fopenmp -ferror-limit 200 -x c %s -Wno-openmp-mapping -Wuninitialized
+// RUN: %clang_cc1 -DCCODE -verify -fopenmp -ferror-limit 200 -x c %s -Wno-openmp -Wuninitialized
 
-// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized
+// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 200 %s -Wno-openmp-target -Wuninitialized
 // RUN: %clang_cc1 -DCCODE -verify -fopenmp-simd -ferror-limit 200 -x c %s -Wno-openmp-mapping -Wuninitialized
 #ifdef CCODE
 void foo(int arg) {


        


More information about the cfe-commits mailing list