8074818: Resolve disabled warnings for libjava

8080007: Stop ignoring warnings for libjava

Reviewed-by: alanb, erikj
This commit is contained in:
Roger Riggs 2015-05-22 10:12:18 -04:00
parent 318383493e
commit 3788afad1f
10 changed files with 29 additions and 29 deletions

@ -146,11 +146,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
DISABLED_WARNINGS_gcc := type-limits format-nonliteral, \
DISABLED_WARNINGS_clang := int-conversion, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
DISABLED_WARNINGS_microsoft := 4022 4267 4996, \
WARNINGS_AS_ERRORS_solstudio := false, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, 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
@ -23,6 +23,9 @@
* questions.
*/
#include <fcntl.h>
#include <limits.h>
#include "jni.h"
#include "jni_util.h"
#include "jlong.h"
@ -32,9 +35,6 @@
#include "java_io_FileInputStream.h"
#include <fcntl.h>
#include <limits.h>
#include "io_util_md.h"
/*******************************************************************/

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2011, 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
@ -58,9 +58,9 @@ JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) {
/* If the JDK_BUILD_NUMBER is of format bXX and XX is an integer
* XX is the jdk_build_number.
*/
int len = strlen(jdk_build_string);
size_t len = strlen(jdk_build_string);
if (jdk_build_string[0] == 'b' && len >= 2) {
int i = 0;
size_t i = 0;
for (i = 1; i < len; i++) {
if (isdigit(jdk_build_string[i])) {
build_number[i-1] = jdk_build_string[i];
@ -76,7 +76,7 @@ JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) {
}
}
assert(jdk_build_number >= 0 && jdk_build_number <= 255);
assert(jdk_build_number <= 255);
if (strlen(jdk_update_string) == 2 || strlen(jdk_update_string) == 3) {
if (isdigit(jdk_update_string[0]) && isdigit(jdk_update_string[1])) {

@ -157,7 +157,7 @@ JNU_ThrowByNameWithLastError(JNIEnv *env, const char *name,
const char *defaultDetail)
{
char buf[256];
int n = getLastErrorString(buf, sizeof(buf));
size_t n = getLastErrorString(buf, sizeof(buf));
if (n > 0) {
jstring s = JNU_NewStringPlatform(env, buf);
@ -448,7 +448,7 @@ getString8859_1Chars(JNIEnv *env, jstring jstr)
static jstring
newString646_US(JNIEnv *env, const char *str)
{
int len = strlen(str);
int len = (int)strlen(str);
jchar buf[512];
jchar *str1;
jstring result;

@ -286,12 +286,14 @@ releaseBytes(JNIEnv *env, jbyteArray arr, const char* parr)
(*env)->ReleaseByteArrayElements(env, arr, (jbyte*) parr, JNI_ABORT);
}
#define IOE_FORMAT "error=%d, %s"
static void
throwIOException(JNIEnv *env, int errnum, const char *defaultDetail)
{
static const char * const format = "error=%d, %s";
const char *detail = defaultDetail;
char *errmsg;
size_t fmtsize;
jstring s;
if (errnum != 0) {
@ -300,11 +302,12 @@ throwIOException(JNIEnv *env, int errnum, const char *defaultDetail)
detail = s;
}
/* ASCII Decimal representation uses 2.4 times as many bits as binary. */
errmsg = NEW(char, strlen(format) + strlen(detail) + 3 * sizeof(errnum));
fmtsize = sizeof(IOE_FORMAT) + strlen(detail) + 3 * sizeof(errnum);
errmsg = NEW(char, fmtsize);
if (errmsg == NULL)
return;
sprintf(errmsg, format, errnum, detail);
snprintf(errmsg, fmtsize, IOE_FORMAT, errnum, detail);
s = JNU_NewStringPlatform(env, errmsg);
if (s != NULL) {
jobject x = JNU_NewObjectByName(env, "java/io/IOException",

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -735,10 +735,10 @@ getGMTOffsetID()
local_tm = localtime(&clock);
if (local_tm->tm_gmtoff >= 0) {
offset = (time_t) local_tm->tm_gmtoff;
sign = "+";
sign = '+';
} else {
offset = (time_t) -local_tm->tm_gmtoff;
sign = "-";
sign = '-';
}
sprintf(buf, (const char *)"GMT%c%02d:%02d",
sign, (int)(offset/3600), (int)((offset%3600)/60));

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -47,7 +47,7 @@ Java_jdk_internal_jimage_concurrent_ConcurrentPReader_pread(JNIEnv *env, jclass
DWORD nread;
BOOL result;
jlong handle = (*env)->GetLongField(env, fdo, handle_fdID);
HANDLE handle = (HANDLE)(*env)->GetLongField(env, fdo, handle_fdID);
void *buf = (void *)jlong_to_ptr(address);
ZeroMemory(&ov, sizeof(ov));

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, 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
@ -90,7 +90,7 @@ win32Error(JNIEnv *env, const WCHAR *functionName)
CP_UTF8,
0,
utf16_javaMessage,
n, /*by creation n <= MESSAGE_LENGTH*/
(int)n, /*by creation n <= MESSAGE_LENGTH*/
utf8_javaMessage,
MESSAGE_LENGTH*2,
NULL,

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, 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
@ -345,6 +345,8 @@ SetupI18nProps(LCID lcid, char** language, char** script, char** country,
return TRUE;
}
// GetVersionEx is deprecated; disable the warning until a replacement is found
#pragma warning(disable : 4996)
java_props_t *
GetJavaProperties(JNIEnv* env)
{
@ -680,5 +682,5 @@ GetJavaProperties(JNIEnv* env)
jstring
GetStringPlatform(JNIEnv *env, nchar* wcstr)
{
return (*env)->NewString(env, wcstr, wcslen(wcstr));
return (*env)->NewString(env, wcstr, (jsize)wcslen(wcstr));
}

@ -124,9 +124,9 @@ getLastErrorString(char *utf8_jvmErrorMsg, size_t cbErrorMsg)
CP_UTF8,
0,
utf16_osErrorMsg,
n,
(int)n,
utf8_jvmErrorMsg,
cbErrorMsg,
(int)cbErrorMsg,
NULL,
NULL);