8074840: Resolve disabled warnings for libjli and libjli_static

Reviewed-by: dholmes, ksrini
This commit is contained in:
Mikael Vidstedt 2015-04-02 11:54:33 -07:00
parent 1795821684
commit 7b1455163e
13 changed files with 48 additions and 52 deletions

View File

@ -269,7 +269,7 @@ endif
LIBJLI_EXCLUDE_FILES += $(notdir $(LIBJLI_EXCLUDE_ERGO)) LIBJLI_EXCLUDE_FILES += $(notdir $(LIBJLI_EXCLUDE_ERGO))
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c ergo_i586.c
BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
@ -317,12 +317,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
LANG := C, \ LANG := C, \
OPTIMIZATION := HIGH, \ OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \ CFLAGS := $(LIBJLI_CFLAGS), \
DISABLED_WARNINGS_gcc := pointer-to-int-cast sign-compare format-nonliteral \ DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION, \
parentheses, \
DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
int-conversion, \
DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION E_NEWLINE_NOT_LAST, \
DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \ LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \ $(call SET_SHARED_LIBRARY_ORIGIN), \
@ -371,7 +366,6 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
LANG := C, \ LANG := C, \
OPTIMIZATION := HIGH, \ OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \ CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
ARFLAGS := $(ARFLAGS), \ ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@ -392,8 +386,6 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx)
LANG := C, \ LANG := C, \
OPTIMIZATION := HIGH, \ OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \ CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
int-conversion, \
LDFLAGS := -nostdlib -r, \ LDFLAGS := -nostdlib -r, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

View File

@ -852,7 +852,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) { if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp; void * tmp;
pthread_join(tid, &tmp); pthread_join(tid, &tmp);
rslt = (int)tmp; rslt = (int)(intptr_t)tmp;
} else { } else {
/* /*
* Continue execution in current thread if for some reason (e.g. out of * Continue execution in current thread if for some reason (e.g. out of

View File

@ -730,7 +730,7 @@ SetJvmEnvironment(int argc, char **argv) {
static int static int
parse_size(const char *s, jlong *result) { parse_size(const char *s, jlong *result) {
jlong n = 0; jlong n = 0;
int args_read = sscanf(s, jlong_format_specifier(), &n); int args_read = sscanf(s, JLONG_FORMAT_SPECIFIER, &n);
if (args_read != 1) { if (args_read != 1) {
return 0; return 0;
} }
@ -798,7 +798,7 @@ AddOption(char *str, void *info)
* overflow before the JVM startup code can check to make sure the stack * overflow before the JVM startup code can check to make sure the stack
* is big enough. * is big enough.
*/ */
if (threadStackSize < STACK_SIZE_MINIMUM) { if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) {
threadStackSize = STACK_SIZE_MINIMUM; threadStackSize = STACK_SIZE_MINIMUM;
} }
} }

View File

