Skip to content

Address TODO to unblock master-next. #505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include(CheckCCompilerFlag)

include(SwiftSupport)
include(DTrace)
Expand Down Expand Up @@ -229,11 +230,11 @@ if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
PRIVATE
-Xclang -fblocks)
else()
# FIXME(compnerd) add check for -momit-leaf-frame-pointer?
target_compile_options(dispatch
PRIVATE
-fblocks
-momit-leaf-frame-pointer)
check_c_compiler_flag("-momit-leaf-frame-pointer -Werror -Wall -O3" C_SUPPORTS_OMIT_LEAF_FRAME_POINTER)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Werror -Wall -O3 is not required when using check_c_compiler_flag. See the documentation at https://cmake.org/cmake/help/latest/module/CheckCCompilerFlag.html.

I think that we should just do two target_compile_options calls here.

check_c_compile_flag("-momit-leaf-frame-pointer" CC_SUPPORTS_MOMIT_LEAF_FRAME_POINTER)
target_compile_options(dispatch PRIVATE -fblocks)
if(CC_SUPPORTS_MOMIT_LEAF_FRAME_POINTER)
  target_compile_options(dispatch PRIVATE -momit-leaf-frame-pointer)
endif()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check_c_compiler_flag just runs the compilation command with the provided flag. Unfortunately, clang will only complain with this combination of flags.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blah, that is annoying.

target_compile_options(dispatch PRIVATE -fblocks)
if (C_SUPPORTS_OMIT_LEAF_FRAME_POINTER)
target_compile_options(dispatch PRIVATE -momit-leaf-frame-pointer)
endif()
endif()
if(LibRT_FOUND)
target_link_libraries(dispatch PRIVATE RT::rt)
Expand Down