Skip to content

Commit

Permalink
Silence MetaModelica string warnings from GCC (#11983)
Browse files Browse the repository at this point in the history
- Disable the `stringop-overread` warnings from GCC in the CMake build
  caused by the way MetaModelica implements strings.
  • Loading branch information
perost committed Feb 13, 2024
1 parent b2dadf2 commit 5a46eec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions OMCompiler/Compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Ap
target_compile_options(OpenModelicaCompiler PRIVATE -Wno-parentheses-equality)
endif()

# Silence GCC warnings about invalid reads of MetaModelica strings.
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(OpenModelicaCompiler PRIVATE -Wno-stringop-overread)
endif()

# There is a lonely omc_file.h in Util/. It belongs in runtime/. Remove this when it is moved.
target_include_directories(OpenModelicaCompiler PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Util)

Expand Down
5 changes: 5 additions & 0 deletions OMCompiler/Compiler/boot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Ap
target_compile_options(bomc PRIVATE -Wno-parentheses-equality)
endif()

# Silence GCC warnings about invalid reads of MetaModelica strings.
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(bomc PRIVATE -Wno-stringop-overread)
endif()

# OMC will overflow the stack (at least on Windows old OMDev) on very deep recursive calls.
# E.g., try translating the CodegenCpp* tpl files to mo files with
# an omc compiled without large stack size. The tpl parser is quite recursive and will
Expand Down

0 comments on commit 5a46eec

Please sign in to comment.