8309219: Fix xlc17 clang 15 warnings in java.base

Reviewed-by: goetz, mdoerr
This commit is contained in:
JoKern65 2023-06-07 13:42:03 +00:00 committed by Martin Doerr
parent 177e8327d6
commit 6eddbe26dd
6 changed files with 12 additions and 9 deletions
make/modules/java.base
src/java.base
aix/native/libjli
unix/native
test/jdk/java/io/File

@ -46,6 +46,8 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNET, \
DISABLED_WARNINGS_gcc_net_util_md.c := format-nonliteral, \ DISABLED_WARNINGS_gcc_net_util_md.c := format-nonliteral, \
DISABLED_WARNINGS_gcc_NetworkInterface.c := unused-function, \ DISABLED_WARNINGS_gcc_NetworkInterface.c := unused-function, \
DISABLED_WARNINGS_clang_net_util_md.c := format-nonliteral, \ DISABLED_WARNINGS_clang_net_util_md.c := format-nonliteral, \
DISABLED_WARNINGS_clang_aix_DefaultProxySelector.c := deprecated-non-prototype, \
DISABLED_WARNINGS_clang_aix_NetworkInterface.c := gnu-pointer-arith, \
DISABLED_WARNINGS_microsoft_InetAddress.c := 4244, \ DISABLED_WARNINGS_microsoft_InetAddress.c := 4244, \
DISABLED_WARNINGS_microsoft_ResolverConfigurationImpl.c := 4996, \ DISABLED_WARNINGS_microsoft_ResolverConfigurationImpl.c := 4996, \
LDFLAGS := $(LDFLAGS_JDKLIB) \ LDFLAGS := $(LDFLAGS_JDKLIB) \

@ -198,6 +198,7 @@ ifeq ($(call isTargetOs, aix), true)
OPTIMIZATION := HIGH, \ OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \ CFLAGS := $(STATIC_LIBRARY_FLAGS) $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \
$(addprefix -I, $(LIBJLI_SRC_DIRS)), \ $(addprefix -I, $(LIBJLI_SRC_DIRS)), \
DISABLED_WARNINGS_clang_aix := format-nonliteral deprecated-non-prototype, \
ARFLAGS := $(ARFLAGS), \ ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static)) OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static))

@ -39,7 +39,7 @@ static int dladdr_dont_reload(void *addr, Dl_info *info) {
memset((void *)info, 0, sizeof(Dl_info)); memset((void *)info, 0, sizeof(Dl_info));
for (;;) { for (;;) {
if (addr >= p->ldinfo_textorg && if (addr >= p->ldinfo_textorg &&
addr < p->ldinfo_textorg + p->ldinfo_textsize) { (char*)addr < (char*)(p->ldinfo_textorg) + p->ldinfo_textsize) {
info->dli_fname = p->ldinfo_filename; info->dli_fname = p->ldinfo_filename;
return 1; return 1;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -622,7 +622,7 @@ jint unix_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
static int getPsinfo(pid_t pid, psinfo_t *psinfo) { static int getPsinfo(pid_t pid, psinfo_t *psinfo) {
FILE* fp; FILE* fp;
char fn[32]; char fn[32];
int ret; size_t ret;
/* /*
* Try to open /proc/%d/psinfo * Try to open /proc/%d/psinfo

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1248,7 +1248,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_fgetxattr0(JNIEnv* env, jclass clazz,
#ifdef __linux__ #ifdef __linux__
res = fgetxattr(fd, name, value, valueLen); res = fgetxattr(fd, name, value, valueLen);
#elif _ALLBSD_SOURCE #elif defined(_ALLBSD_SOURCE)
res = fgetxattr(fd, name, value, valueLen, 0, 0); res = fgetxattr(fd, name, value, valueLen, 0, 0);
#else #else
throwUnixException(env, ENOTSUP); throwUnixException(env, ENOTSUP);
@ -1269,7 +1269,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_fsetxattr0(JNIEnv* env, jclass clazz,
#ifdef __linux__ #ifdef __linux__
res = fsetxattr(fd, name, value, valueLen, 0); res = fsetxattr(fd, name, value, valueLen, 0);
#elif _ALLBSD_SOURCE #elif defined(_ALLBSD_SOURCE)
res = fsetxattr(fd, name, value, valueLen, 0, 0); res = fsetxattr(fd, name, value, valueLen, 0, 0);
#else #else
throwUnixException(env, ENOTSUP); throwUnixException(env, ENOTSUP);
@ -1288,7 +1288,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_fremovexattr0(JNIEnv* env, jclass clazz,
#ifdef __linux__ #ifdef __linux__
res = fremovexattr(fd, name); res = fremovexattr(fd, name);
#elif _ALLBSD_SOURCE #elif defined(_ALLBSD_SOURCE)
res = fremovexattr(fd, name, 0); res = fremovexattr(fd, name, 0);
#else #else
throwUnixException(env, ENOTSUP); throwUnixException(env, ENOTSUP);
@ -1307,7 +1307,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_flistxattr(JNIEnv* env, jclass clazz,
#ifdef __linux__ #ifdef __linux__
res = flistxattr(fd, list, (size_t)size); res = flistxattr(fd, list, (size_t)size);
#elif _ALLBSD_SOURCE #elif defined(_ALLBSD_SOURCE)
res = flistxattr(fd, list, (size_t)size, 0); res = flistxattr(fd, list, (size_t)size, 0);
#else #else
throwUnixException(env, ENOTSUP); throwUnixException(env, ENOTSUP);

@ -143,7 +143,7 @@ Java_GetXSpace_getSpace0
(*env)->ReleaseStringChars(env, root, strchars); (*env)->ReleaseStringChars(env, root, strchars);
struct statfs buf; struct statfs buf;
int result = statfs((const char*)chars, &buf); int result = statfs(chars, &buf);
free(chars); free(chars);
if (result < 0) { if (result < 0) {
JNU_ThrowByNameWithLastError(env, "java/lang/RuntimeException", JNU_ThrowByNameWithLastError(env, "java/lang/RuntimeException",