Skip to content

Commit e5b7b11

Browse files
committed
PR feedback
1 parent 5460cef commit e5b7b11

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

CMakeLists.txt

+20
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,26 @@ int main(int argc, char *argv[]) {
7474
if(HAVE_MKSTEMP)
7575
add_compile_definitions(HAVE_MKSTEMP)
7676
endif()
77+
78+
check_c_source_compiles([=[
79+
#include <sys/types.h>
80+
int main(int argc, char *argv[]) {
81+
mode_t mode;
82+
}
83+
]=] HAVE_MODE_T)
84+
if(HAVE_MODE_T)
85+
add_compile_definitions(HAVE_MODE_T)
86+
endif()
87+
88+
check_c_source_compiles([=[
89+
#include <sys/types.h>
90+
int main(int argc, char *argv[]) {
91+
pid_t mode;
92+
}
93+
]=] HAVE_PID_T)
94+
if(HAVE_PID_T)
95+
add_compile_definitions(HAVE_PID_T)
96+
endif()
7797
endif()
7898

7999
set(CMAKE_C_STANDARD 11)

cmake/modules/DispatchCompilerWarnings.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

2-
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC" OR MINGW)
2+
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
33
# TODO: someone needs to provide the msvc equivalent warning flags
4-
# -fms-extensions will enable __popcnt64
4+
elseif(WIN32)
5+
# Tareting Windows but using a non-MSVC compiler. Set -fms-extensions
6+
# so that we can use __popcnt64
57
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fms-extensions>)
68
else()
79
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror>)

os/generic_win_base.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
// Unices provide `howmany` via sys/param.h
2525
#define howmany(x, y) (((x) + ((y) - 1)) / (y))
2626

27-
#ifndef _MODE_T_
28-
#define _MODE_T_
27+
#ifndef HAVE_MODE_T
2928
typedef int mode_t;
3029
#endif
3130
typedef void pthread_attr_t;

tests/generic_win_port.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <Windows.h>
88

99
typedef int kern_return_t;
10-
#ifndef _PID_T_
10+
#ifndef HAVE_PID_T
1111
typedef int pid_t;
1212
#endif
1313

0 commit comments

Comments
 (0)