Skip to content

Commit 38fd485

Browse files
[mono] Cleanup unused runtime functions (#91681)
- Removes unused functions - Removes cmake configure checks for functions/headers that are no longer needed - Renames HAVE_UWP_WINAPI_SUPPORT to HAVE_APP_WINAPI_SUPPORT - Move MSVC warning disables into cmake so it is more visible Co-authored-by: Johan Lorensson <lateralusx.github@gmail.com>
1 parent e81671f commit 38fd485

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+173
-3533
lines changed

src/coreclr/scripts/genEventPipe.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,9 @@ def getMonoEventPipeImplFilePrefix():
11071107
#if WCHAR_MAX == 0xFFFF
11081108
provider_name_utf8 = g_utf16_to_utf8 ((const gunichar2 *)provider_name, -1, NULL, NULL, NULL);
11091109
#else
1110-
provider_name_utf8 = g_ucs4_to_utf8 ((const gunichar *)provider_name, -1, NULL, NULL, NULL);
1110+
gunichar2 *provider_name_utf16 = g_ucs4_to_utf16 ((const gunichar *)provider_name, -1, NULL, NULL, NULL);
1111+
provider_name_utf8 = g_utf16_to_utf8 (provider_name_utf16, -1, NULL, NULL, NULL);
1112+
g_free (provider_name_utf16);
11111113
#endif
11121114
11131115
ep_return_null_if_nok (provider_name_utf8 != NULL);

src/mono/CMakeLists.txt

+12-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ if (MSVC)
1616
if(EXISTS ${CLR_SOURCELINK_FILE_PATH})
1717
add_link_options("/sourcelink:${CLR_SOURCELINK_FILE_PATH}")
1818
endif()
19+
20+
# FIXME This is all questionable but the logs are flooded and nothing else is fixing them.
21+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4090>) # W1: const problem
22+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4100>) # W4: unreferenced formal parameter
23+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4152>) # W4: nonstandard extension, function/data pointer conversion in expression
24+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4201>) # W4: nonstandard extension used: nameless struct/union
25+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4210>) # W4: nonstandard extension used: function given file scope
26+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4245>) # W4: signed/unsigned mismatch
27+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4389>) # W4: signed/unsigned mismatch
28+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4505>) # W4: unreferenced function with internal linkage has been removed
29+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4702>) # W4: unreachable code
30+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4706>) # W4: assignment within conditional expression
1931
endif(MSVC)
2032

2133
set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
@@ -76,7 +88,6 @@ if(ENABLE_MINIMAL)
7688
endif()
7789

7890
set(DISABLE_COM 1)
79-
set(DISABLE_DLLMAP 1)
8091

8192
# Dependencies between options
8293
if(ENABLE_INTERP_LIB)
@@ -102,7 +113,6 @@ if(GCC)
102113
set(USE_GCC_ATOMIC_OPS 1)
103114
endif()
104115

105-
set(HAVE_CLASSIC_WINAPI_SUPPORT 1)
106116
set(HAVE_MOVING_COLLECTOR 1)
107117
set(HAVE_CONC_GC_AS_DEFAULT 1)
108118
set(MONO_INSIDE_RUNTIME 1)
@@ -796,7 +806,6 @@ if(HOST_WIN32)
796806
set(EGLIB_PATHSEP "\\\\")
797807
set(EGLIB_SEARCHSEP ";")
798808
set(EGLIB_OS "WIN32")
799-
set(EGLIB_PIDTYPE "void *")
800809
if(HOST_AMD64 OR HOST_ARM64)
801810
set(EGLIB_GSIZE_FORMAT "\"Iu\"")
802811
else()
@@ -814,7 +823,6 @@ else()
814823
set(EGLIB_PATHSEP "/")
815824
set(EGLIB_SEARCHSEP ":")
816825
set(EGLIB_OS "UNIX")
817-
set(EGLIB_PIDTYPE "int")
818826
set(EGLIB_GSIZE_FORMAT "\"zu\"")
819827
endif()
820828

src/mono/cmake/config.h.in

+4-133
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33

44
#ifdef _MSC_VER
55

