[REACTOS] Improve handling of non-standard names

- Link oldnames instead of defining names
- Define _CRT_DECLARE_NONSTDC_NAMES to 1 where needed
- Remove header hacks
This commit is contained in:
Timo Kreuzer 2024-05-22 20:48:04 +03:00
parent b707be90a1
commit bf95874c2d
16 changed files with 31 additions and 22 deletions

View file

@ -1,5 +1,4 @@
add_definitions(-Dtzset=_tzset)
include_directories(include) include_directories(include)
spec2def(dhcpcsvc.dll dhcpcsvc.spec ADD_IMPORTLIB) spec2def(dhcpcsvc.dll dhcpcsvc.spec ADD_IMPORTLIB)
@ -27,6 +26,7 @@ add_library(dhcpcsvc MODULE
dhcpcsvc.rc dhcpcsvc.rc
${CMAKE_CURRENT_BINARY_DIR}/dhcpcsvc.def) ${CMAKE_CURRENT_BINARY_DIR}/dhcpcsvc.def)
target_link_libraries(dhcpcsvc oldnames)
set_module_type(dhcpcsvc win32dll) set_module_type(dhcpcsvc win32dll)
add_importlibs(dhcpcsvc ws2_32 iphlpapi advapi32 msvcrt kernel32 ntdll) add_importlibs(dhcpcsvc ws2_32 iphlpapi advapi32 msvcrt kernel32 ntdll)
add_pch(dhcpcsvc include/rosdhcp.h "${PCH_SKIP_SOURCE}") add_pch(dhcpcsvc include/rosdhcp.h "${PCH_SKIP_SOURCE}")

View file

@ -2,7 +2,7 @@ spec2def(libtirpc.dll libtirpc/libtirpc.spec ADD_IMPORTLIB)
remove_definitions(-D_WIN32_WINNT=0x502) remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600) add_definitions(-D_WIN32_WINNT=0x600)
add_definitions(-DUNICODE -D_WIN32 -DPORTMAP -Dstrdup=_strdup -D_CRT_NONSTDC_NO_DEPRECATE=1) add_definitions(-DUNICODE -D_WIN32 -DPORTMAP -D_CRT_NONSTDC_NO_DEPRECATE=1)
include_directories(${REACTOS_SOURCE_DIR}/dll/3rdparty/libtirpc/tirpc) include_directories(${REACTOS_SOURCE_DIR}/dll/3rdparty/libtirpc/tirpc)
@ -106,6 +106,7 @@ else()
endif() endif()
set_module_type(libtirpc win32dll) set_module_type(libtirpc win32dll)
target_link_libraries(libtirpc oldnames)
add_importlibs(libtirpc user32 advapi32 kernel32_vista ws2_32 msvcrt kernel32 ntdll) add_importlibs(libtirpc user32 advapi32 kernel32_vista ws2_32 msvcrt kernel32 ntdll)
add_delay_importlibs(libtirpc secur32) add_delay_importlibs(libtirpc secur32)
add_pch(libtirpc precomp.h SOURCE) add_pch(libtirpc precomp.h SOURCE)

View file

@ -2,7 +2,7 @@
remove_definitions(-D_WIN32_WINNT=0x502) remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600) add_definitions(-D_WIN32_WINNT=0x600)
add_definitions(-D__WINESRC__) add_definitions(-D__WINESRC__ -D_CRT_DECLARE_NONSTDC_NAMES=1)
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
spec2def(appwiz.cpl appwiz.spec) spec2def(appwiz.cpl appwiz.spec)

View file

@ -30,6 +30,7 @@ DEBUG_CHANNEL(nls);
#include "lcformat_private.h" #include "lcformat_private.h"
#ifdef __REACTOS__ #ifdef __REACTOS__
#include "japanese.h" #include "japanese.h"
#define strcasecmp _stricmp
#endif #endif
INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1,

View file

