Skip to content

Commit b673aae

Browse files
authored
Suppress clang-16 warnings (#81573)
* Suppress clang-16 warnings * Remove a strange (one-of-a-kind) workaround * Add thunk for PAL_{Unr,R}egisterModule
1 parent ec9fb02 commit b673aae

File tree

7 files changed

+31
-11
lines changed

7 files changed

+31
-11
lines changed

eng/common/native/init-compiler.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ if [ -z "$CLR_CC" ]; then
6363
# Set default versions
6464
if [ -z "$majorVersion" ]; then
6565
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
66-
if [ "$compiler" = "clang" ]; then versions="15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5"
66+
if [ "$compiler" = "clang" ]; then versions="16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5"
6767
elif [ "$compiler" = "gcc" ]; then versions="12 11 10 9 8 7 6 5 4.9"; fi
6868

6969
for version in $versions; do

eng/native/configurecompiler.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,14 @@ if (CLR_CMAKE_HOST_UNIX)
453453
add_compile_options(-Wno-incompatible-ms-struct)
454454

455455
add_compile_options(-Wno-reserved-identifier)
456+
457+
# clang 16.0 introduced buffer hardening https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734
458+
# which we are not conforming to yet.
459+
add_compile_options(-Wno-unsafe-buffer-usage)
460+
461+
# other clang 16.0 suppressions
462+
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
463+
add_compile_options(-Wno-cast-function-type-strict)
456464
else()
457465
add_compile_options(-Wno-uninitialized)
458466
add_compile_options(-Wno-strict-aliasing)

src/coreclr/dlls/mscordbi/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ elseif(CLR_CMAKE_HOST_UNIX)
100100
mscordaccore
101101
)
102102

103-
# COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols
104-
# if they are defined after they are used. Having all libs twice makes sure that ld will actually
105-
# find all symbols.
106-
target_link_libraries(mscordbi ${COREDBI_LIBRARIES} ${COREDBI_LIBRARIES})
103+
target_link_libraries(mscordbi ${COREDBI_LIBRARIES})
107104

108105
add_dependencies(mscordbi mscordaccore)
109106

src/coreclr/dlls/mscordbi/mscordbi.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,18 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
3232
// Defer to the main debugging code.
3333
return DbgDllMain(hInstance, dwReason, lpReserved);
3434
}
35+
36+
#if defined(HOST_LINUX) && defined(TARGET_LINUX)
37+
PALIMPORT HINSTANCE PALAPI DAC_PAL_RegisterModule(IN LPCSTR lpLibFileName);
38+
PALIMPORT VOID PALAPI DAC_PAL_UnregisterModule(IN HINSTANCE hInstance);
39+
40+
HINSTANCE PALAPI PAL_RegisterModule(IN LPCSTR lpLibFileName)
41+
{
42+
return DAC_PAL_RegisterModule(lpLibFileName);
43+
}
44+
45+
VOID PALAPI PAL_UnregisterModule(IN HINSTANCE hInstance)
46+
{
47+
DAC_PAL_UnregisterModule(hInstance);
48+
}
49+
#endif

src/native/corehost/apphost/static/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ if(CLR_CMAKE_TARGET_WIN32)
6666
add_linker_flag("/DEF:${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost.def")
6767

6868
else()
69-
if(CLR_CMAKE_TARGET_OSX)
70-
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_OSXexports.src)
69+
if(CLR_CMAKE_TARGET_FREEBSD)
70+
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_freebsdexports.src)
7171
else()
7272
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_unixexports.src)
7373
endif()

src/native/corehost/apphost/static/singlefilehost_OSXexports.src renamed to src/native/corehost/apphost/static/singlefilehost_freebsdexports.src

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ g_dacTable
99

1010
; Used by profilers
1111
MetaDataGetDispenser
12+
13+
; FreeBSD needs to reexport these
14+
__progname
15+
environ

src/native/corehost/apphost/static/singlefilehost_unixexports.src

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ g_dacTable
99

1010
; Used by profilers
1111
MetaDataGetDispenser
12-
13-
; FreeBSD needs to reexport these
14-
__progname
15-
environ

0 commit comments

Comments
 (0)