6-
// FIXME This is all questionable but the logs are flooded and nothing else is fixing them.
7-
#pragma warning(disable:4090) // W1: const problem
8-
#pragma warning(disable:4100) // W4: unreferenced formal parameter
9-
#pragma warning(disable:4152) // W4: nonstandard extension, function/data pointer conversion in expression
10-
#pragma warning(disable:4201) // W4: nonstandard extension used: nameless struct/union
11-
#pragma warning(disable:4210) // W4: nonstandard extension used: function given file scope
12-
#pragma warning(disable:4245) // W4: signed/unsigned mismatch
13-
#pragma warning(disable:4389) // W4: signed/unsigned mismatch
14-
#pragma warning(disable:4505) // W4: unreferenced function with internal linkage has been removed
15-
#pragma warning(disable:4702) // W4: unreachable code
16-
#pragma warning(disable:4706) // W4: assignment within conditional expression
17-
186
#include <SDKDDKVer.h>
197

208
#if _WIN32_WINNT < 0x0601
@@ -30,13 +18,13 @@
3018

3119
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
3220
#define HAVE_CLASSIC_WINAPI_SUPPORT 1
33-
#define HAVE_UWP_WINAPI_SUPPORT 0
21+
#define HAVE_APP_WINAPI_SUPPORT 0
3422
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
3523
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
36-
#define HAVE_UWP_WINAPI_SUPPORT 1
24+
#define HAVE_APP_WINAPI_SUPPORT 1
3725
#else
3826
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
39-
#define HAVE_UWP_WINAPI_SUPPORT 0
27+
#define HAVE_APP_WINAPI_SUPPORT 0
4028
#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
4129
#error Unsupported WINAPI family
4230
#endif
@@ -105,12 +93,6 @@
10593
/* Target Platform is Linux (musl libc)*/
10694
#cmakedefine TARGET_LINUX_MUSL 1
10795

108-
/* Use classic Windows API support */
109-
#cmakedefine HAVE_CLASSIC_WINAPI_SUPPORT 1
110-
111-
/* Don't use UWP Windows API support */
112-
#cmakedefine HAVE_UWP_WINAPI_SUPPORT 1
113-
11496
/* Define to 1 if you have the <sys/types.h> header file. */
11597
#cmakedefine HAVE_SYS_TYPES_H 1
11698

@@ -135,21 +117,12 @@
135117
/* Define to 1 if you have the <syslog.h> header file. */
136118
#cmakedefine HAVE_SYSLOG_H 1
137119

138-
/* Define to 1 if you have the <sys/filio.h> header file. */
139-
#cmakedefine HAVE_SYS_FILIO_H 1
140-
141120
/* Define to 1 if you have the <sys/sockio.h> header file. */
142121
#cmakedefine HAVE_SYS_SOCKIO_H 1
143122

144123
/* Define to 1 if you have the <netdb.h> header file. */
145124
#cmakedefine HAVE_NETDB_H 1
146125

147-
/* Define to 1 if you have the <utime.h> header file. */
148-
#cmakedefine HAVE_UTIME_H 1
149-
150-
/* Define to 1 if you have the <sys/utime.h> header file. */
151-
#cmakedefine HAVE_SYS_UTIME_H 1
152-
153126
/* Define to 1 if you have the <semaphore.h> header file. */
154127
#cmakedefine HAVE_SEMAPHORE_H 1
155128

@@ -210,9 +183,6 @@
210183
/* Define to 1 if you have the <unwind.h> header file. */
211184
#cmakedefine HAVE_UNWIND_H 1
212185

213-
/* Define to 1 if you have the <sys/user.h> header file. */
214-
#cmakedefine HAVE_SYS_USER_H 1
215-
216186
/* Use static ICU */
217187
#cmakedefine STATIC_ICU 1
218188

@@ -308,9 +278,6 @@
308278
/* Disable sockets */
309279
#cmakedefine DISABLE_SOCKETS 1
310280

311-
/* Disables use of DllMaps in MonoVM */
312-
#cmakedefine DISABLE_DLLMAP 1
313-
314281
/* Disable Threads */
315282
#cmakedefine DISABLE_THREADS 1
316283

@@ -323,9 +290,6 @@
323290
/* Define to 1 if you have the `sigaction' function. */
324291
#cmakedefine HAVE_SIGACTION 1
325292