@ -118,7 +118,7 @@ add_typelib(shell32_shldisp.idl)
set_source_files_properties(shell32.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/shell32_shldisp.tlb) set_source_files_properties(shell32.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/shell32_shldisp.tlb)
set_module_type(shell32 win32dll UNICODE) set_module_type(shell32 win32dll UNICODE)
target_link_libraries(shell32 shellmenu shelldesktop wine uuid recyclebin cpprt atl_classes) target_link_libraries(shell32 shellmenu shelldesktop wine uuid recyclebin cpprt atl_classes oldnames)
add_delay_importlibs(shell32 powrprof shdocvw devmgr winspool.drv winmm mpr uxtheme ole32 oleaut32 userenv browseui version fmifs) add_delay_importlibs(shell32 powrprof shdocvw devmgr winspool.drv winmm mpr uxtheme ole32 oleaut32 userenv browseui version fmifs)
add_importlibs(shell32 advapi32 gdi32 user32 comctl32 comdlg32 shlwapi msvcrt kernel32 ntdll) add_importlibs(shell32 advapi32 gdi32 user32 comctl32 comdlg32 shlwapi msvcrt kernel32 ntdll)
add_dependencies(shell32 stdole2) # shell32_shldisp.tlb needs stdole2.tlb add_dependencies(shell32 stdole2) # shell32_shldisp.tlb needs stdole2.tlb

View file

@ -8,8 +8,7 @@ add_definitions(
add_definitions( add_definitions(
-D__WINESRC__ -D__WINESRC__
-D_WINE -D_WINE)
-Dclose=_close)
spec2def(wininet.dll wininet.spec ADD_IMPORTLIB) spec2def(wininet.dll wininet.spec ADD_IMPORTLIB)

View file

@ -108,7 +108,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
endif() endif()
target_link_libraries(ext2fs memcmp ${PSEH_LIB}) target_link_libraries(ext2fs memcmp ${PSEH_LIB})
add_definitions(-D__KERNEL__ -D_CRT_NO_POSIX_ERROR_CODES) add_definitions(-D__KERNEL__ -D_CRT_NO_POSIX_ERROR_CODES -D_CRT_DECLARE_NONSTDC_NAMES=1)
set_module_type(ext2fs kernelmodedriver) set_module_type(ext2fs kernelmodedriver)
add_importlibs(ext2fs ntoskrnl hal) add_importlibs(ext2fs ntoskrnl hal)
add_pch(ext2fs inc/ext2fs.h SOURCE) add_pch(ext2fs inc/ext2fs.h SOURCE)

View file

@ -1,5 +1,6 @@
add_executable(touch err.c touch.c touch.rc) add_executable(touch err.c touch.c touch.rc)
target_compile_definitions(touch PRIVATE _CRT_DECLARE_NONSTDC_NAMES=1)
target_link_libraries(touch getopt) target_link_libraries(touch getopt)
set_module_type(touch win32cui) set_module_type(touch win32cui)
add_importlibs(touch msvcrt kernel32) add_importlibs(touch msvcrt kernel32)

View file

@ -70,7 +70,12 @@ list(APPEND SOURCE
add_executable(ncftp ${SOURCE} ncftp.rc) add_executable(ncftp ${SOURCE} ncftp.rc)
set_module_type(ncftp win32cui) set_module_type(ncftp win32cui)
target_compile_definitions(ncftp PRIVATE HAVE_UTIME_H HAVE_UNISTD_H) target_compile_definitions(ncftp PRIVATE
HAVE_UTIME_H
HAVE_UNISTD_H
_CRT_DECLARE_NONSTDC_NAMES=1
strcasecmp=_stricmp
)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU") if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(ncftp PRIVATE -Wno-unused-but-set-variable) target_compile_options(ncftp PRIVATE -Wno-unused-but-set-variable)
endif() endif()

View file

@ -33,10 +33,9 @@
#pragma pack(push,_CRT_PACKING) #pragma pack(push,_CRT_PACKING)
/* Disable non-ANSI C definitions if compiling with __STDC__ */ /* Disable non-ANSI C definitions if compiling with __STDC__ */
//HACK: Disabled #if (!defined _CRT_DECLARE_NONSTDC_NAMES || !_CRT_DECLARE_NONSTDC_NAMES) && (defined _CRT_DECLARE_NONSTDC_NAMES || __STDC__)
//#if __STDC__ #define NO_OLDNAMES
//#define NO_OLDNAMES #endif
//#endif
/** Properties ***************************************************************/ /** Properties ***************************************************************/

View file

@ -575,9 +575,6 @@ extern "C" {
_In_z_ const char *_Str, _In_z_ const char *_Str,
_In_ size_t _MaxCount); _In_ size_t _MaxCount);
// __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); }
// __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); }
_CRTIMP _CRTIMP
_CRT_NONSTDC_DEPRECATE(_strnset) _CRT_NONSTDC_DEPRECATE(_strnset)
char* char*
@ -1138,11 +1135,5 @@ extern "C" {
} }
#endif #endif
// HACK
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define stricmp _stricmp
#define wcsicmp _wcsicmp
#include <sec_api/string_s.h> #include <sec_api/string_s.h>
#endif #endif

