[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).
This commit is contained in:
Joachim Protze 2021-10-25 15:27:38 +02:00
parent d29a7d23ec
commit 38f78dd2e2
4 changed files with 8 additions and 3 deletions

View File

@ -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))

View File

@ -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 +=

View File

@ -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"

View File

@ -1,4 +1,4 @@
// RUN: %libomp-compile-and-run
// RUN: %libomp-c99-compile-and-run
//
#include <stdlib.h>
#include <stdio.h>