From 577a70afa472a2b7aa8e05947e185d920f42b23d Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Tue, 2 Nov 2021 17:47:37 +0200 Subject: [PATCH] Fix gcc warnings during mono linux-x64 build (#60675) * Fix gcc warnings during mono linux-x64 build main with Debug configuration: 822 warnings - http://sprunge.us/2GzrDE PR with Debug configuration: 3 warnings related to deprecated sys/sysctl.h includes - http://sprunge.us/JuyA3K after fixing Debug warnings, there were 13 additional warnings in Release configuration: http://sprunge.us/PJCivP PR with Release configuration: (same) 3 warnings - http://sprunge.us/NwKHNE * Address CR feedback --- src/coreclr/pal/src/thread/process.cpp | 2 +- src/libraries/Native/Unix/CMakeLists.txt | 2 +- .../pal_collation.c | 4 +- .../System.Globalization.Native/pal_icushim.c | 2 +- src/mono/CMakeLists.txt | 1 - src/mono/cmake/config.h.in | 7 +-- src/mono/cmake/configure.cmake | 40 +++++++++++--- src/mono/cmake/defines-todo.cmake | 1 - src/mono/mono/component/debugger-agent.c | 21 ++----- src/mono/mono/component/debugger-engine.c | 6 +- src/mono/mono/component/event_pipe.c | 2 +- src/mono/mono/component/hot_reload.c | 2 +- src/mono/mono/eglib/gmarkup.c | 2 +- src/mono/mono/eglib/gstr.c | 14 ++--- src/mono/mono/eventpipe/ds-rt-mono.c | 2 +- src/mono/mono/eventpipe/ep-rt-mono.c | 4 +- src/mono/mono/eventpipe/ep-rt-mono.h | 55 ++++++++++--------- src/mono/mono/metadata/assembly.c | 4 +- src/mono/mono/metadata/class-setup-vtable.c | 9 +-- src/mono/mono/metadata/components.c | 16 +++--- src/mono/mono/metadata/components.h | 17 +++--- src/mono/mono/metadata/custom-attrs.c | 3 +- src/mono/mono/metadata/gc.c | 3 - src/mono/mono/metadata/icall.c | 9 +-- src/mono/mono/metadata/marshal-ilgen.c | 4 +- src/mono/mono/metadata/sre-encode.c | 5 +- src/mono/mono/metadata/sre.c | 7 --- src/mono/mono/metadata/threads.c | 4 +- src/mono/mono/mini/aot-compiler.c | 8 ++- src/mono/mono/mini/aot-runtime.c | 5 -- src/mono/mono/mini/calls.c | 3 +- src/mono/mono/mini/driver.c | 3 +- src/mono/mono/mini/ir-emit.h | 7 ++- src/mono/mono/mini/method-to-ir.c | 10 +++- src/mono/mono/mini/mini-generic-sharing.c | 2 - src/mono/mono/mini/mini-trampolines.c | 2 - src/mono/mono/mini/simd-intrinsics.c | 3 +- src/mono/mono/sgen/sgen-hash-table.c | 4 +- src/mono/mono/utils/mono-hwcap-vars.h | 6 +- src/mono/mono/utils/mono-proclib.c | 28 +++++----- src/native/eventpipe/ds-ipc-pal-socket.c | 4 +- src/native/eventpipe/ep-config.h | 3 +- src/native/eventpipe/ep-event-source.h | 7 ++- src/native/eventpipe/ep-sample-profiler.c | 1 - src/native/eventpipe/ep.h | 21 ++----- 45 files changed, 173 insertions(+), 192 deletions(-) diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp index 748056fa419824..7fe41410386dd5 100644 --- a/src/coreclr/pal/src/thread/process.cpp +++ b/src/coreclr/pal/src/thread/process.cpp @@ -2148,7 +2148,7 @@ GetProcessIdDisambiguationKey(DWORD processId, UINT64 *disambiguationKey) // All the format specifiers for the fields in the stat file are provided by 'man proc'. int sscanfRet = sscanf_s(scanStartPosition, - "%*c %*d %*d %*d %*d %*d %*u %*lu %*lu %*lu %*lu %*lu %*lu %*ld %*ld %*ld %*ld %*ld %*ld %llu \n", + "%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %*u %*d %*d %*d %*d %*d %*d %llu \n", &starttime); if (sscanfRet != 1) diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index e6974b707c4ede..03871a500808f6 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -104,7 +104,7 @@ if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS add_definitions(-D__APPLE_USE_RFC_3542) endif () -if (CLR_CMAKE_TARGET_LINUX) +if (CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_ANDROID) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") endif () diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c index f0273afac9fa6c..097a0ed62a6a22 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c @@ -542,7 +542,7 @@ static UChar* s_breakIteratorRules = NULL; // We are customizing the break iterator to exclude the CRxLF rule which don't allow breaking between CR and LF. // The general rules syntax explained in the doc https://unicode-org.github.io/icu/userguide/boundaryanalysis/break-rules.html. // The ICU latest rules definition exist here https://github.com/unicode-org/icu/blob/main/icu4c/source/data/brkitr/rules/char.txt. -static UBreakIterator* CreateCustomizedBreakIterator() +static UBreakIterator* CreateCustomizedBreakIterator(void) { static UChar emptyString[1]; UBreakIterator* breaker; @@ -815,6 +815,7 @@ static int32_t GetSearchIteratorUsingCollator( if (!U_SUCCESS(err)) { int32_t r; + (void)r; r = RestoreSearchHandle(pSortHandle, *pSearchIterator, options); assert(r && "restoring search handle shouldn't fail."); return -1; @@ -824,6 +825,7 @@ static int32_t GetSearchIteratorUsingCollator( if (!U_SUCCESS(err)) { int32_t r; + (void)r; r = RestoreSearchHandle(pSortHandle, *pSearchIterator, options); assert(r && "restoring search handle shouldn't fail."); return -1; diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c index 70e8f0944993d2..a1cf71afb99405 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c @@ -368,7 +368,7 @@ static int FindICULibs(const char* versionPrefix, char* symbolName, char* symbol #endif -static void ValidateICUDataCanLoad() +static void ValidateICUDataCanLoad(void) { UVersionInfo version; UErrorCode err = U_ZERO_ERROR; diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 63230dcbfe0118..0016841316c9f5 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -754,7 +754,6 @@ endif() ###################################### # EXTRACT VERSION ###################################### -include("${CMAKE_CURRENT_SOURCE_DIR}/../../eng/native/configurepaths.cmake") include_directories(${CLR_ARTIFACTS_OBJ_DIR}) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") if(NOT EXISTS "${VERSION_HEADER_PATH}") diff --git a/src/mono/cmake/config.h.in b/src/mono/cmake/config.h.in index 48a82ec6db8c4c..648ad60dd0494a 100644 --- a/src/mono/cmake/config.h.in +++ b/src/mono/cmake/config.h.in @@ -510,14 +510,11 @@ /* Define to 1 if you have the `strerror_r' function. */ #cmakedefine HAVE_STRERROR_R 1 -/* Define to 1 if strerror_r returns char *. */ -#cmakedefine STRERROR_R_CHAR_P 1 - /* Have GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY */ #cmakedefine GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY 1 /* GLIBC has CPU_COUNT macro in sched.h */ -#cmakedefine GLIBC_HAS_CPU_COUNT 1 +#cmakedefine HAVE_GNU_CPU_COUNT /* Have large file support */ #cmakedefine HAVE_LARGE_FILE_SUPPORT 1 @@ -712,6 +709,8 @@ /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T @SIZEOF_SIZE_T@ +#cmakedefine01 HAVE_GNU_STRERROR_R + /* Define to 1 if the system has the type `struct sockaddr'. */ #cmakedefine HAVE_STRUCT_SOCKADDR 1 diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake index 7bee1c6b98553a..e8e9fb9e67d799 100644 --- a/src/mono/cmake/configure.cmake +++ b/src/mono/cmake/configure.cmake @@ -6,6 +6,7 @@ include(CheckTypeSize) include(CheckStructHasMember) include(CheckSymbolExists) include(CheckCCompilerFlag) +include(CheckCSourceCompiles) # Apple platforms like macOS/iOS allow targeting older operating system versions with a single SDK, # the mere presence of a symbol in the SDK doesn't tell us whether the deployment target really supports it. @@ -124,6 +125,37 @@ check_type_size("long" SIZEOF_LONG) check_type_size("long long" SIZEOF_LONG_LONG) check_type_size("size_t" SIZEOF_SIZE_T) +if (HOST_LINUX OR HOST_ANDROID) + set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) +endif() + +check_c_source_compiles( + " + #include + int main(void) + { + char buffer[1]; + char c = *strerror_r(0, buffer, 0); + return 0; + } + " + HAVE_GNU_STRERROR_R) + +check_c_source_compiles( + " + #include + int main(void) + { + CPU_COUNT((void *) 0); + return 0; + } + " + HAVE_GNU_CPU_COUNT) + +if (HOST_LINUX OR HOST_ANDROID) + set(CMAKE_REQUIRED_DEFINITIONS) +endif() + # ICONV set(ICONV_LIB) find_library(LIBICONV_FOUND iconv) @@ -131,14 +163,6 @@ if(NOT LIBICONV_FOUND STREQUAL "LIBICONV_FOUND-NOTFOUND") set(ICONV_LIB "iconv") endif() -file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c - "#include \n" - "void main () { CPU_COUNT((void *) 0); }\n" -) -try_compile(GLIBC_HAS_CPU_COUNT ${CMAKE_BINARY_DIR}/CMakeTmp SOURCES "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c" - COMPILE_DEFINITIONS "-D_GNU_SOURCE") - - if(HOST_WIN32) # checking for this doesn't work for some reason, hardcode result set(HAVE_WINTERNL_H 1) diff --git a/src/mono/cmake/defines-todo.cmake b/src/mono/cmake/defines-todo.cmake index d45098d4eea4fb..8d2828d53e9ba0 100644 --- a/src/mono/cmake/defines-todo.cmake +++ b/src/mono/cmake/defines-todo.cmake @@ -4,7 +4,6 @@ #option (MAJOR_IN_MKDEV "Define to 1 if `major', `minor', and `makedev' are declared in .") #option (MAJOR_IN_SYSMACROS "Define to 1 if `major', `minor', and `makedev' are declared in .") -#option (STRERROR_R_CHAR_P "Define to 1 if strerror_r returns char *.") #option (HAVE_LIBICONV "Define to 1 if you have the `iconv' library (-liconv).") #option (ANDROID_UNIFIED_HEADERS "Whether Android NDK unified headers are used") #option (MONO_DL_NEED_USCORE "Does dlsym require leading underscore.") diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index 71c67a7b5d1362..792563b7965791 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -2541,7 +2541,6 @@ try_process_suspend (void *the_tls, MonoContext *ctx, gboolean from_breakpoint) static void suspend_vm (void) { - gboolean tp_suspend = FALSE; mono_loader_lock (); mono_coop_mutex_lock (&suspend_mutex); @@ -2557,12 +2556,6 @@ suspend_vm (void) } mono_coop_mutex_unlock (&suspend_mutex); - - if (suspend_count == 1) - /* - * Suspend creation of new threadpool threads, since they cannot run - */ - tp_suspend = TRUE; mono_loader_unlock (); } @@ -2576,7 +2569,6 @@ static void resume_vm (void) { g_assert (is_debugger_thread ()); - gboolean tp_resume = FALSE; mono_loader_lock (); @@ -2599,8 +2591,6 @@ resume_vm (void) mono_coop_mutex_unlock (&suspend_mutex); //g_assert (err == 0); - if (suspend_count == 0) - tp_resume = TRUE; mono_loader_unlock (); } @@ -5257,7 +5247,6 @@ decode_vtype (MonoType *t, MonoDomain *domain, gpointer void_addr, gpointer void { guint8 *addr = (guint8*)void_addr; guint8 *buf = (guint8*)void_buf; - gboolean is_enum; MonoClass *klass; MonoClassField *f; int nfields; @@ -5265,7 +5254,8 @@ decode_vtype (MonoType *t, MonoDomain *domain, gpointer void_addr, gpointer void MonoDomain *d; ErrorCode err; - is_enum = decode_byte (buf, &buf, limit); + /* is_enum, ignored */ + decode_byte (buf, &buf, limit); if (CHECK_PROTOCOL_VERSION(2, 61)) decode_byte (buf, &buf, limit); klass = decode_typeid (buf, &buf, limit, &d, &err); @@ -5487,7 +5477,6 @@ decode_value_internal (MonoType *t, int type, MonoDomain *domain, guint8 *addr, } else if (type == MONO_TYPE_VALUETYPE) { ERROR_DECL (error); guint8 *buf2; - gboolean is_enum; MonoClass *klass; MonoDomain *d; guint8 *vtype_buf; @@ -5499,7 +5488,7 @@ decode_value_internal (MonoType *t, int type, MonoDomain *domain, guint8 *addr, * Same as the beginning of the handle_vtype case above. */ buf2 = buf; - is_enum = decode_byte (buf, &buf, limit); + decode_byte (buf, &buf, limit); decode_byte (buf, &buf, limit); //ignore is boxed klass = decode_typeid (buf, &buf, limit, &d, &err); if (err != ERR_NONE) @@ -8927,7 +8916,7 @@ thread_commands (int command, guint8 *p, guint8 *end, Buffer *buf) for (int i = 0; i < tls->frame_count; i++) { - PRINT_DEBUG_MSG(1, "[dbg] Searching Context [%d] - [%lld] - [%lld]\n", i, (uint64_t) MONO_CONTEXT_GET_SP (&tls->frames [i]->ctx), sp_received); + PRINT_DEBUG_MSG(1, "[dbg] Searching Context [%d] - [%" PRIu64 "] - [%" PRId64 "]\n", i, (uint64_t) MONO_CONTEXT_GET_SP (&tls->frames [i]->ctx), sp_received); if (sp_received == (uint64_t)MONO_CONTEXT_GET_SP (&tls->frames [i]->ctx)) { buffer_add_int(buf, i); break; @@ -9625,8 +9614,6 @@ object_commands (int command, guint8 *p, guint8 *end, Buffer *buf) buffer_add_typeid (buf, obj->vtable->domain, mono_class_from_mono_type_internal (((MonoReflectionType*)obj->vtable->type)->type)); break; case CMD_OBJECT_REF_GET_VALUES_ICORDBG: { - gpointer iter; - iter = NULL; len = 1; MonoClass *dummy_class; int field_token = decode_int (p, &p, end); diff --git a/src/mono/mono/component/debugger-engine.c b/src/mono/mono/component/debugger-engine.c index 004dddab633c96..e1040a861c84c3 100644 --- a/src/mono/mono/component/debugger-engine.c +++ b/src/mono/mono/component/debugger-engine.c @@ -715,7 +715,7 @@ ss_req_acquire (MonoInternalThread *thread) for (i = 0; i < the_ss_reqs->len; ++i) { SingleStepReq *current_req = (SingleStepReq *)g_ptr_array_index (the_ss_reqs, i); if (current_req->thread == thread) { - current_req->refcount ++; + current_req->refcount ++; req = current_req; } } @@ -723,8 +723,8 @@ ss_req_acquire (MonoInternalThread *thread) return req; } -static int -ss_req_count () +static int +ss_req_count (void) { return the_ss_reqs->len; } diff --git a/src/mono/mono/component/event_pipe.c b/src/mono/mono/component/event_pipe.c index 24aa0952ce7aa6..0ca3a18a357728 100644 --- a/src/mono/mono/component/event_pipe.c +++ b/src/mono/mono/component/event_pipe.c @@ -11,6 +11,7 @@ #include #include +extern void ep_rt_mono_component_init (void); static bool _event_pipe_component_inited = false; struct _EventPipeProviderConfigurationNative { @@ -287,7 +288,6 @@ MonoComponentEventPipe * mono_component_event_pipe_init (void) { if (!_event_pipe_component_inited) { - extern void ep_rt_mono_component_init (void); ep_rt_mono_component_init (); _event_pipe_component_inited = true; } diff --git a/src/mono/mono/component/hot_reload.c b/src/mono/mono/component/hot_reload.c index d43cca86b251a6..83faf008067fa3 100644 --- a/src/mono/mono/component/hot_reload.c +++ b/src/mono/mono/component/hot_reload.c @@ -801,7 +801,7 @@ hot_reload_effective_table_slow (const MonoTableInfo **t, int *idx) return; GList *list = info->delta_image; - MonoImage *dmeta; + MonoImage *dmeta = NULL; int ridx; MonoTableInfo *table; int g = 0; diff --git a/src/mono/mono/eglib/gmarkup.c b/src/mono/mono/eglib/gmarkup.c index ab23d491a23557..826854a1ed3460 100644 --- a/src/mono/mono/eglib/gmarkup.c +++ b/src/mono/mono/eglib/gmarkup.c @@ -193,7 +193,7 @@ parse_name (const char *p, const char *end, char **value) l = (int)(p - start); *value = g_malloc (l + 1); - if (*value == NULL) + if (*value == NULL || l <= 0) return end; strncpy (*value, start, l); (*value) [l] = 0; diff --git a/src/mono/mono/eglib/gstr.c b/src/mono/mono/eglib/gstr.c index c549b241894f14..cbf63d8f02b979 100644 --- a/src/mono/mono/eglib/gstr.c +++ b/src/mono/mono/eglib/gstr.c @@ -249,7 +249,11 @@ g_strerror (gint errnum) size_t buff_len = sizeof (tmp_buff); buff [0] = 0; -#ifndef STRERROR_R_CHAR_P +#if HAVE_GNU_STRERROR_R + buff = strerror_r (errnum, buff, buff_len); + if (!error_messages [errnum]) + error_messages [errnum] = g_strdup (buff); +#else /* HAVE_GNU_STRERROR_R */ int r; while ((r = strerror_r (errnum, buff, buff_len - 1))) { if (r != ERANGE) { @@ -261,17 +265,13 @@ g_strerror (gint errnum) else buff = g_realloc (buff, buff_len * 2); buff_len *= 2; - //Spec is not clean on whether size argument includes space for null terminator or not + //Spec is not clean on whether size argument includes space for null terminator or not } if (!error_messages [errnum]) error_messages [errnum] = g_strdup (buff); if (buff != tmp_buff) g_free (buff); -#else /* STRERROR_R_CHAR_P */ - buff = strerror_r (errnum, buff, buff_len); - if (!error_messages [errnum]) - error_messages [errnum] = g_strdup (buff); -#endif /* STRERROR_R_CHAR_P */ +#endif /* HAVE_GNU_STRERROR_R */ #else /* HAVE_STRERROR_R */ if (!error_messages [errnum]) diff --git a/src/mono/mono/eventpipe/ds-rt-mono.c b/src/mono/mono/eventpipe/ds-rt-mono.c index 17d42061be5f73..58e8754f4290c5 100644 --- a/src/mono/mono/eventpipe/ds-rt-mono.c +++ b/src/mono/mono/eventpipe/ds-rt-mono.c @@ -158,7 +158,7 @@ ipc_get_process_id_disambiguation_key ( // All the format specifiers for the fields in the stat file are provided by 'man proc'. int result_sscanf = sscanf (scan_start_position, - "%*c %*d %*d %*d %*d %*d %*u %*lu %*lu %*lu %*lu %*lu %*lu %*ld %*ld %*ld %*ld %*ld %*ld %llu \n", + "%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %*u %*d %*d %*d %*d %*d %*d %llu \n", &start_time); if (result_sscanf != 1) { diff --git a/src/mono/mono/eventpipe/ep-rt-mono.c b/src/mono/mono/eventpipe/ep-rt-mono.c index 4140605490da39..c78ab44b56dfd5 100644 --- a/src/mono/mono/eventpipe/ep-rt-mono.c +++ b/src/mono/mono/eventpipe/ep-rt-mono.c @@ -30,6 +30,8 @@ #include #include +extern void InitProvidersAndEvents (void); + // EventPipe rt init state. gboolean _ep_rt_mono_initialized; @@ -1826,7 +1828,6 @@ profiler_eventpipe_thread_exited ( MonoProfiler *prof, uintptr_t tid) { - void ep_rt_mono_thread_exited (void); ep_rt_mono_thread_exited (); } @@ -2414,7 +2415,6 @@ ep_rt_mono_os_environment_get_utf16 (ep_rt_env_array_utf16_t *env_array) void ep_rt_mono_init_providers_and_events (void) { - extern void InitProvidersAndEvents (void); InitProvidersAndEvents (); } diff --git a/src/mono/mono/eventpipe/ep-rt-mono.h b/src/mono/mono/eventpipe/ep-rt-mono.h index 937608a2a697d9..02ba8024a7fc76 100644 --- a/src/mono/mono/eventpipe/ep-rt-mono.h +++ b/src/mono/mono/eventpipe/ep-rt-mono.h @@ -352,6 +352,34 @@ prefix_name ## _rt_ ## type_name ## _ ## func_name #define EP_RT_DEFINE_HASH_MAP_ITERATOR(hash_map_name, hash_map_type, iterator_type, key_type, value_type) \ EP_RT_DEFINE_HASH_MAP_ITERATOR_PREFIX(ep, hash_map_name, hash_map_type, iterator_type, key_type, value_type) +extern char *_ep_rt_mono_os_cmd_line; +extern mono_lazy_init_t _ep_rt_mono_os_cmd_line_init; +extern char *_ep_rt_mono_managed_cmd_line; +extern mono_lazy_init_t _ep_rt_mono_managed_cmd_line_init; +extern ep_rt_spin_lock_handle_t _ep_rt_mono_config_lock; +extern void * ep_rt_mono_thread_attach (bool background_thread); +extern void * ep_rt_mono_thread_attach_2 (bool background_thread, EventPipeThreadType thread_type); +extern void ep_rt_mono_thread_detach (void); +extern void ep_rt_mono_init (void); +extern void ep_rt_mono_init_finish (void); +extern void ep_rt_mono_fini (void); +extern bool ep_rt_mono_walk_managed_stack_for_thread (ep_rt_thread_handle_t thread, EventPipeStackContents *stack_contents); +extern bool ep_rt_mono_method_get_simple_assembly_name (ep_rt_method_desc_t *method, ep_char8_t *name, size_t name_len); +extern bool ep_rt_mono_method_get_full_name (ep_rt_method_desc_t *method, ep_char8_t *name, size_t name_len); +extern void ep_rt_mono_provider_config_init (EventPipeProviderConfiguration *provider_config); +extern void ep_rt_mono_init_providers_and_events (void); +extern bool ep_rt_mono_providers_validate_all_disabled (void); +extern bool ep_rt_mono_sample_profiler_write_sampling_event_for_threads (ep_rt_thread_handle_t sampling_thread, EventPipeEvent *sampling_event); +extern bool ep_rt_mono_rand_try_get_bytes (uint8_t *buffer,size_t buffer_size); +extern void ep_rt_mono_execute_rundown (ep_rt_execution_checkpoint_array_t *execution_checkpoints); +extern int64_t ep_rt_mono_perf_counter_query (void); +extern int64_t ep_rt_mono_perf_frequency_query (void); +extern void ep_rt_mono_system_time_get (EventPipeSystemTime *system_time); +extern int64_t ep_rt_mono_system_timestamp_get (void); +extern void ep_rt_mono_os_environment_get_utf16 (ep_rt_env_array_utf16_t *env_array); +extern MonoNativeTlsKey _ep_rt_mono_thread_holder_tls_id; +extern EventPipeThread * ep_rt_mono_thread_get_or_create (void); + static inline char * @@ -365,7 +393,6 @@ inline char ** os_command_line_get_ref (void) { - extern char *_ep_rt_mono_os_cmd_line; return &_ep_rt_mono_os_cmd_line; } @@ -374,7 +401,6 @@ inline mono_lazy_init_t * os_command_line_get_init (void) { - extern mono_lazy_init_t _ep_rt_mono_os_cmd_line_init; return &_ep_rt_mono_os_cmd_line_init; } @@ -409,7 +435,6 @@ inline char ** managed_command_line_get_ref (void) { - extern char *_ep_rt_mono_managed_cmd_line; return &_ep_rt_mono_managed_cmd_line; } @@ -418,7 +443,6 @@ inline mono_lazy_init_t * managed_command_line_get_init (void) { - extern mono_lazy_init_t _ep_rt_mono_managed_cmd_line_init; return &_ep_rt_mono_managed_cmd_line_init; } @@ -445,7 +469,6 @@ inline ep_rt_spin_lock_handle_t * ep_rt_mono_config_lock_get (void) { - extern ep_rt_spin_lock_handle_t _ep_rt_mono_config_lock; return &_ep_rt_mono_config_lock; } @@ -523,7 +546,6 @@ inline void ep_rt_mono_thread_setup (bool background_thread) { - extern void * ep_rt_mono_thread_attach (bool background_thread); ep_rt_mono_thread_attach (background_thread); } @@ -532,7 +554,6 @@ inline void ep_rt_mono_thread_setup_2 (bool background_thread, EventPipeThreadType thread_type) { - extern void * ep_rt_mono_thread_attach_2 (bool background_thread, EventPipeThreadType thread_type); ep_rt_mono_thread_attach_2 (background_thread, thread_type); } @@ -541,7 +562,6 @@ inline void ep_rt_mono_thread_teardown (void) { - extern void ep_rt_mono_thread_detach (void); ep_rt_mono_thread_detach (); } @@ -624,7 +644,6 @@ inline void ep_rt_init (void) { - extern void ep_rt_mono_init (void); ep_rt_mono_init (); ep_rt_spin_lock_alloc (ep_rt_mono_config_lock_get ()); @@ -635,7 +654,6 @@ inline void ep_rt_init_finish (void) { - extern void ep_rt_mono_init_finish (void); ep_rt_mono_init_finish (); } @@ -649,7 +667,6 @@ ep_rt_shutdown (void) ep_rt_spin_lock_free (ep_rt_mono_config_lock_get ()); - extern void ep_rt_mono_fini (void); ep_rt_mono_fini (); } @@ -694,7 +711,6 @@ ep_rt_walk_managed_stack_for_thread ( ep_rt_thread_handle_t thread, EventPipeStackContents *stack_contents) { - extern bool ep_rt_mono_walk_managed_stack_for_thread (ep_rt_thread_handle_t thread, EventPipeStackContents *stack_contents); return ep_rt_mono_walk_managed_stack_for_thread (thread, stack_contents); } @@ -706,7 +722,6 @@ ep_rt_method_get_simple_assembly_name ( ep_char8_t *name, size_t name_len) { - extern bool ep_rt_mono_method_get_simple_assembly_name (ep_rt_method_desc_t *method, ep_char8_t *name, size_t name_len); return ep_rt_mono_method_get_simple_assembly_name (method, name, name_len); } @@ -718,7 +733,6 @@ ep_rt_method_get_full_name ( ep_char8_t *name, size_t name_len) { - extern bool ep_rt_mono_method_get_full_name (ep_rt_method_desc_t *method, ep_char8_t *name, size_t name_len); return ep_rt_mono_method_get_full_name (method, name, name_len); } @@ -727,7 +741,6 @@ inline void ep_rt_provider_config_init (EventPipeProviderConfiguration *provider_config) { - extern void ep_rt_mono_provider_config_init (EventPipeProviderConfiguration *provider_config); ep_rt_mono_provider_config_init (provider_config); } @@ -736,7 +749,6 @@ inline void ep_rt_init_providers_and_events (void) { - extern void ep_rt_mono_init_providers_and_events (void); ep_rt_mono_init_providers_and_events (); } @@ -745,7 +757,6 @@ inline bool ep_rt_providers_validate_all_disabled (void) { - extern bool ep_rt_mono_providers_validate_all_disabled (void); return ep_rt_mono_providers_validate_all_disabled (); } @@ -956,7 +967,6 @@ static void ep_rt_sample_profiler_write_sampling_event_for_threads (ep_rt_thread_handle_t sampling_thread, EventPipeEvent *sampling_event) { - extern bool ep_rt_mono_sample_profiler_write_sampling_event_for_threads (ep_rt_thread_handle_t sampling_thread, EventPipeEvent *sampling_event); ep_rt_mono_sample_profiler_write_sampling_event_for_threads (sampling_thread, sampling_event); } @@ -1169,7 +1179,6 @@ ep_rt_create_activity_id ( EP_ASSERT (activity_id != NULL); EP_ASSERT (activity_id_len == EP_ACTIVITY_ID_SIZE); - extern bool ep_rt_mono_rand_try_get_bytes (uint8_t *buffer,size_t buffer_size); ep_rt_mono_rand_try_get_bytes ((guchar *)activity_id, EP_ACTIVITY_ID_SIZE); const uint16_t version_mask = 0xF000; @@ -1212,7 +1221,6 @@ ep_rt_execute_rundown (ep_rt_execution_checkpoint_array_t *execution_checkpoints if (ep_rt_config_value_get_rundown () > 0) { // Ask the runtime to emit rundown events. if (/*is_running &&*/ !ep_rt_process_shutdown ()) { - extern void ep_rt_mono_execute_rundown (ep_rt_execution_checkpoint_array_t *execution_checkpoints); ep_rt_mono_execute_rundown (execution_checkpoints); } } @@ -1345,7 +1353,6 @@ inline int64_t ep_rt_perf_counter_query (void) { - extern int64_t ep_rt_mono_perf_counter_query (void); return ep_rt_mono_perf_counter_query (); } @@ -1354,7 +1361,6 @@ inline int64_t ep_rt_perf_frequency_query (void) { - extern int64_t ep_rt_mono_perf_frequency_query (void); return ep_rt_mono_perf_frequency_query (); } @@ -1363,7 +1369,6 @@ inline void ep_rt_system_time_get (EventPipeSystemTime *system_time) { - extern void ep_rt_mono_system_time_get (EventPipeSystemTime *system_time); ep_rt_mono_system_time_get (system_time); } @@ -1372,7 +1377,6 @@ inline int64_t ep_rt_system_timestamp_get (void) { - extern int64_t ep_rt_mono_system_timestamp_get (void); return ep_rt_mono_system_timestamp_get (); } @@ -1503,7 +1507,6 @@ inline void ep_rt_os_environment_get_utf16 (ep_rt_env_array_utf16_t *env_array) { - extern void ep_rt_mono_os_environment_get_utf16 (ep_rt_env_array_utf16_t *env_array); ep_rt_mono_os_environment_get_utf16 (env_array); } @@ -1894,7 +1897,6 @@ inline EventPipeThread * ep_rt_thread_get (void) { - extern MonoNativeTlsKey _ep_rt_mono_thread_holder_tls_id; EventPipeThreadHolder *thread_holder = (EventPipeThreadHolder *)mono_native_tls_get_value (_ep_rt_mono_thread_holder_tls_id); return thread_holder ? ep_thread_holder_get_thread (thread_holder) : NULL; } @@ -1906,7 +1908,6 @@ ep_rt_thread_get_or_create (void) { EventPipeThread *thread = ep_rt_thread_get (); if (!thread) { - extern EventPipeThread * ep_rt_mono_thread_get_or_create (void); thread = ep_rt_mono_thread_get_or_create (); } return thread; diff --git a/src/mono/mono/metadata/assembly.c b/src/mono/mono/metadata/assembly.c index 2228a3ed47aba0..1014840fc3f54f 100644 --- a/src/mono/mono/metadata/assembly.c +++ b/src/mono/mono/metadata/assembly.c @@ -80,13 +80,13 @@ static char* unquote (const char *str); static mono_mutex_t assemblies_mutex; static inline void -mono_assemblies_lock () +mono_assemblies_lock (void) { mono_os_mutex_lock (&assemblies_mutex); } static inline void -mono_assemblies_unlock () +mono_assemblies_unlock (void) { mono_os_mutex_unlock (&assemblies_mutex); } diff --git a/src/mono/mono/metadata/class-setup-vtable.c b/src/mono/mono/metadata/class-setup-vtable.c index 69dea4e592d745..e1d66fe05eb1e2 100644 --- a/src/mono/mono/metadata/class-setup-vtable.c +++ b/src/mono/mono/metadata/class-setup-vtable.c @@ -1783,22 +1783,22 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o if (mono_class_has_failure (klass)) goto fail; } - + // Loop on all implemented interfaces... for (i = 0; i < klass->interface_offsets_count; i++) { MonoClass *parent = klass->parent; int ic_offset; gboolean interface_is_explicitly_implemented_by_class; - gboolean variant_itf; + gboolean variant_itf = FALSE; int im_index; - + ic = klass->interfaces_packed [i]; ic_offset = mono_class_interface_offset (klass, ic); mono_class_setup_methods (ic); if (mono_class_has_failure (ic)) goto fail; - + // Check if this interface is explicitly implemented (instead of just inherited) if (parent != NULL) { int implemented_interfaces_index; @@ -1812,6 +1812,7 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o if (variant_itf) { if (mono_class_is_variant_compatible (ic, klass->interfaces [implemented_interfaces_index], FALSE)) { MonoClass *impl_itf; + (void)impl_itf; // conditionally used impl_itf = klass->interfaces [implemented_interfaces_index]; TRACE_INTERFACE_VTABLE (printf (" variant interface '%s' is explicitly implemented by '%s'\n", mono_type_full_name (m_class_get_byval_arg (ic)), mono_type_full_name (m_class_get_byval_arg (impl_itf)))); interface_is_explicitly_implemented_by_class = TRUE; diff --git a/src/mono/mono/metadata/components.c b/src/mono/mono/metadata/components.c index 242580434fd37d..1794d1e6fc51c1 100644 --- a/src/mono/mono/metadata/components.c +++ b/src/mono/mono/metadata/components.c @@ -43,12 +43,12 @@ typedef struct _MonoComponentEntry { #define DEBUGGER_LIBRARY_NAME "debugger" #define DEBUGGER_COMPONENT_NAME DEBUGGER_LIBRARY_NAME -MonoComponentHotReload *hot_reload = NULL; +MonoComponentHotReload *mono_component_hot_reload_private_ptr = NULL; -MonoComponentDebugger *debugger = NULL; +MonoComponentDebugger *mono_component_debugger_private_ptr = NULL; -MonoComponentEventPipe *event_pipe = NULL; -MonoComponentDiagnosticsServer *diagnostics_server = NULL; +MonoComponentEventPipe *mono_component_event_pipe_private_ptr = NULL; +MonoComponentDiagnosticsServer *mono_component_diagnostics_server_private_ptr = NULL; // DiagnosticsServer/EventPipe components currently hosted by diagnostics_tracing library. #define DIAGNOSTICS_TRACING_LIBRARY_NAME "diagnostics_tracing" @@ -57,10 +57,10 @@ MonoComponentDiagnosticsServer *diagnostics_server = NULL; /* One per component */ MonoComponentEntry components[] = { - { DEBUGGER_LIBRARY_NAME, DEBUGGER_COMPONENT_NAME, COMPONENT_INIT_FUNC (debugger), (MonoComponent**)&debugger, NULL }, - { HOT_RELOAD_LIBRARY_NAME, HOT_RELOAD_COMPONENT_NAME, COMPONENT_INIT_FUNC (hot_reload), (MonoComponent**)&hot_reload, NULL }, - { DIAGNOSTICS_TRACING_LIBRARY_NAME, EVENT_PIPE_COMPONENT_NAME, COMPONENT_INIT_FUNC (event_pipe), (MonoComponent**)&event_pipe, NULL }, - { DIAGNOSTICS_TRACING_LIBRARY_NAME, DIAGNOSTICS_SERVER_COMPONENT_NAME, COMPONENT_INIT_FUNC (diagnostics_server), (MonoComponent**)&diagnostics_server, NULL }, + { DEBUGGER_LIBRARY_NAME, DEBUGGER_COMPONENT_NAME, COMPONENT_INIT_FUNC (debugger), (MonoComponent**)&mono_component_debugger_private_ptr, NULL }, + { HOT_RELOAD_LIBRARY_NAME, HOT_RELOAD_COMPONENT_NAME, COMPONENT_INIT_FUNC (hot_reload), (MonoComponent**)&mono_component_hot_reload_private_ptr, NULL }, + { DIAGNOSTICS_TRACING_LIBRARY_NAME, EVENT_PIPE_COMPONENT_NAME, COMPONENT_INIT_FUNC (event_pipe), (MonoComponent**)&mono_component_event_pipe_private_ptr, NULL }, + { DIAGNOSTICS_TRACING_LIBRARY_NAME, DIAGNOSTICS_SERVER_COMPONENT_NAME, COMPONENT_INIT_FUNC (diagnostics_server), (MonoComponent**)&mono_component_diagnostics_server_private_ptr, NULL }, }; #ifndef STATIC_COMPONENTS diff --git a/src/mono/mono/metadata/components.h b/src/mono/mono/metadata/components.h index 2aceed820c9d3d..aba03174589432 100644 --- a/src/mono/mono/metadata/components.h +++ b/src/mono/mono/metadata/components.h @@ -20,37 +20,38 @@ mono_component_event_pipe_100ns_ticks_stop (void); void mono_components_init (void); +extern MonoComponentHotReload *mono_component_hot_reload_private_ptr; +extern MonoComponentEventPipe *mono_component_event_pipe_private_ptr; +extern MonoComponentDiagnosticsServer *mono_component_diagnostics_server_private_ptr; +extern MonoComponentDebugger *mono_component_debugger_private_ptr; + /* Declare each component's getter function here */ static inline MonoComponentHotReload * mono_component_hot_reload (void) { - extern MonoComponentHotReload *hot_reload; - return hot_reload; + return mono_component_hot_reload_private_ptr; } static inline MonoComponentEventPipe * mono_component_event_pipe (void) { - extern MonoComponentEventPipe *event_pipe; - return event_pipe; + return mono_component_event_pipe_private_ptr; } static inline MonoComponentDiagnosticsServer * mono_component_diagnostics_server (void) { - extern MonoComponentDiagnosticsServer *diagnostics_server; - return diagnostics_server; + return mono_component_diagnostics_server_private_ptr; } static inline MonoComponentDebugger * mono_component_debugger (void) { - extern MonoComponentDebugger *debugger; - return debugger; + return mono_component_debugger_private_ptr; } #endif/*_MONO_METADATA_COMPONENTS_H*/ diff --git a/src/mono/mono/metadata/custom-attrs.c b/src/mono/mono/metadata/custom-attrs.c index 29c64c48f3fafc..b70349f20789b9 100644 --- a/src/mono/mono/metadata/custom-attrs.c +++ b/src/mono/mono/metadata/custom-attrs.c @@ -1366,7 +1366,7 @@ ves_icall_System_Reflection_RuntimeCustomAttributeData_ResolveArgumentsInternal MonoReflectionMethod *ref_method = MONO_HANDLE_RAW (ref_method_h); MonoReflectionAssembly *assembly = MONO_HANDLE_RAW (assembly_h); MonoMethodSignature *sig; - MonoObjectHandle obj_h, namedarg_h, typedarg_h, minfo_h; + MonoObjectHandle obj_h, namedarg_h, minfo_h; int i; if (len == 0) @@ -1374,7 +1374,6 @@ ves_icall_System_Reflection_RuntimeCustomAttributeData_ResolveArgumentsInternal obj_h = MONO_HANDLE_NEW (MonoObject, NULL); namedarg_h = MONO_HANDLE_NEW (MonoObject, NULL); - typedarg_h = MONO_HANDLE_NEW (MonoObject, NULL); minfo_h = MONO_HANDLE_NEW (MonoObject, NULL); image = assembly->assembly->image; diff --git a/src/mono/mono/metadata/gc.c b/src/mono/mono/metadata/gc.c index e6564335b949aa..8c0745705e8613 100644 --- a/src/mono/mono/metadata/gc.c +++ b/src/mono/mono/metadata/gc.c @@ -190,7 +190,6 @@ mono_gc_run_finalize (void *obj, void *data) #endif MonoMethod* finalizer = NULL; MonoDomain *caller_domain = mono_domain_get (); - MonoDomain *domain; // This function is called from the innards of the GC, so our best alternative for now is to do polling here mono_threads_safepoint (); @@ -223,8 +222,6 @@ mono_gc_run_finalize (void *obj, void *data) if (suspend_finalizers) return; - domain = o->vtable->domain; - #ifndef HAVE_SGEN_GC finalizers_lock (); diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index da35682da1321d..43d826dd67c6f6 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -1107,12 +1107,12 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetUninitializedObjectI } if (m_class_is_abstract (klass) || m_class_is_interface (klass) || m_class_is_gtd (klass)) { - mono_error_set_member_access (error, NULL, NULL); + mono_error_set_member_access (error, NULL); return NULL_HANDLE; } if (m_class_is_byreflike (klass)) { - mono_error_set_not_supported (error, NULL, NULL); + mono_error_set_not_supported (error, NULL); return NULL_HANDLE; } @@ -3371,7 +3371,6 @@ ves_icall_InternalInvoke (MonoReflectionMethodHandle method_handle, MonoObjectHa */ MonoMethod *m = method->method; MonoMethodSignature* const sig = mono_method_signature_internal (m); - MonoImage *image = NULL; int pcount = 0; void *obj = this_arg; char *this_name = NULL; @@ -3404,8 +3403,6 @@ ves_icall_InternalInvoke (MonoReflectionMethodHandle method_handle, MonoObjectHa } } - image = m_class_get_image (m->klass); - if (m_class_get_rank (m->klass) && !strcmp (m->name, ".ctor")) { int i; pcount = mono_span_length (params_span); @@ -6571,7 +6568,6 @@ ves_icall_RuntimeParameterInfo_GetTypeModifiers (MonoReflectionTypeHandle rt, Mo MonoType *type = MONO_HANDLE_GETVAL (rt, type); MonoClass *member_class = mono_handle_class (member); MonoMethod *method = NULL; - MonoImage *image; MonoMethodSignature *sig; if (mono_class_is_reflection_method_or_constructor (member_class)) { @@ -6594,7 +6590,6 @@ ves_icall_RuntimeParameterInfo_GetTypeModifiers (MonoReflectionTypeHandle rt, Mo return NULL_HANDLE_ARRAY; } - image = m_class_get_image (method->klass); sig = mono_method_signature_internal (method); if (pos == -1) type = sig->ret; diff --git a/src/mono/mono/metadata/marshal-ilgen.c b/src/mono/mono/metadata/marshal-ilgen.c index 3c0ec3d799e07b..8df471352803e8 100644 --- a/src/mono/mono/metadata/marshal-ilgen.c +++ b/src/mono/mono/metadata/marshal-ilgen.c @@ -5398,7 +5398,7 @@ emit_marshal_safehandle_ilgen (EmitMarshalContext *m, int argnum, MonoType *t, case MARSHAL_ACTION_CONV_OUT: { /* The slot for the boolean is the next temporary created after conv_arg, see the CONV_IN code */ int dar_release_slot = conv_arg + 1; - int label_next; + int label_next = 0; if (!sh_dangerous_release) init_safe_handle (); @@ -5455,7 +5455,7 @@ emit_marshal_safehandle_ilgen (EmitMarshalContext *m, int argnum, MonoType *t, mono_mb_emit_ldloc (mb, conv_arg); mono_mb_emit_byte (mb, CEE_STIND_I); - if (is_in (t)) { + if (is_in (t) && label_next) { mono_mb_patch_branch (mb, label_next); } } diff --git a/src/mono/mono/metadata/sre-encode.c b/src/mono/mono/metadata/sre-encode.c index c44a6efc89b04a..450b6f37d72d39 100644 --- a/src/mono/mono/metadata/sre-encode.c +++ b/src/mono/mono/metadata/sre-encode.c @@ -422,7 +422,7 @@ mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType * HANDLE_FUNCTION_ENTER (); MonoDynamicTable *table; - guint32 token, scope, enclosing; + guint32 token, enclosing; MonoClass *klass; /* if the type requires a typespec, we must try that first*/ @@ -450,9 +450,6 @@ mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType * enclosing = mono_dynimage_encode_typedef_or_ref_full (assembly, m_class_get_byval_arg (m_class_get_nested_in (klass)), FALSE); /* get the typeref idx of the enclosing type */ enclosing >>= MONO_TYPEDEFORREF_BITS; - scope = (enclosing << MONO_RESOLUTION_SCOPE_BITS) | MONO_RESOLUTION_SCOPE_TYPEREF; - } else { - scope = mono_reflection_resolution_scope_from_image (assembly, m_class_get_image (klass)); } table = &assembly->tables [MONO_TABLE_TYPEREF]; token = MONO_TYPEDEFORREF_TYPEREF | (table->next_idx << MONO_TYPEDEFORREF_BITS); /* typeref */ diff --git a/src/mono/mono/metadata/sre.c b/src/mono/mono/metadata/sre.c index 96b02bd7767297..d86b18b1bcc0c9 100644 --- a/src/mono/mono/metadata/sre.c +++ b/src/mono/mono/metadata/sre.c @@ -757,7 +757,6 @@ is_field_on_gtd (MonoClassField *field) static guint32 mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoClassField *field) { - MonoType *type; guint32 token; g_assert (field); @@ -767,12 +766,6 @@ mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoClassField *field if (token) return token; - if (mono_class_is_ginst (field->parent) && mono_class_get_generic_class (field->parent)->container_class && mono_class_get_generic_class (field->parent)->container_class->fields) { - int index = field - field->parent->fields; - type = mono_field_get_type_internal (&mono_class_get_generic_class (field->parent)->container_class->fields [index]); - } else { - type = mono_field_get_type_internal (field); - } token = mono_image_get_memberref_token (assembly, m_class_get_byval_arg (field->parent)); g_hash_table_insert (assembly->handleref, field, GUINT_TO_POINTER(token)); return token; diff --git a/src/mono/mono/metadata/threads.c b/src/mono/mono/metadata/threads.c index 1a1df11673ee9b..3d11d85ea97483 100644 --- a/src/mono/mono/metadata/threads.c +++ b/src/mono/mono/metadata/threads.c @@ -149,12 +149,12 @@ static MonoCoopMutex joinable_threads_mutex; static GSList *exiting_threads; static MonoCoopMutex exiting_threads_mutex; static inline void -exiting_threads_lock () +exiting_threads_lock (void) { mono_coop_mutex_lock (&exiting_threads_mutex); } static inline void -exiting_threads_unlock () +exiting_threads_unlock (void) { mono_coop_mutex_unlock (&exiting_threads_mutex); } diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 61dc54ce5c7b6c..9a46d36be63515 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -796,7 +796,9 @@ emit_info_symbol (MonoAotCompile *acfg, const char *name, gboolean func) if (acfg->llvm) { emit_label (acfg, name); /* LLVM generated code references this */ - sprintf (symbol, "%s%s%s", acfg->user_symbol_prefix, acfg->global_prefix, name); + int n = snprintf (symbol, MAX_SYMBOL_SIZE, "%s%s%s", acfg->user_symbol_prefix, acfg->global_prefix, name); + if (n >= MAX_SYMBOL_SIZE) + symbol[MAX_SYMBOL_SIZE - 1] = 0; emit_label (acfg, symbol); #ifndef TARGET_WIN32_MSVC @@ -9454,7 +9456,7 @@ append_mangled_signature (GString *s, MonoMethodSignature *sig) supported = append_mangled_type (s, sig->ret); if (!supported) return FALSE; - g_string_append_printf (s, "_"); + g_string_append_printf (s, "_"); if (sig->hasthis) g_string_append_printf (s, "this_"); for (i = 0; i < sig->param_count; ++i) { @@ -9467,7 +9469,7 @@ append_mangled_signature (GString *s, MonoMethodSignature *sig) } static void -append_mangled_wrapper_type (GString *s, guint32 wrapper_type) +append_mangled_wrapper_type (GString *s, guint32 wrapper_type) { const char *label; diff --git a/src/mono/mono/mini/aot-runtime.c b/src/mono/mono/mini/aot-runtime.c index d4de90f4b64df5..dbb35bd6209203 100644 --- a/src/mono/mono/mini/aot-runtime.c +++ b/src/mono/mono/mini/aot-runtime.c @@ -3442,19 +3442,14 @@ mono_aot_find_jit_info (MonoImage *image, gpointer addr) MonoJitInfo *jinfo; guint8 *code, *ex_info, *p; guint32 *table; - int nmethods; gpointer *methods; guint8 *code1, *code2; int methods_len; gboolean async; - gpointer orig_addr; if (!amodule) return NULL; - nmethods = amodule->info.nmethods; - - orig_addr = addr; addr = MINI_FTNPTR_TO_ADDR (addr); if (!amodule_contains_code_addr (amodule, (guint8 *)addr)) diff --git a/src/mono/mono/mini/calls.c b/src/mono/mono/mini/calls.c index 51a61f61d34d2f..52ae664a18fe63 100644 --- a/src/mono/mono/mini/calls.c +++ b/src/mono/mono/mini/calls.c @@ -451,7 +451,6 @@ mini_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign MonoInst **args, MonoInst *this_ins, MonoInst *imt_arg, MonoInst *rgctx_arg) { gboolean virtual_ = this_ins != NULL; - int context_used; MonoCallInst *call; int rgctx_reg = 0; gboolean need_unbox_trampoline; @@ -473,7 +472,7 @@ mini_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign sig = ctor_sig; } - context_used = mini_method_check_context_used (cfg, method); + mini_method_check_context_used (cfg, method); if (cfg->llvm_only && virtual_ && (method->flags & METHOD_ATTRIBUTE_VIRTUAL)) return mini_emit_llvmonly_virtual_call (cfg, method, sig, 0, args); diff --git a/src/mono/mono/mini/driver.c b/src/mono/mono/mini/driver.c index 34886a23d63588..9ad3f21a12d87d 100644 --- a/src/mono/mono/mini/driver.c +++ b/src/mono/mono/mini/driver.c @@ -2067,7 +2067,6 @@ mono_main (int argc, char* argv[]) MonoDomain *domain; MonoImageOpenStatus open_status; const char* aname, *mname = NULL; - char *config_file = NULL; int i, count = 1; guint32 opt, action = DO_EXEC, recompilation_times = 1; MonoGraphOptions mono_graph_options = (MonoGraphOptions)0; @@ -2218,7 +2217,7 @@ mono_main (int argc, char* argv[]) fprintf (stderr, "error: --config requires a filename argument\n"); return 1; } - config_file = argv [++i]; + ++i; #ifdef HOST_WIN32 } else if (strcmp (argv [i], "--mixed-mode") == 0) { mixed_mode = TRUE; diff --git a/src/mono/mono/mini/ir-emit.h b/src/mono/mono/mini/ir-emit.h index 5ab8f38defb61a..6177261f3507f4 100644 --- a/src/mono/mono/mini/ir-emit.h +++ b/src/mono/mono/mini/ir-emit.h @@ -856,10 +856,11 @@ static int ccount = 0; if (cfg->cbb->last_ins && MONO_IS_COND_BRANCH_OP (cfg->cbb->last_ins) && !cfg->cbb->last_ins->inst_false_bb) { \ cfg->cbb->last_ins->inst_false_bb = (bblock); \ mono_link_bblock ((cfg), (cfg)->cbb, (bblock)); \ - } else if (! (cfg->cbb->last_ins && ((cfg->cbb->last_ins->opcode == OP_BR) || (cfg->cbb->last_ins->opcode == OP_BR_REG) || MONO_IS_COND_BRANCH_OP (cfg->cbb->last_ins)))) \ + } else if (! (cfg->cbb->last_ins && ((cfg->cbb->last_ins->opcode == OP_BR) || (cfg->cbb->last_ins->opcode == OP_BR_REG) || MONO_IS_COND_BRANCH_OP (cfg->cbb->last_ins)))) { \ mono_link_bblock ((cfg), (cfg)->cbb, (bblock)); \ - (cfg)->cbb->next_bb = (bblock); \ - (cfg)->cbb = (bblock); \ + } \ + (cfg)->cbb->next_bb = (bblock); \ + (cfg)->cbb = (bblock); \ } while (0) /* This marks a place in code where an implicit exception could be thrown */ diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 4d0dd5f6ff2114..9e5d8e42bde580 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -7215,7 +7215,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b gboolean direct_icall; direct_icall = FALSE; gboolean tailcall_calli; tailcall_calli = FALSE; gboolean noreturn; noreturn = FALSE; +#ifdef TARGET_WASM gboolean needs_stack_walk; needs_stack_walk = FALSE; +#endif // Variables shared by CEE_CALLI and CEE_CALL/CEE_CALLVIRT. common_call = FALSE; @@ -7244,7 +7246,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b printf ("cmethod = %s\n", mono_method_get_full_name (cmethod)); MonoMethod *cil_method; cil_method = cmethod; - if (constrained_class) { if (m_method_is_static (cil_method) && mini_class_check_context_used (cfg, constrained_class)) // FIXME: @@ -7262,7 +7263,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b g_assert (cmethod); } } - + if (!dont_verify && !cfg->skip_visibility) { MonoMethod *target_method = cil_method; if (method->is_inflated) { @@ -7281,9 +7282,12 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b /* Use the interpreter instead */ cfg->exception_message = g_strdup ("stack walk"); cfg->disable_llvm = TRUE; - } else { + } +#ifdef TARGET_WASM + else { needs_stack_walk = TRUE; } +#endif } if (!virtual_ && (cmethod->flags & METHOD_ATTRIBUTE_ABSTRACT)) { diff --git a/src/mono/mono/mini/mini-generic-sharing.c b/src/mono/mono/mini/mini-generic-sharing.c index a9ac88c5938015..69e0a16debf72b 100644 --- a/src/mono/mono/mini/mini-generic-sharing.c +++ b/src/mono/mono/mini/mini-generic-sharing.c @@ -4017,7 +4017,6 @@ mini_get_shared_gparam (MonoType *t, MonoType *constraint) MonoGenericParam *par = t->data.generic_param; MonoGSharedGenericParam *copy, key; MonoType *res; - MonoImage *image = NULL; char *name; mm = mono_mem_manager_merge (mono_metadata_get_mem_manager_for_type (t), mono_metadata_get_mem_manager_for_type (constraint)); @@ -4027,7 +4026,6 @@ mini_get_shared_gparam (MonoType *t, MonoType *constraint) key.param.gshared_constraint = constraint; g_assert (mono_generic_param_info (par)); - image = mono_get_image_for_generic_param(par); /* * Need a cache to ensure the newly created gparam diff --git a/src/mono/mono/mini/mini-trampolines.c b/src/mono/mono/mini/mini-trampolines.c index 1535256ca9aece..84aeee956586fd 100644 --- a/src/mono/mono/mini/mini-trampolines.c +++ b/src/mono/mono/mini/mini-trampolines.c @@ -454,12 +454,10 @@ common_call_trampoline (host_mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTa /* IMT call */ if (imt_call) { MonoMethod *imt_method = NULL, *impl_method = NULL; - MonoObject *this_arg; g_assert (vtable_slot); imt_method = mono_arch_find_imt_method (regs, code); - this_arg = (MonoObject *)mono_arch_get_this_arg_from_call (regs, code); { if (imt_method->is_inflated && ((MonoMethodInflated*)imt_method)->context.method_inst) { diff --git a/src/mono/mono/mini/simd-intrinsics.c b/src/mono/mono/mini/simd-intrinsics.c index 08edf9292ea2c3..38e40bffde0f83 100644 --- a/src/mono/mono/mini/simd-intrinsics.c +++ b/src/mono/mono/mini/simd-intrinsics.c @@ -2946,7 +2946,7 @@ static MonoInst* emit_vector256_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) { MonoInst *ins; - MonoType *type, *etype; + MonoType *etype; MonoClass *klass; int size, len, id; @@ -2955,7 +2955,6 @@ emit_vector256_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fs return NULL; klass = cmethod->klass; - type = m_class_get_byval_arg (klass); etype = mono_class_get_context (klass)->class_inst->type_argv [0]; size = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL); g_assert (size); diff --git a/src/mono/mono/sgen/sgen-hash-table.c b/src/mono/mono/sgen/sgen-hash-table.c index 3ceebc77f30c73..e9c921588a4d51 100644 --- a/src/mono/mono/sgen/sgen-hash-table.c +++ b/src/mono/mono/sgen/sgen-hash-table.c @@ -119,7 +119,7 @@ sgen_hash_table_lookup (SgenHashTable *hash_table, gpointer key) gboolean sgen_hash_table_replace (SgenHashTable *hash_table, gpointer key, gpointer new_value, gpointer old_value) { - guint hash; + guint hash = 0; SgenHashTableEntry *entry; rehash_if_necessary (hash_table); @@ -127,7 +127,7 @@ sgen_hash_table_replace (SgenHashTable *hash_table, gpointer key, gpointer new_v if (entry) { if (old_value) - memcpy (old_value, entry->data, hash_table->data_size); + memcpy (old_value, entry->data, hash_table->data_size); memcpy (entry->data, new_value, hash_table->data_size); return FALSE; } diff --git a/src/mono/mono/utils/mono-hwcap-vars.h b/src/mono/mono/utils/mono-hwcap-vars.h index 2c60a6441394db..b549bbc54bd2bd 100644 --- a/src/mono/mono/utils/mono-hwcap-vars.h +++ b/src/mono/mono/utils/mono-hwcap-vars.h @@ -81,7 +81,9 @@ MONO_HWCAP_VAR(x86_has_lzcnt) MONO_HWCAP_VAR(x86_has_popcnt) MONO_HWCAP_VAR(x86_has_avx) -gboolean -mono_hwcap_x86_call_cpuidex (int id, int sub_id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx); +#ifndef MONO_X86_CPUIDEX +#define MONO_X86_CPUIDEX +gboolean mono_hwcap_x86_call_cpuidex (int id, int sub_id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx); +#endif #endif diff --git a/src/mono/mono/utils/mono-proclib.c b/src/mono/mono/utils/mono-proclib.c index 1fe731d9fe0f59..9a33fc2924e6bc 100644 --- a/src/mono/mono/utils/mono-proclib.c +++ b/src/mono/mono/utils/mono-proclib.c @@ -69,7 +69,7 @@ # define kinfo_name_member p_comm #elif defined(__OpenBSD__) // Can not figure out how to get the proc's start time on OpenBSD -# undef kinfo_starttime_member +# undef kinfo_starttime_member # define kinfo_pid_member p_pid # define kinfo_name_member p_comm #else @@ -81,7 +81,7 @@ #endif #ifdef HAVE_SCHED_GETAFFINITY -# ifndef GLIBC_HAS_CPU_COUNT +# ifndef HAVE_GNU_CPU_COUNT static int CPU_COUNT(cpu_set_t *set) { @@ -430,7 +430,7 @@ mono_process_get_times (gpointer pid, gint64 *start_time, gint64 *user_time, gin /* * /proc/pid/stat format: - * pid (cmdname) S + * pid (cmdname) S * [0] ppid pgid sid tty_nr tty_pgrp flags min_flt cmin_flt maj_flt cmaj_flt * [10] utime stime cutime cstime prio nice threads 0 start_time vsize * [20] rss rsslim start_code end_code start_stack esp eip pending blocked sigign @@ -445,7 +445,7 @@ mono_process_get_times (gpointer pid, gint64 *start_time, gint64 *user_time, gin static gint64 get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error) { -#if defined(__APPLE__) +#if defined(__APPLE__) double process_user_time = 0, process_system_time = 0;//, process_percent = 0; task_t task; struct task_basic_info t_info; @@ -479,16 +479,16 @@ get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error) do { ret = task_threads (task, &th_array, &th_count); } while (ret == KERN_ABORTED); - + if (ret != KERN_SUCCESS) { if (pid != getpid ()) mach_port_deallocate (mach_task_self (), task); RET_ERROR (MONO_PROCESS_ERROR_OTHER); } - + for (i = 0; i < th_count; i++) { double thread_user_time, thread_system_time;//, thread_percent; - + struct thread_basic_info th_info; mach_msg_type_number_t th_info_count = THREAD_BASIC_INFO_COUNT; do { @@ -499,13 +499,13 @@ get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error) thread_user_time = th_info.user_time.seconds + th_info.user_time.microseconds / 1e6; thread_system_time = th_info.system_time.seconds + th_info.system_time.microseconds / 1e6; //thread_percent = (double)th_info.cpu_usage / TH_USAGE_SCALE; - + process_user_time += thread_user_time; process_system_time += thread_system_time; //process_percent += th_percent; } } - + for (i = 0; i < th_count; i++) mach_port_deallocate(task, th_array[i]); @@ -514,14 +514,14 @@ get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error) process_user_time += t_info.user_time.seconds + t_info.user_time.microseconds / 1e6; process_system_time += t_info.system_time.seconds + t_info.system_time.microseconds / 1e6; - + if (pos == 10 && sum == TRUE) return (gint64)((process_user_time + process_system_time) * 10000000); else if (pos == 10) return (gint64)(process_user_time * 10000000); else if (pos == 11) return (gint64)(process_system_time * 10000000); - + return 0; #else char buf [512]; @@ -604,7 +604,7 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul { #if defined(__APPLE__) // ignore the multiplier - + gint64 ret; task_t task; task_vm_info_data_t t_info; @@ -661,7 +661,7 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul if (pid != getpid ()) mach_port_deallocate (mach_task_self (), task); - + return ret; #else char buf [64]; @@ -905,7 +905,7 @@ get_cpu_times (int cpu_id, gint64 *user, gint64 *systemt, gint64 *irq, gint64 *s } else { continue; } - + user_ticks = strtoull (data, &data, 10); nice_ticks = strtoull (data, &data, 10); system_ticks = strtoull (data, &data, 10); diff --git a/src/native/eventpipe/ds-ipc-pal-socket.c b/src/native/eventpipe/ds-ipc-pal-socket.c index 2d5f707de1e391..d02fd89c6e8295 100644 --- a/src/native/eventpipe/ds-ipc-pal-socket.c +++ b/src/native/eventpipe/ds-ipc-pal-socket.c @@ -460,8 +460,8 @@ ipc_poll_fds ( result_poll = WSAPoll (fds, (ULONG)nfds, (INT)timeout); #else #ifndef EP_NO_RT_DEPENDENCY - int64_t start; - int64_t stop; + int64_t start = 0; + int64_t stop = 0; bool retry_poll = false; do { if (timeout != EP_INFINITE_WAIT) diff --git a/src/native/eventpipe/ep-config.h b/src/native/eventpipe/ep-config.h index 84938857bf7c6e..65f6acb94bb63e 100644 --- a/src/native/eventpipe/ep-config.h +++ b/src/native/eventpipe/ep-config.h @@ -13,6 +13,8 @@ #endif #include "ep-getter-setter.h" +extern EventPipeConfiguration _ep_config_instance; + /* * EventPipeConfiguration. */ @@ -40,7 +42,6 @@ EventPipeConfiguration * ep_config_get (void) { // Singelton. - extern EventPipeConfiguration _ep_config_instance; return &_ep_config_instance; } diff --git a/src/native/eventpipe/ep-event-source.h b/src/native/eventpipe/ep-event-source.h index 81eca14345edb7..7fc27200e3de1c 100644 --- a/src/native/eventpipe/ep-event-source.h +++ b/src/native/eventpipe/ep-event-source.h @@ -12,6 +12,10 @@ #endif #include "ep-getter-setter.h" +extern const ep_char8_t *_ep_os_info; +extern const ep_char8_t *_ep_arch_info; +extern EventPipeEventSource _ep_event_source_instance; + /* * EventPipeEventSource. */ @@ -38,7 +42,6 @@ inline const ep_char8_t * ep_event_source_get_os_info (void) { - extern const ep_char8_t *_ep_os_info; return _ep_os_info; } @@ -47,7 +50,6 @@ inline const ep_char8_t * ep_event_source_get_arch_info (void) { - extern const ep_char8_t *_ep_arch_info; return _ep_arch_info; } @@ -75,7 +77,6 @@ EventPipeEventSource * ep_event_source_get (void) { // Singelton. - extern EventPipeEventSource _ep_event_source_instance; return &_ep_event_source_instance; } diff --git a/src/native/eventpipe/ep-sample-profiler.c b/src/native/eventpipe/ep-sample-profiler.c index 2414872cba9226..c219fd1cec100c 100644 --- a/src/native/eventpipe/ep-sample-profiler.c +++ b/src/native/eventpipe/ep-sample-profiler.c @@ -13,7 +13,6 @@ #define NUM_NANOSECONDS_IN_1_MS 1000000 static volatile uint32_t _profiling_enabled = (uint32_t)false; -static ep_rt_thread_handle_t _sampling_thread = NULL; static EventPipeProvider *_sampling_provider = NULL; static EventPipeEvent *_thread_time_event = NULL; static ep_rt_wait_event_handle_t _thread_shutdown_event; diff --git a/src/native/eventpipe/ep.h b/src/native/eventpipe/ep.h index f70abd4354a102..86f9616b78a823 100644 --- a/src/native/eventpipe/ep.h +++ b/src/native/eventpipe/ep.h @@ -8,6 +8,11 @@ #include "ep-stack-contents.h" #include "ep-rt.h" +extern volatile EventPipeState _ep_state; +extern volatile EventPipeSession *_ep_sessions [EP_MAX_NUMBER_OF_SESSIONS]; +extern volatile uint32_t _ep_number_of_sessions; +extern volatile uint64_t _ep_allow_write; + /* * Globals and volatile access functions. */ @@ -17,7 +22,6 @@ inline EventPipeState ep_volatile_load_eventpipe_state (void) { - extern volatile EventPipeState _ep_state; return (EventPipeState)ep_rt_volatile_load_uint32_t ((const volatile uint32_t *)&_ep_state); } @@ -26,7 +30,6 @@ inline EventPipeState ep_volatile_load_eventpipe_state_without_barrier (void) { - extern volatile EventPipeState _ep_state; return (EventPipeState)ep_rt_volatile_load_uint32_t_without_barrier ((const volatile uint32_t *)&_ep_state); } @@ -35,7 +38,6 @@ inline void ep_volatile_store_eventpipe_state (EventPipeState state) { - extern volatile EventPipeState _ep_state; ep_rt_volatile_store_uint32_t ((volatile uint32_t *)&_ep_state, state); } @@ -44,7 +46,6 @@ inline void ep_volatile_store_eventpipe_state_without_barrier (EventPipeState state) { - extern volatile EventPipeState _ep_state; ep_rt_volatile_store_uint32_t_without_barrier ((volatile uint32_t *)&_ep_state, state); } @@ -53,7 +54,6 @@ inline EventPipeSession * ep_volatile_load_session (size_t index) { - extern volatile EventPipeSession *_ep_sessions [EP_MAX_NUMBER_OF_SESSIONS]; return (EventPipeSession *)ep_rt_volatile_load_ptr ((volatile void **)(&_ep_sessions [index])); } @@ -62,7 +62,6 @@ inline EventPipeSession * ep_volatile_load_session_without_barrier (size_t index) { - extern volatile EventPipeSession *_ep_sessions [EP_MAX_NUMBER_OF_SESSIONS]; return (EventPipeSession *)ep_rt_volatile_load_ptr_without_barrier ((volatile void **)(&_ep_sessions [index])); } @@ -71,7 +70,6 @@ inline void ep_volatile_store_session (size_t index, EventPipeSession *session) { - extern volatile EventPipeSession *_ep_sessions [EP_MAX_NUMBER_OF_SESSIONS]; ep_rt_volatile_store_ptr ((volatile void **)(&_ep_sessions [index]), session); } @@ -80,7 +78,6 @@ inline void ep_volatile_store_session_without_barrier (size_t index, EventPipeSession *session) { - extern volatile EventPipeSession *_ep_sessions [EP_MAX_NUMBER_OF_SESSIONS]; ep_rt_volatile_store_ptr_without_barrier ((volatile void **)(&_ep_sessions [index]), session); } @@ -89,7 +86,6 @@ inline uint32_t ep_volatile_load_number_of_sessions (void) { - extern volatile uint32_t _ep_number_of_sessions; return ep_rt_volatile_load_uint32_t (&_ep_number_of_sessions); } @@ -98,7 +94,6 @@ inline uint32_t ep_volatile_load_number_of_sessions_without_barrier (void) { - extern volatile uint32_t _ep_number_of_sessions; return ep_rt_volatile_load_uint32_t_without_barrier (&_ep_number_of_sessions); } @@ -107,7 +102,6 @@ inline void ep_volatile_store_number_of_sessions (uint32_t number_of_sessions) { - extern volatile uint32_t _ep_number_of_sessions; ep_rt_volatile_store_uint32_t (&_ep_number_of_sessions, number_of_sessions); } @@ -116,7 +110,6 @@ inline void ep_volatile_store_number_of_sessions_without_barrier (uint32_t number_of_sessions) { - extern volatile uint32_t _ep_number_of_sessions; ep_rt_volatile_store_uint32_t_without_barrier (&_ep_number_of_sessions, number_of_sessions); } @@ -125,7 +118,6 @@ inline uint64_t ep_volatile_load_allow_write (void) { - extern volatile uint64_t _ep_allow_write; return ep_rt_volatile_load_uint64_t (&_ep_allow_write); } @@ -134,7 +126,6 @@ inline uint64_t ep_volatile_load_allow_write_without_barrier (void) { - extern volatile uint64_t _ep_allow_write; return ep_rt_volatile_load_uint64_t_without_barrier (&_ep_allow_write); } @@ -143,7 +134,6 @@ inline void ep_volatile_store_allow_write (uint64_t allow_write) { - extern volatile uint64_t _ep_allow_write; ep_rt_volatile_store_uint64_t (&_ep_allow_write, allow_write); } @@ -152,7 +142,6 @@ inline void ep_volatile_store_allow_write_without_barrier (uint64_t allow_write) { - extern volatile uint64_t _ep_allow_write; ep_rt_volatile_store_uint64_t_without_barrier (&_ep_allow_write, allow_write); }