326-
/* Define to 1 if you have the `kill' function. */
327-
#cmakedefine HAVE_KILL 1
328-
329293
/* CLOCK_MONOTONIC */
330294
#cmakedefine HAVE_CLOCK_MONOTONIC 1
331295

@@ -365,9 +329,6 @@
365329
/* Define to 1 if you have the `madvise' function. */
366330
#cmakedefine HAVE_MADVISE 1
367331

368-
/* Define to 1 if you have the `getrusage' function. */
369-
#cmakedefine HAVE_GETRUSAGE 1
370-
371332
/* Define to 1 if you have the `dladdr' function. */
372333
#cmakedefine HAVE_DLADDR 1
373334

@@ -380,39 +341,18 @@
380341
/* Define to 1 if you have the `prctl' function. */
381342
#cmakedefine HAVE_PRCTL 1
382343

383-
/* Define to 1 if you have the `nl_langinfo' function. */
384-
#cmakedefine HAVE_NL_LANGINFO 1
385-
386344
/* sched_getaffinity */
387345
#cmakedefine HAVE_SCHED_GETAFFINITY 1
388346

389347
/* sched_setaffinity */
390348
#cmakedefine HAVE_SCHED_SETAFFINITY 1
391349

392-
/* Define to 1 if you have the `chmod' function. */
393-
#cmakedefine HAVE_CHMOD 1
394-
395350
/* Define to 1 if you have the `lstat' function. */
396351
#cmakedefine HAVE_LSTAT 1
397352

398-
/* Define to 1 if you have the `getdtablesize' function. */
399-
#cmakedefine HAVE_GETDTABLESIZE 1
400-
401353
/* Define to 1 if you have the `ftruncate' function. */
402354
#cmakedefine HAVE_FTRUNCATE 1
403355

404-
/* Define to 1 if you have the `msync' function. */
405-
#cmakedefine HAVE_MSYNC 1
406-
407-
/* Define to 1 if you have the `getpeername' function. */
408-
#cmakedefine HAVE_GETPEERNAME 1
409-
410-
/* Define to 1 if you have the `utime' function. */
411-
#cmakedefine HAVE_UTIME 1
412-
413-
/* Define to 1 if you have the `utimes' function. */
414-
#cmakedefine HAVE_UTIMES 1
415-
416356
/* Define to 1 if you have the `openlog' function. */
417357
#cmakedefine HAVE_OPENLOG 1
418358

@@ -443,24 +383,6 @@
443383
/* Have gethostbyname */
444384
#cmakedefine HAVE_GETHOSTBYNAME 1
445385

446-
/* Have getprotobyname */
447-
#cmakedefine HAVE_GETPROTOBYNAME 1
448-
449-
/* Have getprotobyname_r */
450-
#cmakedefine HAVE_GETPROTOBYNAME_R 1
451-
452-
/* Have getnameinfo */
453-
#cmakedefine HAVE_GETNAMEINFO 1
454-
455-
/* Have inet_ntop */
456-
#cmakedefine HAVE_INET_NTOP 1
457-
458-
/* Have inet_pton */
459-
#cmakedefine HAVE_INET_PTON 1
460-
461-
/* Define to 1 if you have the `inet_aton' function. */
462-
#cmakedefine HAVE_INET_ATON 1
463-
464386
/* Define to 1 if you have the <pthread.h> header file. */
465387
#cmakedefine HAVE_PTHREAD_H 1
466388

@@ -523,54 +445,30 @@
523445
/* sockaddr_in6 has sin6_len */
524446
#cmakedefine HAVE_SOCKADDR_IN6_SIN_LEN 1
525447

526-
/* Have getifaddrs */
527-
#cmakedefine HAVE_GETIFADDRS 1
528-
529-
/* Have access */
530-
#cmakedefine HAVE_ACCESS 1
531-
532448
/* Have getpid */
533449
#cmakedefine HAVE_GETPID 1
534450

535451
/* Have mktemp */
536452
#cmakedefine HAVE_MKTEMP 1
537453

