Skip to content
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

Prefer ucontext.h over sys/ucontext.h #46790

Merged
merged 3 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ elseif(CLR_CMAKE_HOST_SUNOS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
add_definitions(-D__EXTENSIONS__)
elseif(CLR_CMAKE_HOST_OSX)
add_definitions(-D_XOPEN_SOURCE)
am11 marked this conversation as resolved.
Show resolved Hide resolved
endif()

#------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/clrdefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ endif (CLR_CMAKE_TARGET_ARCH_ARM64)

if (CLR_CMAKE_TARGET_UNIX)

if(CLR_CMAKE_TARGET_OSX)
add_definitions(-D_XOPEN_SOURCE)
endif(CLR_CMAKE_TARGET_OSX)

if (CLR_CMAKE_TARGET_ARCH_AMD64)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:UNIX_AMD64_ABI>)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:FEATURE_MULTIREG_RETURN>)
Expand Down
5 changes: 1 addition & 4 deletions src/coreclr/pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ if(CLR_CMAKE_TARGET_OSX)
${LIBUNWIND_DAC_OBJECTS}
)

target_compile_definitions(coreclrpal_dac PUBLIC
"-D_XOPEN_SOURCE"
"-DUNW_REMOTE_ONLY"
)
target_compile_definitions(coreclrpal_dac PUBLIC -DUNW_REMOTE_ONLY)
else()
if(NOT FEATURE_CROSSBITNESS)
add_library(coreclrpal_dac STATIC
Expand Down
7 changes: 5 additions & 2 deletions src/coreclr/pal/src/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ if(CLR_CMAKE_TARGET_FREEBSD)
elseif(CLR_CMAKE_TARGET_SUNOS)
set(CMAKE_REQUIRED_INCLUDES /opt/local/include)
endif()
if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_FREEBSD AND NOT CLR_CMAKE_TARGET_NETBSD)

if(CLR_CMAKE_TARGET_OSX)
set(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE)
elseif(NOT CLR_CMAKE_TARGET_FREEBSD AND NOT CLR_CMAKE_TARGET_NETBSD)
set(CMAKE_REQUIRED_DEFINITIONS "-D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L")
endif()

Expand Down Expand Up @@ -156,7 +159,7 @@ check_type_size("struct pt_regs" PT_REGS)
set(CMAKE_EXTRA_INCLUDE_FILES)
set(CMAKE_EXTRA_INCLUDE_FILES signal.h)
set(CMAKE_EXTRA_INCLUDE_FILES)
set(CMAKE_EXTRA_INCLUDE_FILES sys/ucontext.h)
set(CMAKE_EXTRA_INCLUDE_FILES ucontext.h)
check_type_size(ucontext_t UCONTEXT_T)
set(CMAKE_EXTRA_INCLUDE_FILES)
set(CMAKE_EXTRA_INCLUDE_FILES pthread.h)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/pal/src/include/pal/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C"
/* A type to wrap the native context type, which is ucontext_t on some
* platforms and another type elsewhere. */
#if HAVE_UCONTEXT_T
#include <sys/ucontext.h>
#include <ucontext.h>

typedef ucontext_t native_context_t;
#else // HAVE_UCONTEXT_T
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/pal/src/libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ if(CLR_CMAKE_HOST_UNIX)
endif()

if (CLR_CMAKE_HOST_OSX)
add_definitions(-D_XOPEN_SOURCE)
add_definitions(-DUNW_REMOTE_ONLY)
add_definitions(-D__APPLE__)
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for noticing this extra definition of __APPLE__

add_compile_options(-Wno-sometimes-uninitialized)
add_compile_options(-Wno-implicit-function-declaration)

Expand Down

This file was deleted.