CMake: disallow variable-length-array

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-06-27 12:52:28 +00:00
committed by Compute-Runtime-Automation
parent 09d160910d
commit 4ee27f11c0
2 changed files with 4 additions and 4 deletions

View File

@ -688,7 +688,7 @@ if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type") # Added for gtest
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=vla")
if(USE_SANITIZE_UB)
check_cxx_compiler_flag(-fsanitize=undefined COMPILER_SUPPORTS_UNDEFINED_BEHAVIOR_SANITIZER)

View File

@ -825,9 +825,9 @@ void testSysmanFirmware(ze_device_handle_t &device, std::string imagePath) {
std::cout << "firmware version = " << fwProperties.version << std::endl;
}
if (imagePath.size() != 0 && imgSize > 0) {
char img[imgSize];
imageFile.read(img, imgSize);
VALIDATECALL(zesFirmwareFlash(handle, img, static_cast<uint32_t>(imgSize)));
std::vector<char> img(imgSize);
imageFile.read(img.data(), imgSize);
VALIDATECALL(zesFirmwareFlash(handle, img.data(), static_cast<uint32_t>(imgSize)));
VALIDATECALL(zesFirmwareGetProperties(handle, &fwProperties));
if (verbose) {