8228482: fix xlc16/xlclang comparison of distinct pointer types and string literal conversion warnings
Reviewed-by: clanger, mdoerr
--- a/src/hotspot/os/aix/libodm_aix.cpp Tue Sep 17 19:52:51 2019 -0700
+++ b/src/hotspot/os/aix/libodm_aix.cpp Tue Jul 23 16:52:38 2019 +0200
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2015, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
void odmWrapper::clean_data() { if (_data) { free(_data); _data = NULL; } }
-int odmWrapper::class_offset(char *field, bool is_aix_5)
+int odmWrapper::class_offset(const char *field, bool is_aix_5)
{
assert(has_class(), "initialization");
for (int i = 0; i < odm_class()->nelem; i++) {
--- a/src/hotspot/os/aix/libodm_aix.hpp Tue Sep 17 19:52:51 2019 -0700
+++ b/src/hotspot/os/aix/libodm_aix.hpp Tue Jul 23 16:52:38 2019 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2015, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2015, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -68,13 +68,15 @@
public:
// Make sure everything gets initialized and cleaned up properly.
- explicit odmWrapper(char* odm_class_name, char* odm_path = NULL) : _odm_class((CLASS_SYMBOL)-1),
+ explicit odmWrapper(const char* odm_class_name, const char* odm_path = NULL) : _odm_class((CLASS_SYMBOL)-1),
_data(NULL), _initialized(false) {
if (!odm_loaded()) { return; }
_initialized = ((*_odm_initialize)() != -1);
if (_initialized) {
- if (odm_path) { (*_odm_set_path)(odm_path); }
- _odm_class = (*_odm_mount_class)(odm_class_name);
+ // should we free what odm_set_path returns, man page suggests it
+ // see https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/o_bostechref/odm_set_path.html
+ if (odm_path) { (*_odm_set_path)((char*)odm_path); }
+ _odm_class = (*_odm_mount_class)((char*)odm_class_name);
}
}
~odmWrapper() {
@@ -83,12 +85,12 @@
CLASS_SYMBOL odm_class() { return _odm_class; }
bool has_class() { return odm_class() != (CLASS_SYMBOL)-1; }
- int class_offset(char *field, bool is_aix_5);
+ int class_offset(const char *field, bool is_aix_5);
char* data() { return _data; }
- char* retrieve_obj(char* name = NULL) {
+ char* retrieve_obj(const char* name = NULL) {
clean_data();
- char *cnp = (char*)(void*)(*_odm_get_obj)(odm_class(), name, NULL, (name == NULL) ? ODM_NEXT : ODM_FIRST);
+ char *cnp = (char*)(void*)(*_odm_get_obj)(odm_class(), (char*) name, NULL, (name == NULL) ? ODM_NEXT : ODM_FIRST);
if (cnp != (char*)-1) { _data = cnp; }
return data();
}
--- a/src/hotspot/os/aix/os_aix.cpp Tue Sep 17 19:52:51 2019 -0700
+++ b/src/hotspot/os/aix/os_aix.cpp Tue Jul 23 16:52:38 2019 +0200
@@ -4228,7 +4228,7 @@
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
- char * argv[4] = {"sh", "-c", cmd, NULL};
+ char* argv[4] = { (char*)"sh", (char*)"-c", cmd, NULL};
pid_t pid = fork();
--- a/src/java.base/aix/native/libjli/java_md_aix.c Tue Sep 17 19:52:51 2019 -0700
+++ b/src/java.base/aix/native/libjli/java_md_aix.c Tue Jul 23 16:52:38 2019 +0200
@@ -39,8 +39,7 @@
memset((void *)info, 0, sizeof(Dl_info));
for (;;) {
if (addr >= p->ldinfo_textorg &&
- addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize))
- {
+ addr < p->ldinfo_textorg + p->ldinfo_textsize) {
info->dli_fname = p->ldinfo_filename;
return 1;
}
--- a/src/java.base/unix/native/libnet/NetworkInterface.c Tue Sep 17 19:52:51 2019 -0700
+++ b/src/java.base/unix/native/libnet/NetworkInterface.c Tue Jul 23 16:52:38 2019 +0200
@@ -1394,6 +1394,10 @@
/** AIX **/
#if defined(_AIX)
+/* seems getkerninfo is guarded by _KERNEL in the system headers */
+/* see net/proto_uipc.h */
+int getkerninfo(int, char *, int *, int32long64_t);
+
/*
* Opens a socket for further ioctl calls. Tries AF_INET socket first and
* if it fails return AF_INET6 socket.
@@ -1613,7 +1617,7 @@
return -1;
}
- if (getkerninfo(KINFO_NDD, nddp, &size, 0) < 0) {
+ if (getkerninfo(KINFO_NDD, (char*) nddp, &size, 0) < 0) {
perror("getkerninfo 2");
free(nddp);
return -1;
--- a/src/java.desktop/aix/native/libawt/porting_aix.c Tue Sep 17 19:52:51 2019 -0700
+++ b/src/java.desktop/aix/native/libawt/porting_aix.c Tue Jul 23 16:52:38 2019 +0200
@@ -43,11 +43,10 @@
static int dladdr_dont_reload(void* addr, Dl_info* info) {
const struct ld_info* p = (struct ld_info*) dladdr_buffer;
- info->dli_fbase = 0; info->dli_fname = 0;
- info->dli_sname = 0; info->dli_saddr = 0;
+ memset((void *)info, 0, sizeof(Dl_info));
for (;;) {
if (addr >= p->ldinfo_textorg &&
- addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize)) {
+ addr < p->ldinfo_textorg + p->ldinfo_textsize) {
info->dli_fname = p->ldinfo_filename;
info->dli_fbase = p->ldinfo_textorg;
return 1; /* [sic] */