Skip to content

Commit bf95874

Browse files
committed
[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
1 parent b707be9 commit bf95874

File tree

16 files changed

+31
-22
lines changed

16 files changed

+31
-22
lines changed

base/services/dhcpcsvc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
add_definitions(-Dtzset=_tzset)
32
include_directories(include)
43
spec2def(dhcpcsvc.dll dhcpcsvc.spec ADD_IMPORTLIB)
54

@@ -27,6 +26,7 @@ add_library(dhcpcsvc MODULE
2726
dhcpcsvc.rc
2827
${CMAKE_CURRENT_BINARY_DIR}/dhcpcsvc.def)
2928

29+
target_link_libraries(dhcpcsvc oldnames)
3030
set_module_type(dhcpcsvc win32dll)
3131
add_importlibs(dhcpcsvc ws2_32 iphlpapi advapi32 msvcrt kernel32 ntdll)
3232
add_pch(dhcpcsvc include/rosdhcp.h "${PCH_SKIP_SOURCE}")

dll/3rdparty/libtirpc/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spec2def(libtirpc.dll libtirpc/libtirpc.spec ADD_IMPORTLIB)
22

33
remove_definitions(-D_WIN32_WINNT=0x502)
44
add_definitions(-D_WIN32_WINNT=0x600)
5-
add_definitions(-DUNICODE -D_WIN32 -DPORTMAP -Dstrdup=_strdup -D_CRT_NONSTDC_NO_DEPRECATE=1)
5+
add_definitions(-DUNICODE -D_WIN32 -DPORTMAP -D_CRT_NONSTDC_NO_DEPRECATE=1)
66

77
include_directories(${REACTOS_SOURCE_DIR}/dll/3rdparty/libtirpc/tirpc)
88

@@ -106,6 +106,7 @@ else()
106106
endif()
107107

108108
set_module_type(libtirpc win32dll)
109+
target_link_libraries(libtirpc oldnames)
109110
add_importlibs(libtirpc user32 advapi32 kernel32_vista ws2_32 msvcrt kernel32 ntdll)
110111
add_delay_importlibs(libtirpc secur32)
111112
add_pch(libtirpc precomp.h SOURCE)

dll/cpl/appwiz/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
remove_definitions(-D_WIN32_WINNT=0x502)
33
add_definitions(-D_WIN32_WINNT=0x600)
44

5-
add_definitions(-D__WINESRC__)
5+
add_definitions(-D__WINESRC__ -D_CRT_DECLARE_NONSTDC_NAMES=1)
66
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
77
spec2def(appwiz.cpl appwiz.spec)
88

dll/win32/kernel32/winnls/string/locale.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ DEBUG_CHANNEL(nls);
3030
#include "lcformat_private.h"
3131
#ifdef __REACTOS__
3232
#include "japanese.h"
33+
#define strcasecmp _stricmp
3334
#endif
3435

3536
INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1,

dll/win32/shell32/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ add_typelib(shell32_shldisp.idl)
118118
set_source_files_properties(shell32.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/shell32_shldisp.tlb)
119119

120120
set_module_type(shell32 win32dll UNICODE)
121-
target_link_libraries(shell32 shellmenu shelldesktop wine uuid recyclebin cpprt atl_classes)
121+
target_link_libraries(shell32 shellmenu shelldesktop wine uuid recyclebin cpprt atl_classes oldnames)
122122
add_delay_importlibs(shell32 powrprof shdocvw devmgr winspool.drv winmm mpr uxtheme ole32 oleaut32 userenv browseui version fmifs)
123123
add_importlibs(shell32 advapi32 gdi32 user32 comctl32 comdlg32 shlwapi msvcrt kernel32 ntdll)
124124
add_dependencies(shell32 stdole2) # shell32_shldisp.tlb needs stdole2.tlb

dll/win32/wininet/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ add_definitions(
88

99
add_definitions(
1010
-D__WINESRC__
11-
-D_WINE
12-
-Dclose=_close)
11+
-D_WINE)
1312

1413
spec2def(wininet.dll wininet.spec ADD_IMPORTLIB)
1514

drivers/filesystems/ext2/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
108108
endif()
109109

110110
target_link_libraries(ext2fs memcmp ${PSEH_LIB})
111-
add_definitions(-D__KERNEL__ -D_CRT_NO_POSIX_ERROR_CODES)
111+
add_definitions(-D__KERNEL__ -D_CRT_NO_POSIX_ERROR_CODES -D_CRT_DECLARE_NONSTDC_NAMES=1)
112112
set_module_type(ext2fs kernelmodedriver)
113113
add_importlibs(ext2fs ntoskrnl hal)
114114
add_pch(ext2fs inc/ext2fs.h SOURCE)

modules/rosapps/applications/cmdutils/touch/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
add_executable(touch err.c touch.c touch.rc)
3+
target_compile_definitions(touch PRIVATE _CRT_DECLARE_NONSTDC_NAMES=1)
34
target_link_libraries(touch getopt)
45
set_module_type(touch win32cui)
56
add_importlibs(touch msvcrt kernel32)

modules/rosapps/applications/net/ncftp/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ list(APPEND SOURCE
7070

7171
add_executable(ncftp ${SOURCE} ncftp.rc)
7272
set_module_type(ncftp win32cui)
73-
target_compile_definitions(ncftp PRIVATE HAVE_UTIME_H HAVE_UNISTD_H)
73+
target_compile_definitions(ncftp PRIVATE
74+
HAVE_UTIME_H
75+
HAVE_UNISTD_H
76+
_CRT_DECLARE_NONSTDC_NAMES=1
77+
strcasecmp=_stricmp
78+
)
7479
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
7580
target_compile_options(ncftp PRIVATE -Wno-unused-but-set-variable)
7681
endif()

sdk/include/crt/crtdefs.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@
3333
#pragma pack(push,_CRT_PACKING)
3434

3535
/* Disable non-ANSI C definitions if compiling with __STDC__ */
36-
//HACK: Disabled
37-
//#if __STDC__
38-
//#define NO_OLDNAMES
39-
//#endif
36+
#if (!defined _CRT_DECLARE_NONSTDC_NAMES || !_CRT_DECLARE_NONSTDC_NAMES) && (defined _CRT_DECLARE_NONSTDC_NAMES || __STDC__)
37+
#define NO_OLDNAMES
38+
#endif
4039

4140

4241
/** Properties ***************************************************************/

0 commit comments

Comments
 (0)