[Openmp-commits] [openmp] 38f78dd - [OpenMP][Tools][NFC] Fix C99-style declaration of iteration variables

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Mon Oct 25 09:23:19 PDT 2021


Author: Joachim Protze
Date: 2021-10-25T18:20:12+02:00
New Revision: 38f78dd2e25aa6ae9f9e2ffdef7a600391b791fe

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

LOG: [OpenMP][Tools][NFC] Fix C99-style declaration of iteration variables

Where possible change to declare the variable before the loop.
Where not possible, specifically request -std=c99 (could be limited to
specific compilers like icc).

Added: 
    

Modified: 
    openmp/runtime/test/lit.cfg
    openmp/runtime/test/ompt/callback.h
    openmp/runtime/test/ompt/synchronization/ordered_dependences.c
    openmp/runtime/test/worksharing/for/omp_par_in_loop.c

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg
index dff693fa37cb..c1d240eaa80a 100644
--- a/openmp/runtime/test/lit.cfg
+++ b/openmp/runtime/test/lit.cfg
@@ -115,6 +115,8 @@ if 'INTEL_LICENSE_FILE' in os.environ:
 # substitutions
 config.substitutions.append(("%libomp-compile-and-run", \
     "%libomp-compile && %libomp-run"))
+config.substitutions.append(("%libomp-c99-compile-and-run", \
+    "%libomp-c99-compile && %libomp-run"))
 config.substitutions.append(("%libomp-cxx-compile-and-run", \
     "%libomp-cxx-compile && %libomp-run"))
 config.substitutions.append(("%libomp-cxx-compile-c", \
@@ -123,6 +125,8 @@ config.substitutions.append(("%libomp-cxx-compile", \
     "%clangXX %openmp_flags %flags -std=c++14 %s -o %t" + libs))
 config.substitutions.append(("%libomp-compile", \
     "%clang %openmp_flags %flags %s -o %t" + libs))
+config.substitutions.append(("%libomp-c99-compile", \
+    "%clang %openmp_flags %flags -std=c99 %s -o %t" + libs))
 config.substitutions.append(("%libomp-run", "%t"))
 config.substitutions.append(("%clangXX", config.test_cxx_compiler))
 config.substitutions.append(("%clang", config.test_c_compiler))

diff  --git a/openmp/runtime/test/ompt/callback.h b/openmp/runtime/test/ompt/callback.h
index 2e9c057e9fd4..2abab37fcfc4 100644
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -1033,7 +1033,8 @@ on_ompt_callback_dependences(
 {
   char buffer[2048];
   char *progress = buffer;
-  for (int i = 0; i < ndeps && progress < buffer + 2000; i++) {
+  int i;
+  for (i = 0; i < ndeps && progress < buffer + 2000; i++) {
     if (deps[i].dependence_type == ompt_dependence_type_source ||
         deps[i].dependence_type == ompt_dependence_type_sink)
       progress +=

diff  --git a/openmp/runtime/test/ompt/synchronization/ordered_dependences.c b/openmp/runtime/test/ompt/synchronization/ordered_dependences.c
index c3c64712e5e9..5b7d56599f0e 100644
--- a/openmp/runtime/test/ompt/synchronization/ordered_dependences.c
+++ b/openmp/runtime/test/ompt/synchronization/ordered_dependences.c
@@ -1,4 +1,4 @@
-// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
+// RUN: %libomp-c99-compile-and-run | %sort-threads | FileCheck %s
 // REQUIRES: ompt
 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
 #include "callback.h"

diff  --git a/openmp/runtime/test/worksharing/for/omp_par_in_loop.c b/openmp/runtime/test/worksharing/for/omp_par_in_loop.c
index d80de5da10f6..6074c45e59a5 100644
--- a/openmp/runtime/test/worksharing/for/omp_par_in_loop.c
+++ b/openmp/runtime/test/worksharing/for/omp_par_in_loop.c
@@ -1,4 +1,4 @@
-// RUN: %libomp-compile-and-run
+// RUN: %libomp-c99-compile-and-run
 //
 #include <stdlib.h>
 #include <stdio.h>


        


More information about the Openmp-commits mailing list