View file

@ -51,6 +51,11 @@ target_compile_definitions(stlport PRIVATE
_STLP_USE_EXCEPTIONS _DLL __USE_CRTIMP _STLP_USE_EXCEPTIONS _DLL __USE_CRTIMP
_BUILD_STLPORT NATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/sdk/include/c++) _BUILD_STLPORT NATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/sdk/include/c++)
target_compile_definitions(stlport PUBLIC
_CRT_DECLARE_NONSTDC_NAMES=1
_CRT_NONSTDC_NO_DEPRECATE
)
target_include_directories(stlport INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:${REACTOS_SOURCE_DIR}/sdk/include/c++/stlport>") target_include_directories(stlport INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:${REACTOS_SOURCE_DIR}/sdk/include/c++/stlport>")
target_compile_definitions(stlport INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:NATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/sdk/include/c++>") target_compile_definitions(stlport INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:NATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/sdk/include/c++>")
set_target_cpp_properties(stlport WITH_EXCEPTIONS WITH_RTTI) set_target_cpp_properties(stlport WITH_EXCEPTIONS WITH_RTTI)

View file

@ -34,6 +34,7 @@ list(APPEND MINIZIP_SOURCE
if(CMAKE_CROSSCOMPILING) if(CMAKE_CROSSCOMPILING)
add_library(zlib ${SOURCE} ${SOLO_SOURCE}) add_library(zlib ${SOURCE} ${SOLO_SOURCE})
target_link_libraries(zlib oldnames)
target_include_directories(zlib PRIVATE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib) target_include_directories(zlib PRIVATE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
add_library(zlib_solo ${SOLO_SOURCE}) add_library(zlib_solo ${SOLO_SOURCE})
target_compile_definitions(zlib_solo PRIVATE Z_SOLO) target_compile_definitions(zlib_solo PRIVATE Z_SOLO)

View file

@ -12,4 +12,4 @@ set_target_cpp_properties(stdc++compat WITH_EXCEPTIONS)
add_dependencies(stdc++compat xdk) add_dependencies(stdc++compat xdk)
target_link_libraries(stdc++compat libmsvcrt) target_link_libraries(stdc++compat libmsvcrt)
remove_target_compile_option(stdc++compat "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<IN_LIST:cppstl,$<TARGET_PROPERTY:LINK_LIBRARIES>>>>:-nostdinc>") remove_target_compile_option(stdc++compat "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<IN_LIST:cppstl,$<TARGET_PROPERTY:LINK_LIBRARIES>>>>:-nostdinc>")
target_compile_definitions(stdc++compat PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:PAL_STDCPP_COMPAT>") target_compile_definitions(stdc++compat PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:PAL_STDCPP_COMPAT>" _CRT_DECLARE_NONSTDC_NAMES=1)

View file

@ -37,6 +37,7 @@
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
#define wcsnicmp _wcsnicmp #define wcsnicmp _wcsnicmp
#define swprintf _snwprintf #define swprintf _snwprintf
#define wcsicmp _wcsicmp
#undef RT_MANIFEST #undef RT_MANIFEST
#undef CREATEPROCESS_MANIFEST_RESOURCE_ID #undef CREATEPROCESS_MANIFEST_RESOURCE_ID

View file

@ -1,4 +1,9 @@
add_definitions(
-D_CRT_DECLARE_NONSTDC_NAMES=1
-D_CRT_NONSTDC_NO_DEPRECATE
)
if(MSVC) if(MSVC)
if(MSVC_VERSION LESS 1900) if(MSVC_VERSION LESS 1900)
add_definitions( add_definitions(