Skip to content

Commit 5af7a3d

Browse files
committed
dfbdc6f: refactor: moved compat macros to supp/dag_compatibility_defines_*.h
1 parent d85ee6b commit 5af7a3d

16 files changed

Lines changed: 66 additions & 73 deletions

prog/_jBuild/_scripts/gen_es.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def is_es_name(name):
3232
is64bit = False
3333
isPs4 = False
3434
isPs5 = False
35-
clang_defines = ['-Dstricmp=strcasecmp',
36-
'-D__forceinline=inline',
37-
'-DSEH_DISABLED', '-D_WINSOCK_DEPRECATED_NO_WARNINGS',
35+
clang_defines = ['-DSEH_DISABLED', '-D_WINSOCK_DEPRECATED_NO_WARNINGS',
3836
'-D_HAS_CHAR16_T_LANGUAGE_SUPPORT', '-D_CRT_SECURE_NO_WARNINGS', '-D_CRTRESTRICT', '-D_CRTNOALIAS',
3937
'-DNOMINMAX', '-D_MSC_EXTENSIONS']
4038
# '-D__int64="long long"', '-D"_int64=long long"',

prog/_jBuild/android/clang-sets.jam

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,18 @@ local _DEF_COM_CMDLINE =
7070
-resource-dir "$(_A_NDK_DIR)/toolchains/llvm/prebuilt/$(_A_NDK_PREBUILT_SUFFIX)/$(_AndroidClangLibFolder)/clang/$(_AndroidClangVer)"
7171
-isystem $(_A_NDK_DIR)/sources/cxx-stl/llvm-libc++/include
7272
-isystem $(_A_NDK_DIR)/sources/cxx-stl/llvm-libc++abi/include
73-
-D__ANDROID_API__=$(AndroidApiMinVer)
7473
-Werror -Wno-trigraphs -Wno-multichar -Wno-pointer-sign -Wno-varargs
7574
-Wno-deprecated-register -Wno-null-dereference -Wno-unused-value
7675
-Wno-constant-conversion -Wno-pointer-bool-conversion -Wno-nullability-completeness
7776
-Wno-inconsistent-missing-override -Wno-c++17-compat-mangling
7877
-Wno-nonportable-include-path
79-
-DANDROID_NDK -DANDROID -D__ANDROID__ -D__ARM_EABI__
8078
-fno-strict-aliasing #-fno-omit-frame-pointer -fno-short-enums
8179
-fpic -fstack-protector
8280
-ffunction-sections -fno-data-sections
8381
-ffast-math -ffinite-math-only -mrecip=none
84-
"\"-D__forceinline=inline __attribute__((always_inline))\"" -D__cdecl= -D__stdcall= -D__fastcall=
85-
-D_TARGET_ANDROID
86-
-D_TARGET_STATIC_LIB
87-
-D_snprintf=snprintf
88-
-D_vsnprintf=vsnprintf
89-
-Dstricmp=strcasecmp
90-
-Dstrnicmp=strncasecmp
91-
-Dstrcpy_s=strcpy
92-
-D_countof=countof
82+
-D_TARGET_ANDROID -D_TARGET_STATIC_LIB
83+
-DANDROID_NDK -DANDROID -D__ANDROID__ -D__ARM_EABI__
84+
-D__ANDROID_API__=$(AndroidApiMinVer)
9385
;
9486

9587
if $(ClangThreadSafety) = yes {
@@ -184,8 +176,16 @@ _INCLUDE =
184176
;
185177

186178
# make compiler cmd-line ###
187-
_CPP_BASE_INCLUDES = "-iwithprefix "$(MasterPreInclude) "-I "$(MasterPreInclude) -isystem $(Root)/prog/dagorInclude "-I "$(Root)/prog/1stPartyLibs "-I "$(Root)/prog/3rdPartyLibs/eastl/include ;
188-
_C_BASE_INCLUDES = "-iwithprefix "$(MasterPreInclude) "-I "$(MasterPreInclude) -isystem $(Root)/prog/dagorInclude "-I "$(Root)/prog/1stPartyLibs ;
179+
_CPP_BASE_INCLUDES =
180+
"-iwithprefix "$(MasterPreInclude) "-I "$(MasterPreInclude)
181+
-isystem $(Root)/prog/dagorInclude -include supp/dag_compatibility_defines_android.h
182+
"-I "$(Root)/prog/1stPartyLibs "-I "$(Root)/prog/3rdPartyLibs/eastl/include
183+
;
184+
_C_BASE_INCLUDES =
185+
"-iwithprefix "$(MasterPreInclude) "-I "$(MasterPreInclude)
186+
-isystem $(Root)/prog/dagorInclude -include supp/dag_compatibility_defines_android.h
187+
"-I "$(Root)/prog/1stPartyLibs
188+
;
189189

190190
# _CPP_BASE_INCLUDES +=
191191
# -I $(_A_NDK_DIR)/sources/cxx-stl/llvm-libc++/include

prog/_jBuild/iOS/clang-sets.jam

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ local _DEF_COM_CMDLINE =
1818
-Wno-nan-infinity-disabled
1919
-ffunction-sections -fdata-sections
2020
-ffast-math -ffinite-math-only -mrecip=none
21-
"\"-D__forceinline=inline __attribute__((always_inline))\"" -D__cdecl= -D__stdcall= -D__fastcall
22-
-D_snprintf=snprintf
23-
-D_vsnprintf=vsnprintf
24-
-Dstricmp=strcasecmp
25-
-Dstrnicmp=strncasecmp
2621
-D_TARGET_APPLE=2 -D_TARGET_IOS -D_TARGET_STATIC_LIB
2722
-D__APPLE_IOS__ -DARM_NEON_GCC_COMPATIBILITY
2823
;
@@ -104,6 +99,8 @@ for inc in $(_INCLUDE) {
10499
_CPP_BASE_INCLUDES += -I $(inc) ;
105100
_C_BASE_INCLUDES += -I $(inc) ;
106101
}
102+
_CPP_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
103+
_C_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
107104

108105
_DEF_C_CMDLINE = ;
109106

prog/_jBuild/linux/clang-sets.jam

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,9 @@ local _DEF_COM_CMDLINE =
1414
-ffunction-sections -fdata-sections -fno-omit-frame-pointer
1515
-ffast-math -ffinite-math-only -mrecip=none -minline-all-stringops
1616
-fdiagnostics-absolute-paths
17-
"\"-D__forceinline=inline __attribute__((always_inline))\"" -D__cdecl= -D__stdcall= -D__fastcall=
18-
-D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE
19-
-D_snprintf=snprintf
20-
-D_vsnprintf=vsnprintf
21-
-Dstricmp=strcasecmp
22-
-Dstrnicmp=strncasecmp
23-
-D_TARGET_PC=3 -D_TARGET_PC_LINUX=3
24-
-D_TARGET_64BIT
25-
-D_TARGET_ARCH_X86_64
17+
-D_TARGET_PC=3 -D_TARGET_PC_LINUX=3 -D_TARGET_64BIT -D_TARGET_ARCH_X86_64 -D_TARGET_SIMD_SSE=$(SSEVersion)
2618
-D__LINUX__=64
27-
-D_TARGET_SIMD_SSE=$(SSEVersion)
28-
-D__STDC_CONSTANT_MACROS
19+
-D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
2920
;
3021

3122
if $(ClangThreadSafety) = yes {
@@ -101,5 +92,7 @@ for inc in $(_INCLUDE) {
10192
_CPP_BASE_INCLUDES += -I $(inc) ;
10293
_C_BASE_INCLUDES += -I $(inc) ;
10394
}
95+
_CPP_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
96+
_C_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
10497

10598
_DEF_C_CMDLINE = ;

prog/_jBuild/linux/gcc-sets.jam

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,9 @@ local _DEF_COM_CMDLINE =
1313
-Wno-deprecated-declarations # e.g. auto_ptr<>
1414
-Wno-maybe-uninitialized # EASTL's string SSO seems to cause this
1515
-Wno-stringop-overflow -Wno-stringop-overread # too many false-positives
16-
"\"-D__forceinline=inline __attribute__((always_inline))\"" -D__cdecl= -D__stdcall= -D__fastcall=
16+
-D_TARGET_PC=3 -D_TARGET_PC_LINUX=3 -D_TARGET_64BIT -D_TARGET_ARCH_X86_64 -D_TARGET_SIMD_SSE=$(SSEVersion)
1717
-D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE
18-
-D_snprintf=snprintf
19-
-D_vsnprintf=vsnprintf
20-
-Dstricmp=strcasecmp
21-
-Dstrnicmp=strncasecmp
22-
-D_TARGET_PC=3 -D_TARGET_PC_LINUX=3
23-
-D_TARGET_64BIT
24-
-D_TARGET_ARCH_X86_64
2518
-D__LINUX__=64
26-
-D_TARGET_SIMD_SSE=$(SSEVersion)
2719
-D__STDC_CONSTANT_MACROS
2820
;
2921
if $(KernelLinkage) = static { _DEF_COM_CMDLINE += -D_TARGET_STATIC_LIB ; }
@@ -98,5 +90,7 @@ for inc in $(_INCLUDE) {
9890
_CPP_BASE_INCLUDES += -I $(inc) ;
9991
_C_BASE_INCLUDES += -I $(inc) ;
10092
}
93+
_CPP_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
94+
_C_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
10195

10296
_DEF_C_CMDLINE = ;

prog/_jBuild/macOS/clang-sets.jam

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ local _DEF_COM_CMDLINE =
1717
-Wno-nan-infinity-disabled
1818
-ffunction-sections -fdata-sections
1919
-ffast-math -ffinite-math-only -mrecip=none
20-
"\"-D__forceinline=inline __attribute__((always_inline))\"" -D__cdecl= -D__stdcall= -D__fastcall
21-
-D_snprintf=snprintf
22-
-D_vsnprintf=vsnprintf
23-
-Dstricmp=strcasecmp
24-
-Dstrnicmp=strncasecmp
2520
-D_TARGET_PC=2 -D_TARGET_PC_MACOSX=2 -D_TARGET_APPLE=1 -D_TARGET_64BIT
2621
-D__MACOSX__
2722
;
@@ -99,6 +94,8 @@ for inc in $(_INCLUDE) {
9994
_CPP_BASE_INCLUDES += -I $(inc) ;
10095
_C_BASE_INCLUDES += -I $(inc) ;
10196
}
97+
_CPP_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
98+
_C_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
10299

103100
_DEF_C_CMDLINE = ;
104101

prog/_jBuild/tvOS/clang-sets.jam

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ local _DEF_COM_CMDLINE =
1212
-Wno-nan-infinity-disabled
1313
-fembed-bitcode
1414
-ffast-math -ffinite-math-only -mrecip=none
15-
"\"-D__forceinline=inline __attribute__((always_inline))\"" -D__cdecl= -D__stdcall= -D__fastcall
16-
-D_snprintf=snprintf
17-
-D_vsnprintf=vsnprintf
18-
-Dstricmp=strcasecmp
19-
-Dstrnicmp=strncasecmp
20-
-D_TARGET_APPLE=3 -D_TARGET_TVOS
21-
-D_TARGET_STATIC_LIB
15+
-D_TARGET_APPLE=3 -D_TARGET_TVOS -D_TARGET_STATIC_LIB
2216
-D__APPLE_TVOS__ -DARM_NEON_GCC_COMPATIBILITY
2317
;
2418

@@ -96,6 +90,8 @@ for inc in $(_INCLUDE) {
9690
_CPP_BASE_INCLUDES += -I $(inc) ;
9791
_C_BASE_INCLUDES += -I $(inc) ;
9892
}
93+
_CPP_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
94+
_C_BASE_INCLUDES += -include supp/dag_compatibility_defines_posix.h ;
9995

10096
_DEF_C_CMDLINE = ;
10197

prog/_jBuild/windows/clang-sets.jam

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ if ! [ GLOB $(_DEVTOOL)/nasm : * ] { exit FATAL\: \"$(_DEVTOOL)/nasm\" not found
4444

4545
local _DEF_C_CMDLINE =
4646
-fms-compatibility-version=$(_MSC_VER)
47-
-X -D_TARGET_PC=1 -D_TARGET_PC_WIN=1 -Dasm=__asm -DWIN32_LEAN_AND_MEAN= -D_USE_MATH_DEFINES
48-
-DNOMINMAX
49-
-D_TARGET_SIMD_SSE=$(SSEVersion) -D_ALLOW_KEYWORD_MACROS=
47+
-X -D_TARGET_PC=1 -D_TARGET_PC_WIN=1 -D_TARGET_SIMD_SSE=$(SSEVersion)
48+
-DWIN32_LEAN_AND_MEAN= -D_USE_MATH_DEFINES -DNOMINMAX -D_ALLOW_KEYWORD_MACROS=
5049
-D_USING_V110_SDK71_
5150
-DDELAYIMP_INSECURE_WRITABLE_HOOKS
5251
/c /nologo /Zc:forScope /J /Zc:inline

prog/_jBuild/windows/vc10-sets.jam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ switch $(PlatformArch) {
2121
}
2222
if $(BuildDagorEngineIndependentCode) != yes {
2323
_DEF_C_CMDLINE +=
24-
-D_TARGET_PC=1 -D_TARGET_PC_WIN=1 -Dasm=__asm -DWIN32_LEAN_AND_MEAN= -DNOMINMAX
25-
-D_TARGET_SIMD_SSE=$(SSEVersion)
24+
-D_TARGET_PC=1 -D_TARGET_PC_WIN=1 -D_TARGET_SIMD_SSE=$(SSEVersion)
25+
-DWIN32_LEAN_AND_MEAN= -DNOMINMAX
2626
/Zc:forScope /bigobj
2727
;
2828
switch $(PlatformArch) {

prog/_jBuild/windows/vc11-sets.jam

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ _WIN_SDK_TARGET_SUFFIX = x64 ;
1010
include $(Root)/prog/_jBuild/_vc/win_sdk.jam ;
1111

1212
local _DEF_C_CMDLINE =
13-
-X -D_TARGET_PC=1 -D_TARGET_PC_WIN=1 -DWIN64 -Dasm=__asm -DWIN32_LEAN_AND_MEAN=
14-
-DNOMINMAX
15-
-D_TARGET_SIMD_SSE=$(SSEVersion) -D_TARGET_64BIT -D_ALLOW_KEYWORD_MACROS=
13+
-X -D_TARGET_PC=1 -D_TARGET_PC_WIN=1 -DWIN64 -D_TARGET_64BIT -D_TARGET_SIMD_SSE=$(SSEVersion)
14+
-DWIN32_LEAN_AND_MEAN= -DNOMINMAX -D_ALLOW_KEYWORD_MACROS=
1615
/c /nologo /Zc:forScope /Zp8 /J /bigobj /Zc:wchar_t
1716
;
1817
if $(BuildDagorEngineIndependentCode) = yes { _DEF_C_CMDLINE = -X /c /nologo /Zp8 /J /Zc:wchar_t -DWIN64 ; }

0 commit comments

Comments
 (0)