538-
/* Define to 1 if you have the <sys/statvfs.h> header file. */
539-
#cmakedefine HAVE_SYS_STATVFS_H 1
540-
541-
/* Define to 1 if you have the <sys/statfs.h> header file. */
542-
#cmakedefine HAVE_SYS_STATFS_H 1
543-
544454
/* Define to 1 if you have the <sys/mman.h> header file. */
545455
#cmakedefine HAVE_SYS_MMAN_H 1
546456

547457
/* Define to 1 if you have the <sys/mount.h> header file. */
548458
#cmakedefine HAVE_SYS_MOUNT_H 1
549459

550-
/* Define to 1 if you have the `getfsstat' function. */
551-
#cmakedefine HAVE_GETFSSTAT 1
552-
553460
/* Define to 1 if you have the `mremap' function. */
554461
#cmakedefine HAVE_MREMAP 1
555462

556-
/* Define to 1 if you have the `posix_fadvise' function. */
557-
#cmakedefine HAVE_POSIX_FADVISE 1
558-
559463
/* Define to 1 if you have the `vsnprintf' function. */
560464
#cmakedefine HAVE_VSNPRINTF 1
561465

562-
/* struct statfs */
563-
#cmakedefine HAVE_STATFS 1
564-
565-
/* Define to 1 if you have the `statvfs' function. */
566-
#cmakedefine HAVE_STATVFS 1
567-
568466
/* Define to 1 if you have the `setpgid' function. */
569467
#cmakedefine HAVE_SETPGID 1
570468

571469
/* Define to 1 if you have the `system' function. */
572470
#ifdef _MSC_VER
573-
#if HAVE_WINAPI_FAMILY_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
471+
#if HAVE_CLASSIC_WINAPI_SUPPORT
574472
#cmakedefine HAVE_SYSTEM 1
575473
#endif
576474
#else
@@ -580,15 +478,6 @@
580478
/* Define to 1 if you have the `fork' function. */
581479
#cmakedefine HAVE_FORK 1
582480

583-
/* Define to 1 if you have the `execv' function. */
584-
#cmakedefine HAVE_EXECV 1
585-
586-
/* Define to 1 if you have the `execve' function. */
587-
#cmakedefine HAVE_EXECVE 1
588-
589-
/* Define to 1 if you have the `waitpid' function. */
590-
#cmakedefine HAVE_WAITPID 1
591-
592481
/* Define to 1 if you have the `localtime_r' function. */
593482
#cmakedefine HAVE_LOCALTIME_R 1
594483

@@ -609,18 +498,6 @@
609498
/* Define to 1 if the system has the type `struct sockaddr_in6'. */
610499
#cmakedefine HAVE_STRUCT_SOCKADDR_IN6 1
611500

612-
/* Define to 1 if the system has the type `struct stat'. */
613-
#cmakedefine HAVE_STRUCT_STAT 1
614-
615-
/* Define to 1 if the system has the type `struct timeval'. */
616-
#cmakedefine HAVE_STRUCT_TIMEVAL 1
617-
618-
/* Define to 1 if `st_atim' is a member of `struct stat'. */
619-
#cmakedefine HAVE_STRUCT_STAT_ST_ATIM 1
620-
621-
/* Define to 1 if `st_atimespec' is a member of `struct stat'. */
622-
#cmakedefine HAVE_STRUCT_STAT_ST_ATIMESPEC 1
623-
624501
/* Define to 1 if `super_class' is a member of `struct objc_super'. */
625502
#cmakedefine HAVE_OBJC_SUPER_SUPER_CLASS 1
626503

@@ -807,15 +684,9 @@
807684
/* Defaults to concurrent GC */
808685
#cmakedefine HAVE_CONC_GC_AS_DEFAULT 1
809686

810-
/* Define to 1 if you have the `stpcpy' function. */
811-
#cmakedefine HAVE_STPCPY 1
812-
813687
/* Define to 1 if you have the `strtok_r' function. */
814688
#cmakedefine HAVE_STRTOK_R 1
815689

816-
/* Define to 1 if you have the `rewinddir' function. */
817-
#cmakedefine HAVE_REWINDDIR 1
818-
819690
/* Define to 1 if you have the `vasprintf' function. */
820691
#cmakedefine HAVE_VASPRINTF 1
821692

0 commit comments

Comments
 (0)