@ -144,8 +144,6 @@ void JLI_ReportMessage(const char * message, ...);
void JLI_ReportExceptionDescription(JNIEnv * env); void JLI_ReportExceptionDescription(JNIEnv * env);
void PrintMachineDependentOptions(); void PrintMachineDependentOptions();
const char *jlong_format_specifier();
/* /*
* Block current thread and continue execution in new thread * Block current thread and continue execution in new thread
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, 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
@ -133,7 +133,7 @@ inflate_file(int fd, zentry *entry, int *size_out)
/** Reads count bytes from fd at position pos into given buffer. */ /** Reads count bytes from fd at position pos into given buffer. */
static jboolean static jboolean
readAt(int fd, jlong pos, size_t count, void *buf) { readAt(int fd, jlong pos, unsigned int count, void *buf) {
return (pos >= 0 return (pos >= 0
&& JLI_Lseek(fd, pos, SEEK_SET) == pos && JLI_Lseek(fd, pos, SEEK_SET) == pos
&& read(fd, buf, count) == (jlong) count); && read(fd, buf, count) == (jlong) count);
@ -249,7 +249,7 @@ find_positions(int fd, Byte *eb, jlong* base_offset, jlong* censtart)
*/ */
if ((pos = JLI_Lseek(fd, -ENDHDR, SEEK_END)) < (jlong)0) if ((pos = JLI_Lseek(fd, -ENDHDR, SEEK_END)) < (jlong)0)
return (-1); return (-1);
if ((bytes = read(fd, eb, ENDHDR)) < 0) if (read(fd, eb, ENDHDR) < 0)
return (-1); return (-1);
if (ENDSIG_AT(eb)) { if (ENDSIG_AT(eb)) {
return find_positions64(fd, eb, pos, base_offset, censtart); return find_positions64(fd, eb, pos, base_offset, censtart);
@ -268,7 +268,13 @@ find_positions(int fd, Byte *eb, jlong* base_offset, jlong* censtart)
return (-1); return (-1);
if ((buffer = malloc(END_MAXLEN)) == NULL) if ((buffer = malloc(END_MAXLEN)) == NULL)
return (-1); return (-1);
if ((bytes = read(fd, buffer, len)) < 0) {
/*
* read() on windows takes an unsigned int for count. Casting len
* to an unsigned int here is safe since it is guaranteed to be
* less than END_MAXLEN.
*/
if ((bytes = read(fd, buffer, (unsigned int)len)) < 0) {
free(buffer); free(buffer);
return (-1); return (-1);
} }
@ -591,7 +597,7 @@ JLI_ParseManifest(char *jarfile, manifest_info *info)
info->jre_version = NULL; info->jre_version = NULL;
info->jre_restrict_search = 0; info->jre_restrict_search = 0;
info->splashscreen_image_file_name = NULL; info->splashscreen_image_file_name = NULL;
if (rc = find_file(fd, &entry, manifest_name) != 0) { if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
close(fd); close(fd);
return (-2); return (-2);
} }
@ -692,7 +698,7 @@ JLI_ManifestIterate(const char *jarfile, attribute_closure ac, void *user_data)
return (-1); return (-1);
} }
if (rc = find_file(fd, &entry, manifest_name) != 0) { if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
close(fd); close(fd);
return (-2); return (-2);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2015, 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
@ -61,11 +61,11 @@ typedef char* (*SplashGetScaledImageName_t)(const char* fileName,
#define INVOKEV(name) _INVOKE(name, ,;) #define INVOKEV(name) _INVOKE(name, ,;)
int DoSplashLoadMemory(void* pdata, int size) { int DoSplashLoadMemory(void* pdata, int size) {
INVOKE(SplashLoadMemory, NULL)(pdata, size); INVOKE(SplashLoadMemory, 0)(pdata, size);
} }
int DoSplashLoadFile(const char* filename) { int DoSplashLoadFile(const char* filename) {
INVOKE(SplashLoadFile, NULL)(filename); INVOKE(SplashLoadFile, 0)(filename);
} }
void DoSplashInit(void) { void DoSplashInit(void) {
@ -87,4 +87,4 @@ void DoSplashSetScaleFactor(float scaleFactor) {
char* DoSplashGetScaledImageName(const char* fileName, const char* jarName, char* DoSplashGetScaledImageName(const char* fileName, const char* jarName,
float* scaleFactor) { float* scaleFactor) {
INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor); INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2015, 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
@ -274,7 +274,7 @@ FileList_add(FileList fl, char *file)
} }
static void static void
FileList_addSubstring(FileList fl, const char *beg, int len) FileList_addSubstring(FileList fl, const char *beg, size_t len)
{ {
char *filename = (char *) JLI_MemAlloc(len+1); char *filename = (char *) JLI_MemAlloc(len+1);
memcpy(filename, beg, len); memcpy(filename, beg, len);
@ -310,7 +310,7 @@ static FileList
FileList_split(const char *path, char sep) FileList_split(const char *path, char sep)
{ {
const char *p, *q; const char *p, *q;
int len = (int)JLI_StrLen(path); size_t len = JLI_StrLen(path);
int count; int count;
FileList fl; FileList fl;
for (count = 1, p = path; p < path + len; p++) for (count = 1, p = path; p < path + len; p++)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2015, 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
@ -43,6 +43,12 @@
#define MAXNAMELEN PATH_MAX #define MAXNAMELEN PATH_MAX
#endif #endif
#ifdef _LP64
#define JLONG_FORMAT_SPECIFIER "%ld"
#else
#define JLONG_FORMAT_SPECIFIER "%lld"
#endif
int UnsetEnv(char *name); int UnsetEnv(char *name);
char *FindExecName(char *program); char *FindExecName(char *program);
const char *SetExecname(char **argv); const char *SetExecname(char **argv);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015, 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
@ -269,11 +269,6 @@ UnsetEnv(char *name)
return(borrowed_unsetenv(name)); return(borrowed_unsetenv(name));
} }
const char *
jlong_format_specifier() {
return "%lld";
}
jboolean jboolean
IsJavaw() IsJavaw()
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2015, 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
@ -888,7 +888,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) { if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp; void * tmp;
pthread_join(tid, &tmp); pthread_join(tid, &tmp);
rslt = (int)tmp; rslt = (int)(intptr_t)tmp;
} else { } else {
/* /*
* Continue execution in current thread if for some reason (e.g. out of * Continue execution in current thread if for some reason (e.g. out of
@ -906,7 +906,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) { if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
void * tmp; void * tmp;
thr_join(tid, NULL, &tmp); thr_join(tid, NULL, &tmp);
rslt = (int)tmp; rslt = (int)(intptr_t)tmp;
} else { } else {
/* See above. Continue in current thread if thr_create() failed */ /* See above. Continue in current thread if thr_create() failed */
rslt = continuation(args); rslt = continuation(args);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015, 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
@ -77,7 +77,7 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
USHORT ch = 0; USHORT ch = 0;
int i; int i;
jboolean done = JNI_FALSE; jboolean done = JNI_FALSE;
int charLength; ptrdiff_t charLength;
*wildcard = JNI_FALSE; *wildcard = JNI_FALSE;
while (!done) { while (!done) {
@ -208,10 +208,12 @@ void JLI_CmdToArgs(char* cmdline) {
argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg)); argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
argv[nargs].arg = JLI_StringDup(arg); argv[nargs].arg = JLI_StringDup(arg);
argv[nargs].has_wildcard = wildcard; argv[nargs].has_wildcard = wildcard;
*arg = NULL; *arg = '\0';
nargs++; nargs++;
} while (src != NULL); } while (src != NULL);
JLI_MemFree(arg);
stdargc = nargs; stdargc = nargs;
stdargs = argv; stdargs = argv;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, 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
@ -107,7 +107,7 @@ int awtPreloadD3D = -1;
* GetParamValue("theParam", "theParam=value") returns pointer to "value". * GetParamValue("theParam", "theParam=value") returns pointer to "value".
*/ */
const char * GetParamValue(const char *paramName, const char *arg) { const char * GetParamValue(const char *paramName, const char *arg) {
int nameLen = JLI_StrLen(paramName); size_t nameLen = JLI_StrLen(paramName);
if (JLI_StrNCmp(paramName, arg, nameLen) == 0) { if (JLI_StrNCmp(paramName, arg, nameLen) == 0) {
/* arg[nameLen] is valid (may contain final NULL) */ /* arg[nameLen] is valid (may contain final NULL) */
if (arg[nameLen] == '=') { if (arg[nameLen] == '=') {
@ -561,7 +561,7 @@ JLI_Snprintf(char* buffer, size_t size, const char* format, ...) {
if (rc < 0) { if (rc < 0) {
/* apply ansi semantics */ /* apply ansi semantics */
buffer[size - 1] = '\0'; buffer[size - 1] = '\0';
return size; return (int)size;
} else if (rc == size) { } else if (rc == size) {
/* force a null terminator */ /* force a null terminator */
buffer[size - 1] = '\0'; buffer[size - 1] = '\0';
@ -728,11 +728,6 @@ void SplashFreeLibrary() {
} }
} }
const char *
jlong_format_specifier() {
return "%I64d";
}
/* /*
* Block current thread and continue execution in a new thread * Block current thread and continue execution in a new thread
*/ */
@ -882,7 +877,7 @@ int AWTPreload(const char *funcName)
if (hPreloadAwt == NULL) { if (hPreloadAwt == NULL) {
/* awt.dll is not loaded yet */ /* awt.dll is not loaded yet */
char libraryPath[MAXPATHLEN]; char libraryPath[MAXPATHLEN];
int jrePathLen = 0; size_t jrePathLen = 0;
HMODULE hJava = NULL; HMODULE hJava = NULL;
HMODULE hVerify = NULL; HMODULE hVerify = NULL;
@ -1004,7 +999,8 @@ ProcessPlatformOption(const char *arg)
jobjectArray jobjectArray
CreateApplicationArgs(JNIEnv *env, char **strv, int argc) CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
{ {
int i, j, idx, tlen; int i, j, idx;
size_t tlen;
jobjectArray outArray, inArray; jobjectArray outArray, inArray;
char *ostart, *astart, **nargv; char *ostart, *astart, **nargv;
jboolean needs_expansion = JNI_FALSE; jboolean needs_expansion = JNI_FALSE;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2015, 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
@ -39,6 +39,7 @@
#define MAXPATHLEN MAX_PATH #define MAXPATHLEN MAX_PATH
#define MAXNAMELEN MAX_PATH #define MAXNAMELEN MAX_PATH
#define JLONG_FORMAT_SPECIFIER "%I64d"
/* /*
* Support for doing cheap, accurate interval timing. * Support for doing cheap, accurate interval timing.