diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk index 678af20a830..02ea309b107 100644 --- a/jdk/make/lib/CoreLibraries.gmk +++ b/jdk/make/lib/CoreLibraries.gmk @@ -269,7 +269,7 @@ endif LIBJLI_EXCLUDE_FILES += $(notdir $(LIBJLI_EXCLUDE_ERGO)) 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_STATIC_java_md_macosx.c_CFLAGS := -x objective-c @@ -317,12 +317,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \ LANG := C, \ OPTIMIZATION := HIGH, \ CFLAGS := $(LIBJLI_CFLAGS), \ - DISABLED_WARNINGS_gcc := pointer-to-int-cast sign-compare format-nonliteral \ - 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, \ + DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ @@ -371,7 +366,6 @@ ifeq ($(OPENJDK_TARGET_OS), windows) LANG := C, \ OPTIMIZATION := HIGH, \ CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \ - DISABLED_WARNINGS_microsoft := 4244 4047 4267, \ ARFLAGS := $(ARFLAGS), \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) @@ -392,8 +386,6 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx) LANG := C, \ OPTIMIZATION := HIGH, \ CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \ - DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \ - int-conversion, \ LDFLAGS := -nostdlib -r, \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) diff --git a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c index eb432c12e08..d48f5255f3c 100644 --- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c +++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c @@ -852,7 +852,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) { void * tmp; pthread_join(tid, &tmp); - rslt = (int)tmp; + rslt = (int)(intptr_t)tmp; } else { /* * Continue execution in current thread if for some reason (e.g. out of diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c index 846e6835855..fa4c1c9ca99 100644 --- a/jdk/src/java.base/share/native/libjli/java.c +++ b/jdk/src/java.base/share/native/libjli/java.c @@ -730,7 +730,7 @@ SetJvmEnvironment(int argc, char **argv) { static int parse_size(const char *s, jlong *result) { 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) { return 0; } @@ -798,7 +798,7 @@ AddOption(char *str, void *info) * overflow before the JVM startup code can check to make sure the stack * is big enough. */ - if (threadStackSize < STACK_SIZE_MINIMUM) { + if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) { threadStackSize = STACK_SIZE_MINIMUM; } } diff --git a/jdk/src/java.base/share/native/libjli/java.h b/jdk/src/java.base/share/native/libjli/java.h index 5cc7608b566..1bff9a4906f 100644 --- a/jdk/src/java.base/share/native/libjli/java.h +++ b/jdk/src/java.base/share/native/libjli/java.h @@ -144,8 +144,6 @@ void JLI_ReportMessage(const char * message, ...); void JLI_ReportExceptionDescription(JNIEnv * env); void PrintMachineDependentOptions(); -const char *jlong_format_specifier(); - /* * Block current thread and continue execution in new thread */ diff --git a/jdk/src/java.base/share/native/libjli/parse_manifest.c b/jdk/src/java.base/share/native/libjli/parse_manifest.c index cc0bc370f2f..54f2adf5cdb 100644 --- a/jdk/src/java.base/share/native/libjli/parse_manifest.c +++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c @@ -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. * * 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. */ 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 && JLI_Lseek(fd, pos, SEEK_SET) == pos && 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) return (-1); - if ((bytes = read(fd, eb, ENDHDR)) < 0) + if (read(fd, eb, ENDHDR) < 0) return (-1); if (ENDSIG_AT(eb)) { 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); if ((buffer = malloc(END_MAXLEN)) == NULL) 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); return (-1); } @@ -591,7 +597,7 @@ JLI_ParseManifest(char *jarfile, manifest_info *info) info->jre_version = NULL; info->jre_restrict_search = 0; 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); return (-2); } @@ -692,7 +698,7 @@ JLI_ManifestIterate(const char *jarfile, attribute_closure ac, void *user_data) return (-1); } - if (rc = find_file(fd, &entry, manifest_name) != 0) { + if ((rc = find_file(fd, &entry, manifest_name)) != 0) { close(fd); return (-2); } diff --git a/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c b/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c index 9c1f5148c45..f741ccf807a 100644 --- a/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c +++ b/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c @@ -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. * * 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, ,;) int DoSplashLoadMemory(void* pdata, int size) { - INVOKE(SplashLoadMemory, NULL)(pdata, size); + INVOKE(SplashLoadMemory, 0)(pdata, size); } int DoSplashLoadFile(const char* filename) { - INVOKE(SplashLoadFile, NULL)(filename); + INVOKE(SplashLoadFile, 0)(filename); } void DoSplashInit(void) { @@ -87,4 +87,4 @@ void DoSplashSetScaleFactor(float scaleFactor) { char* DoSplashGetScaledImageName(const char* fileName, const char* jarName, float* scaleFactor) { INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor); -} \ No newline at end of file +} diff --git a/jdk/src/java.base/share/native/libjli/wildcard.c b/jdk/src/java.base/share/native/libjli/wildcard.c index 96dac738aa0..d8c9df02109 100644 --- a/jdk/src/java.base/share/native/libjli/wildcard.c +++ b/jdk/src/java.base/share/native/libjli/wildcard.c @@ -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. * * 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 -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); memcpy(filename, beg, len); @@ -310,7 +310,7 @@ static FileList FileList_split(const char *path, char sep) { const char *p, *q; - int len = (int)JLI_StrLen(path); + size_t len = JLI_StrLen(path); int count; FileList fl; for (count = 1, p = path; p < path + len; p++) diff --git a/jdk/src/java.base/unix/native/libjli/java_md.h b/jdk/src/java.base/unix/native/libjli/java_md.h index 212ae0a2732..ab99dbbdf66 100644 --- a/jdk/src/java.base/unix/native/libjli/java_md.h +++ b/jdk/src/java.base/unix/native/libjli/java_md.h @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,12 @@ #define MAXNAMELEN PATH_MAX #endif +#ifdef _LP64 +#define JLONG_FORMAT_SPECIFIER "%ld" +#else +#define JLONG_FORMAT_SPECIFIER "%lld" +#endif + int UnsetEnv(char *name); char *FindExecName(char *program); const char *SetExecname(char **argv); diff --git a/jdk/src/java.base/unix/native/libjli/java_md_common.c b/jdk/src/java.base/unix/native/libjli/java_md_common.c index 27d5a2ddcaa..48c0d8b377e 100644 --- a/jdk/src/java.base/unix/native/libjli/java_md_common.c +++ b/jdk/src/java.base/unix/native/libjli/java_md_common.c @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -269,11 +269,6 @@ UnsetEnv(char *name) return(borrowed_unsetenv(name)); } -const char * -jlong_format_specifier() { - return "%lld"; -} - jboolean IsJavaw() { diff --git a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c index c453276b458..00b0f690651 100644 --- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c +++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c @@ -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. * * 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) { void * tmp; pthread_join(tid, &tmp); - rslt = (int)tmp; + rslt = (int)(intptr_t)tmp; } else { /* * 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) { void * tmp; thr_join(tid, NULL, &tmp); - rslt = (int)tmp; + rslt = (int)(intptr_t)tmp; } else { /* See above. Continue in current thread if thr_create() failed */ rslt = continuation(args); diff --git a/jdk/src/java.base/windows/native/libjli/cmdtoargs.c b/jdk/src/java.base/windows/native/libjli/cmdtoargs.c index f4f893825ec..cfc1a463e81 100644 --- a/jdk/src/java.base/windows/native/libjli/cmdtoargs.c +++ b/jdk/src/java.base/windows/native/libjli/cmdtoargs.c @@ -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. * * 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; int i; jboolean done = JNI_FALSE; - int charLength; + ptrdiff_t charLength; *wildcard = JNI_FALSE; while (!done) { @@ -208,10 +208,12 @@ void JLI_CmdToArgs(char* cmdline) { argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg)); argv[nargs].arg = JLI_StringDup(arg); argv[nargs].has_wildcard = wildcard; - *arg = NULL; + *arg = '\0'; nargs++; } while (src != NULL); + JLI_MemFree(arg); + stdargc = nargs; stdargs = argv; } diff --git a/jdk/src/java.base/windows/native/libjli/java_md.c b/jdk/src/java.base/windows/native/libjli/java_md.c index 2bf50ea7fc3..596e263ec07 100644 --- a/jdk/src/java.base/windows/native/libjli/java_md.c +++ b/jdk/src/java.base/windows/native/libjli/java_md.c @@ -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. * * 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". */ 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) { /* arg[nameLen] is valid (may contain final NULL) */ if (arg[nameLen] == '=') { @@ -561,7 +561,7 @@ JLI_Snprintf(char* buffer, size_t size, const char* format, ...) { if (rc < 0) { /* apply ansi semantics */ buffer[size - 1] = '\0'; - return size; + return (int)size; } else if (rc == size) { /* force a null terminator */ 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 */ @@ -882,7 +877,7 @@ int AWTPreload(const char *funcName) if (hPreloadAwt == NULL) { /* awt.dll is not loaded yet */ char libraryPath[MAXPATHLEN]; - int jrePathLen = 0; + size_t jrePathLen = 0; HMODULE hJava = NULL; HMODULE hVerify = NULL; @@ -1004,7 +999,8 @@ ProcessPlatformOption(const char *arg) jobjectArray CreateApplicationArgs(JNIEnv *env, char **strv, int argc) { - int i, j, idx, tlen; + int i, j, idx; + size_t tlen; jobjectArray outArray, inArray; char *ostart, *astart, **nargv; jboolean needs_expansion = JNI_FALSE; diff --git a/jdk/src/java.base/windows/native/libjli/java_md.h b/jdk/src/java.base/windows/native/libjli/java_md.h index aa9fc2f0b44..76c15ea8e32 100644 --- a/jdk/src/java.base/windows/native/libjli/java_md.h +++ b/jdk/src/java.base/windows/native/libjli/java_md.h @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ #define MAXPATHLEN MAX_PATH #define MAXNAMELEN MAX_PATH +#define JLONG_FORMAT_SPECIFIER "%I64d" /* * Support for doing cheap, accurate interval timing.