[Openmp-commits] [openmp] [OpenMP] Ignore the error introduced by -Wvla-cxx-extension on ompt-general.cpp. (PR #114583)

Daniel Chen via Openmp-commits openmp-commits at lists.llvm.org
Fri Nov 1 10:51:59 PDT 2024


https://github.com/DanielCChen created https://github.com/llvm/llvm-project/pull/114583

The `openmp` runtime failed to build on LoP with LLVM18 on LoP due to the addition of `-Wvla-cxx-extension` as
```
llvm-project/openmp/runtime/src/ompt-general.cpp:711:15: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
  711 |   int tmp_ids[ids_size];
      |               ^~~~~~~~
llvm-project/openmp/runtime/src/ompt-general.cpp:711:15: note: function parameter 'ids_size' with unknown value cannot be used in a constant expression
llvm-project/openmp/runtime/src/ompt-general.cpp:704:65: note: declared here
  704 | OMPT_API_ROUTINE int ompt_get_place_proc_ids(int place_num, int ids_size,
      |                                                                 ^
1 error generated.
```

This patch is to ignore the checking against this usage.

>From 7f1cd5510e2238fb8535f66c827639f3eb7ab4f5 Mon Sep 17 00:00:00 2001
From: cdchen-ca <cdchen at ca.ibm.com>
Date: Fri, 1 Nov 2024 12:42:26 -0400
Subject: [PATCH] [OpenMP] Ignore the error introduced by -Wvla-cxx-extension
 on ompt-geenral.cpp.

---
 openmp/runtime/src/ompt-general.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp
index 923eea2a563a91..c96bb3153b8a89 100644
--- a/openmp/runtime/src/ompt-general.cpp
+++ b/openmp/runtime/src/ompt-general.cpp
@@ -708,6 +708,9 @@ OMPT_API_ROUTINE int ompt_get_place_proc_ids(int place_num, int ids_size,
   return 0;
 #else
   int i, count;
+#ifdef __clang_major__ >= 18
+#pragma clang diagnostic ignored "-Wvla-cxx-extension"
+#endif
   int tmp_ids[ids_size];
   for (int j = 0; j < ids_size; j++)
     tmp_ids[j] = 0;



More information about the Openmp-commits mailing list