From b28bbd65add8ba95badb04d8553b9cf311996d82 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 10 Sep 2023 05:53:22 +0100 Subject: [PATCH] Fix some compilation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` data_file_test.cpp:37:20: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 37 | if (!result.endOfFile()) | ^ ``` ``` Source/engine/render/dun_render.cpp:1126:6: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 1126 | void RenderTile(const Surface &out, Point position, ``` --- Source/CMakeLists.txt | 4 +++- test/data_file_test.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 815681362..26af60113 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -178,7 +178,9 @@ set(_optimize_in_debug_srcs utils/cel_to_clx.cpp utils/cl2_to_clx.cpp utils/pcx_to_clx.cpp) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND CMAKE_BUILD_TYPE STREQUAL "Debug") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_BUILD_TYPE STREQUAL "Debug") + set_source_files_properties(${_optimize_in_debug_srcs} PROPERTIES COMPILE_OPTIONS "-O2;--param=max-vartrack-size=900000000") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_BUILD_TYPE STREQUAL "Debug") set_source_files_properties(${_optimize_in_debug_srcs} PROPERTIES COMPILE_OPTIONS "-O2") endif() diff --git a/test/data_file_test.cpp b/test/data_file_test.cpp index 720586d4b..357148693 100644 --- a/test/data_file_test.cpp +++ b/test/data_file_test.cpp @@ -34,8 +34,9 @@ void TestFileContents( EXPECT_EQ(result.value, expectedContent[row][col]) << "Unexpected value at record " << row << " and field " << col; col++; } while (!result.endOfRecord()); - if (!result.endOfFile()) + if (!result.endOfFile()) { EXPECT_EQ(result.status, expectedEndOfRecordStatus) << "Unexpected status when parsing the end of record " << row; + } EXPECT_EQ(col, expectedContent[row].size()) << "Parsing returned fewer fields than expected in record " << row; row++;