Skip to content

Commit

Permalink
fix compilation error in openai#69
Browse files Browse the repository at this point in the history
Problem:
As mentioned in [this comment](openai#69 (comment)) of openai#69, a compilation crashes due to an error of unused variables on Apple silicon (with clang 14 and possibly 13+). This issue has been reported [elsewhere](ClickHouse/ClickHouse#27705). This seems to be caused by breaking behavior in clang 13 which escalates unused variable from a warning in prior versions to an error.

The solution implemented here:
I add an additional cflags `-Wno-unused-but-set-variable` for apple platforms. 

Tested on macOS 13.3.1 with Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  • Loading branch information
falcondai authored May 3, 2023
1 parent 5e1dbf3 commit 44fa660
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions procgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(APPLE)
# clang defaults to 20 errors, but usually only the first one is useful
add_compile_options(-ferror-limit=1)
# only produce errors on mac where development is done
add_compile_options(-Werror -Wextra -Wshadow -Wall -Wformat=2 -Wundef -Wvla -Wmissing-include-dirs -Wnon-virtual-dtor -Wno-unused-parameter)
add_compile_options(-Werror -Wextra -Wshadow -Wall -Wformat=2 -Wundef -Wvla -Wmissing-include-dirs -Wnon-virtual-dtor -Wno-unused-parameter -Wno-unused-but-set-variable)
endif()

if(MSVC)
Expand Down Expand Up @@ -75,4 +75,4 @@ add_library(env
# find libenv.h header
target_include_directories(env PUBLIC ${LIBENV_DIR})

target_link_libraries(env Qt5::Gui)
target_link_libraries(env Qt5::Gui)

0 comments on commit 44fa660

Please sign in to comment.