Commit 09c6944
Fix 5 instances of -Wvla-cxx-extension
Summary:
While Clang (and GCC) supports the usage of Variable Length Arrays (VLA) in C++,
they are not part of the standard. In Clang 19 a warning is issued for the
usages of VLA in C++, to indicate that the feature is not standard and will
cause compatibility problems. When -Werror is used, the warning becomes a
fatal error and compilation will fail. Besides that, the usage of VLA can
increase the stack requirements of the functions that use them, and in C++
one can use standard containers for the same effect without the warning or
the huge stack allocations.
The VLA are transformed into usages of `std::vector` or `std::string` were
appropiate, and in a couple of cases, a `sizeof` of a VLA is transformed into
a `sizeof` of the base type multiplied by the VLA count.
The fatal error was suppressed globally as part of the Pika 16.3 upgrade, but
we are removing the toolchain suppression in D89382996 to try to avoid more
instances of the problem, and these were some instances found during testing.
Differential Revision: D89714003
fbshipit-source-id: 87e5b20f3a4909b4b8708ea0961184d2823eab9f1 parent 9ef6778 commit 09c6944
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| |||
0 commit comments