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

via Openmp-commits openmp-commits at lists.llvm.org
Fri Nov 1 10:52:21 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-openmp

Author: Daniel Chen (DanielCChen)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/114583.diff


1 Files Affected:

- (modified) openmp/runtime/src/ompt-general.cpp (+3) 


``````````diff
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;

``````````

</details>


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


More information about the Openmp-commits mailing list