diff --git a/jdk/make/lib/ServiceabilityLibraries.gmk b/jdk/make/lib/ServiceabilityLibraries.gmk index ef4234b0dd0..550a3e722da 100644 --- a/jdk/make/lib/ServiceabilityLibraries.gmk +++ b/jdk/make/lib/ServiceabilityLibraries.gmk @@ -49,7 +49,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \ EXCLUDE_FILES := $(LIBATTACH_EXCLUDE_FILES), \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB), \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS), \ CFLAGS_windows := /Gy, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ @@ -79,7 +79,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SOCKET, \ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \ -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \ -I$(JDK_TOPDIR)/src/share/transport/socket \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket \ @@ -115,7 +115,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \ -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \ -I$(JDK_TOPDIR)/src/share/transport/shmem \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem \ @@ -144,7 +144,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \ SRC := $(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \ -I$(JDK_TOPDIR)/src/share/transport/export \ -I$(JDK_TOPDIR)/src/share/back/export \ -I$(JDK_TOPDIR)/src/share/npt \ @@ -179,7 +179,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tracing/dtrace, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsdt/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -248,7 +248,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \ INCLUDE_FILES := $(LIBINSTRUMENT_FILES), \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(LIBINSTRUMENT_CFLAGS), \ + CFLAGS := $(LIBINSTRUMENT_CFLAGS) $(CFLAGS_WARNINGS_ARE_ERRORS), \ CFLAGS_debug := -DJPLIS_LOGGING, \ CFLAGS_release := -DNO_JPLIS_LOGGING, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libinstrument/mapfile-vers, \ @@ -316,7 +316,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \ EXCLUDE_FILES := $(BUILD_LIBMANAGEMENT_EXCLUDES), \ LANG := C, \ OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \ - CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS), \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(BUILD_LIBMANAGEMENT_CFLAGS), \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ @@ -364,7 +364,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBHPROF, \ SRC := $(BUILD_LIBHPROF_SRC), \ LANG := C, \ OPTIMIZATION := $(LIBHPROF_OPTIMIZATION), \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ $(BUILD_LIBHPROF_CFLAGS), \ CFLAGS_debug := -DHPROF_LOGGING, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libhprof/mapfile-vers, \ @@ -392,7 +392,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA_CRW_DEMO, \ SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava_crw_demo/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -419,7 +419,7 @@ ifndef OPENJDK SRC := $(JDK_TOPDIR)/src/closed/share/native/oracle/jfr, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/closed/share/javavm/export, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjfr/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ diff --git a/jdk/src/share/back/SDE.c b/jdk/src/share/back/SDE.c index 5c0ac218703..6ff7025bbf6 100644 --- a/jdk/src/share/back/SDE.c +++ b/jdk/src/share/back/SDE.c @@ -48,8 +48,6 @@ #define BASE_STRATUM_NAME "Java" #define null NULL -#define true JNI_TRUE -#define false JNI_FALSE #define String char * #define private static @@ -147,7 +145,7 @@ private jboolean isValid(void); defaultStratumId = null; defaultStratumIndex = -1; baseStratumIndex = -2; /* so as not to match -1 above */ - sourceMapIsValid = false; + sourceMapIsValid = JNI_FALSE; if (getSourceDebugExtension(clazz, &sourceDebugExtension) == JVMTI_ERROR_NONE) { @@ -667,7 +665,7 @@ private jboolean isValid(void); jplsFilename = readLine(); defaultStratumId = readLine(); createJavaStratum(); - while (true) { + while (1) { if (sdeRead() != '*') { syntax("expected '*'"); } @@ -684,7 +682,7 @@ private jboolean isValid(void); case 'E': /* set end points */ storeStratum("*terminator*"); - sourceMapIsValid = true; + sourceMapIsValid = JNI_TRUE; return; default: ignoreSection(); diff --git a/jdk/src/share/back/eventHandler.c b/jdk/src/share/back/eventHandler.c index 5f5bf24cf6c..82911fdb66b 100644 --- a/jdk/src/share/back/eventHandler.c +++ b/jdk/src/share/back/eventHandler.c @@ -1682,7 +1682,7 @@ HandlerNode * eventHandler_createPermanentInternal(EventIndex ei, HandlerFunction func) { return createInternal(ei, func, NULL, - NULL, NULL, (jlocation)NULL, JNI_TRUE); + NULL, NULL, 0, JNI_TRUE); } HandlerNode * @@ -1691,7 +1691,7 @@ eventHandler_createInternalThreadOnly(EventIndex ei, jthread thread) { return createInternal(ei, func, thread, - NULL, NULL, (jlocation)NULL, JNI_FALSE); + NULL, NULL, 0, JNI_FALSE); } HandlerNode * diff --git a/jdk/src/share/back/log_messages.c b/jdk/src/share/back/log_messages.c index de8b69db8c9..77b8876382d 100644 --- a/jdk/src/share/back/log_messages.c +++ b/jdk/src/share/back/log_messages.c @@ -56,17 +56,24 @@ static int open_count; static void get_time_stamp(char *tbuf, size_t ltbuf) { - char format[MAXLEN_TIMESTAMP+1]; + char timestamp_prefix[MAXLEN_TIMESTAMP+1]; + char timestamp_postfix[MAXLEN_TIMESTAMP+1]; unsigned millisecs = 0; time_t t = 0; GETMILLSECS(millisecs); - if ( time(&t) == (time_t)(-1) ) + if ( time(&t) == (time_t)(-1) ) { t = 0; - (void)strftime(format, sizeof(format), - /* Break this string up for SCCS's sake */ - "%" "d.%" "m.%" "Y %" "T.%%.3d %" "Z", localtime(&t)); - (void)snprintf(tbuf, ltbuf, format, (int)(millisecs)); + } + /* Break this up so that the format strings are string literals + and we avoid a compiler warning. */ + (void)strftime(timestamp_prefix, sizeof(timestamp_prefix), + "%d.%m.%Y %T", localtime(&t)); + (void)strftime(timestamp_postfix, sizeof(timestamp_postfix), + "%Z", localtime(&t)); + (void)snprintf(tbuf, ltbuf, + "%s.%.3d %s", timestamp_prefix, + (int)(millisecs), timestamp_postfix); } /* Get basename of filename */ @@ -175,7 +182,7 @@ log_message_end(const char *format, ...) "LOC=%s;PID=%d;THR=t@%d", location_stamp, (int)processPid, - (int)tid); + (int)(intptr_t)tid); /* Construct message string. */ va_start(ap, format); diff --git a/jdk/src/share/instrument/InvocationAdapter.c b/jdk/src/share/instrument/InvocationAdapter.c index f3639533dd6..3626647060c 100644 --- a/jdk/src/share/instrument/InvocationAdapter.c +++ b/jdk/src/share/instrument/InvocationAdapter.c @@ -359,7 +359,7 @@ Agent_OnAttach(JavaVM* vm, char *args, void * reserved) { * class name. The manifest is in UTF8 so need to convert to * modified UTF8 (see JNI spec). */ - oldLen = strlen(agentClass); + oldLen = (int)strlen(agentClass); newLen = modifiedUtf8LengthOfUtf8(agentClass, oldLen); if (newLen == oldLen) { agentClass = strdup(agentClass); diff --git a/jdk/src/share/instrument/PathCharsValidator.c b/jdk/src/share/instrument/PathCharsValidator.c index e85ee802746..d1ebc2b1638 100644 --- a/jdk/src/share/instrument/PathCharsValidator.c +++ b/jdk/src/share/instrument/PathCharsValidator.c @@ -46,9 +46,9 @@ static jlong H_PATH; /* Compute the low-order mask for the characters in the given string */ static jlong lowMask(char* s) { - int n = strlen(s); + size_t n = strlen(s); jlong m = 0; - int i; + size_t i; for (i = 0; i < n; i++) { int c = (int)s[i]; if (c < 64) @@ -59,9 +59,9 @@ static jlong lowMask(char* s) { /* Compute the high-order mask for the characters in the given string */ static jlong highMask(char* s) { - int n = strlen(s); + size_t n = strlen(s); jlong m = 0; - int i; + size_t i; for (i = 0; i < n; i++) { int c = (int)s[i]; if ((c >= 64) && (c < 128)) @@ -168,7 +168,7 @@ static void initialize() { * illegal characters. Returns 0 if only validate characters are present. */ int validatePathChars(const char* path) { - int i, n; + size_t i, n; /* initialize on first usage */ if (L_HEX == 0) { diff --git a/jdk/src/solaris/back/util_md.h b/jdk/src/solaris/back/util_md.h index 3aac722eef7..91ba1975aa0 100644 --- a/jdk/src/solaris/back/util_md.h +++ b/jdk/src/solaris/back/util_md.h @@ -62,13 +62,13 @@ typedef unsigned long UNSIGNED_JINT; (((UNSIGNED_JINT)(x & 0xff000000)) >> 24)) #define HOST_TO_JAVA_LONG(x) \ ((x << 56) | \ - ((x & 0x000000000000ff00) << 40) | \ - ((x & 0x0000000000ff0000) << 24) | \ - ((x & 0x00000000ff000000) << 8) | \ - ((x & 0x000000ff00000000) >> 8) | \ - ((x & 0x0000ff0000000000) >> 24) | \ - ((x & 0x00ff000000000000) >> 40) | \ - (((UNSIGNED_JLONG)(x & 0xff00000000000000)) >> 56)) + ((x & 0x000000000000ff00LL) << 40) | \ + ((x & 0x0000000000ff0000LL) << 24) | \ + ((x & 0x00000000ff000000LL) << 8) | \ + ((x & 0x000000ff00000000LL) >> 8) | \ + ((x & 0x0000ff0000000000LL) >> 24) | \ + ((x & 0x00ff000000000000LL) >> 40) | \ + (((UNSIGNED_JLONG)(x & 0xff00000000000000ULL)) >> 56)) #define HOST_TO_JAVA_FLOAT(x) stream_encodeFloat(x) #define HOST_TO_JAVA_DOUBLE(x) stream_encodeDouble(x) diff --git a/jdk/src/solaris/native/sun/management/MacosxOperatingSystem.c b/jdk/src/solaris/native/sun/management/MacosxOperatingSystem.c index 842fa2af5d9..7771ccd5cb4 100644 --- a/jdk/src/solaris/native/sun/management/MacosxOperatingSystem.c +++ b/jdk/src/solaris/native/sun/management/MacosxOperatingSystem.c @@ -29,6 +29,7 @@ #include #include +#include "jvm.h" JNIEXPORT jdouble JNICALL Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0 diff --git a/jdk/src/windows/back/linker_md.c b/jdk/src/windows/back/linker_md.c index 05aaf4deda3..f5bfe230c22 100644 --- a/jdk/src/windows/back/linker_md.c +++ b/jdk/src/windows/back/linker_md.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "sys.h" diff --git a/jdk/src/windows/back/proc_md.h b/jdk/src/windows/back/proc_md.h index f77c7646f2b..dc8caf18273 100644 --- a/jdk/src/windows/back/proc_md.h +++ b/jdk/src/windows/back/proc_md.h @@ -27,6 +27,7 @@ #include #include +#include #define MUTEX_T int #define MUTEX_INIT 0 @@ -40,4 +41,4 @@ #define popen _popen #define pclose _pclose -#define sleep _sleep +#define sleep(s) Sleep((s)*1000)