8228482: fix xlc16/xlclang comparison of distinct pointer types and string literal conversion warnings

Reviewed-by: clanger, mdoerr
This commit is contained in:
Matthias Baesken 2019-07-23 16:52:38 +02:00
parent f8a875bfce
commit b9e177677c
6 changed files with 21 additions and 17 deletions

View File

@ -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 @@ dynamicOdm::~dynamicOdm() {
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++) {

View File

@ -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 @@ class odmWrapper : private dynamicOdm {
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 odmWrapper : private dynamicOdm {
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();
}

View File

@ -4228,7 +4228,7 @@ extern char** environ;
// 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();

View File

@ -39,8 +39,7 @@ static int dladdr_dont_reload(void *addr, Dl_info *info) {
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;
}

View File

@ -1394,6 +1394,10 @@ static int getFlags(int sock, const char *ifname, int *flags) {
/** 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 @@ static int getMacAddress
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;

View File

@ -43,11 +43,10 @@ static void fill_dll_info(void) {
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] */