Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions make/modules/java.desktop/lib/Awt2dLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,7 @@ ifeq ($(call isTargetOs, windows), true)
LIBAWT_VERSIONINFO_RESOURCE := $(TOPDIR)/src/$(MODULE)/windows/native/libawt/windows/awt.rc
endif

# Turn off all warnings for debug_mem.c This is needed because the specific warning
# about initializing a declared 'extern' cannot be turned off individually. Only
# applies to debug builds. This limitation in gcc is tracked in
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45977
ifeq ($(TOOLCHAIN_TYPE), gcc)
BUILD_LIBAWT_debug_mem.c_CFLAGS := -w
# This option improves performance of MaskFill in Java2D by 20% for some gcc
LIBAWT_CFLAGS += -fgcse-after-reload
endif
Expand All @@ -138,24 +133,17 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
OPTIMIZATION := HIGHEST, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
EXTRA_HEADER_DIRS := $(LIBAWT_EXTRA_HEADER_DIRS), \
DISABLED_WARNINGS_gcc_awt_ImagingLib.c := unused-function sign-compare, \
DISABLED_WARNINGS_gcc_awt_LoadLibrary.c := unused-result, \
DISABLED_WARNINGS_gcc_awt_Mlib.c := unused-function, \
DISABLED_WARNINGS_gcc_awt_parseImage.c := sign-compare unused-function, \
DISABLED_WARNINGS_gcc_debug_trace.c := unused-function, \
DISABLED_WARNINGS_gcc_ProcessPath.c := maybe-uninitialized, \
DISABLED_WARNINGS_gcc_Region.c := maybe-uninitialized, \
DISABLED_WARNINGS_gcc_SurfaceData.c := unused-value, \
DISABLED_WARNINGS_gcc_TransformHelper.c := sign-compare, \
DISABLED_WARNINGS_clang_awt_ImagingLib.c := sign-compare deprecated-non-prototype, \
DISABLED_WARNINGS_clang_awt_parseImage.c := sign-compare, \
DISABLED_WARNINGS_clang_debug_mem.c := extern-initializer format-nonliteral, \
DISABLED_WARNINGS_clang_awt_ImagingLib.c := deprecated-non-prototype, \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you declared the functions as inline, it was probably the intention for declaring them in the header file.

Did it not resolve deprecated-non-prototype warning? If not, did you submit another bug to address it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing!

I didn't see the warning in mach5 build. However, the warning was not related to inline declarations. See JDK-8300169 where the warning was reported; the compiler complained that sMlibFns.fptr does not have a prototype. See the declaration:


I'm pretty sure that given the right compiler, the warning would still appear.

After I filed the ticket for this change, I found JDK-8074823; let's use that to keep track of the remaining warnings.

DISABLED_WARNINGS_clang_debug_trace.c := format-nonliteral, \
DISABLED_WARNINGS_clang_Trace.c := format-nonliteral, \
DISABLED_WARNINGS_clang_TransformHelper.c := sign-compare, \
DISABLED_WARNINGS_microsoft := 4244 4996, \
DISABLED_WARNINGS_microsoft_awt_Toolkit.cpp := 4267, \
DISABLED_WARNINGS_microsoft_OGLContext.c := 4267, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \
LDFLAGS_windows := -delayload:user32.dll -delayload:gdi32.dll \
Expand Down
16 changes: 8 additions & 8 deletions src/java.desktop/share/native/common/awt/debug/debug_mem.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2023, 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
Expand Down Expand Up @@ -68,10 +68,10 @@ typedef struct MemoryListLink {
/**************************************************
* Global Data structures
*/
static DMemState DMemGlobalState;
extern const DMemState * DMemStatePtr = &DMemGlobalState;
static MemoryListLink MemoryList = {NULL,NULL,FALSE};
static dmutex_t DMemMutex = NULL;
static DMemState DMemGlobalState;
const DMemState * DMemStatePtr = &DMemGlobalState;
static MemoryListLink MemoryList = {NULL,NULL,FALSE};
static dmutex_t DMemMutex = NULL;

/**************************************************/

Expand Down Expand Up @@ -271,10 +271,10 @@ void DMem_FreeBlock(void * memptr) {
}

static void DMem_DumpHeader(MemoryBlockHeader * header) {
char report[FILENAME_MAX+MAX_DECIMAL_DIGITS*3+1];
static const char * reportFormat =
char report[FILENAME_MAX+MAX_DECIMAL_DIGITS*3+42];
static const char * const reportFormat =
"file: %s, line %d\n"
"size: %d bytes\n"
"size: %zd bytes\n"
"order: %d\n"
"-------";

Expand Down
29 changes: 3 additions & 26 deletions src/java.desktop/share/native/common/awt/debug/debug_trace.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2023, 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
Expand All @@ -25,9 +25,9 @@

#include "debug_util.h"

#if defined(DEBUG)
static void JNICALL DTrace_PrintStdErr(const char *msg);

#if defined(DEBUG)
enum {
MAX_TRACES = 200, /* max number of defined trace points allowed */
MAX_TRACE_BUFFER = 512, /* maximum size of a given trace output */
Expand Down Expand Up @@ -292,8 +292,6 @@ void DTrace_SetOutputCallback(DTRACE_OUTPUT_CALLBACK pfn) {
DMutex_Exit(DTraceMutex);
}

#endif /* DEBUG */

/**********************************************************************************
* Support for Java tracing in release or debug mode builds
*/
Expand All @@ -302,28 +300,7 @@ static void JNICALL DTrace_PrintStdErr(const char *msg) {
fprintf(stderr, "%s", msg);
fflush(stderr);
}

static void DTrace_JavaPrint(const char * msg) {
#if defined(DEBUG)
DMutex_Enter(DTraceMutex);
DTrace_ClientPrint(msg);
DMutex_Exit(DTraceMutex);
#else
DTrace_PrintStdErr(msg);
#endif
}

static void DTrace_JavaPrintln(const char * msg) {
#if defined(DEBUG)
DMutex_Enter(DTraceMutex);
DTrace_ClientPrint(msg);
DTrace_ClientPrint("\n");
DMutex_Exit(DTraceMutex);
#else
DTrace_PrintStdErr(msg);
DTrace_PrintStdErr("\n");
#endif
}
#endif /* DEBUG */

/*********************************************************************************
* Native method implementations. Java print trace calls are functional in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2023, 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
Expand Down Expand Up @@ -1039,7 +1039,7 @@ JNIEXPORT jstring JNICALL Java_sun_java2d_opengl_OGLContext_getOGLIdString
char *vendor, *renderer, *version;
char *pAdapterId;
jobject ret = NULL;
int len;
size_t len;

J2dTraceLn(J2D_TRACE_INFO, "OGLContext_getOGLIdString");

Expand Down
90 changes: 3 additions & 87 deletions src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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
Expand Down Expand Up @@ -1801,49 +1801,6 @@ Java_sun_awt_image_ImagingLib_init(JNIEnv *env, jclass thisClass) {
return JNI_TRUE;
}

/* REMIND: How to specify border? */
static void extendEdge(JNIEnv *env, BufImageS_t *imageP,
int *widthP, int *heightP) {
RasterS_t *rasterP = &imageP->raster;
int width;
int height;
/* Useful for convolution? */

jobject jbaseraster = (*env)->GetObjectField(env, rasterP->jraster,
g_RasterBaseRasterID);
width = rasterP->width;
height = rasterP->height;
#ifdef WORKING
if (! JNU_IsNull(env, jbaseraster) &&
!(*env)->IsSameObject(env, rasterP->jraster, jbaseraster)) {
int xOff;
int yOff;
int baseWidth;
int baseHeight;
int baseXoff;
int baseYoff;
/* Not the same object so get the width and height */
xOff = (*env)->GetIntField(env, rasterP->jraster, g_RasterXOffsetID);
yOff = (*env)->GetIntField(env, rasterP->jraster, g_RasterYOffsetID);
baseWidth = (*env)->GetIntField(env, jbaseraster, g_RasterWidthID);
baseHeight = (*env)->GetIntField(env, jbaseraster, g_RasterHeightID);
baseXoff = (*env)->GetIntField(env, jbaseraster, g_RasterXOffsetID);
baseYoff = (*env)->GetIntField(env, jbaseraster, g_RasterYOffsetID);

if (xOff + rasterP->width < baseXoff + baseWidth) {
/* Can use edge */
width++;
}
if (yOff + rasterP->height < baseYoff + baseHeight) {
/* Can use edge */
height++;
}

}
#endif

}

static int
setImageHints(JNIEnv *env, BufImageS_t *srcP, BufImageS_t *dstP,
int expandICM, int useAlpha,
Expand Down Expand Up @@ -2016,47 +1973,6 @@ setImageHints(JNIEnv *env, BufImageS_t *srcP, BufImageS_t *dstP,
return nbands;
}


static int
expandPacked(JNIEnv *env, BufImageS_t *img, ColorModelS_t *cmP,
RasterS_t *rasterP, int component, unsigned char *bdataP) {

if (rasterP->rasterType == COMPONENT_RASTER_TYPE) {
switch (rasterP->dataType) {
case BYTE_DATA_TYPE:
if (expandPackedBCR(env, rasterP, component, bdataP) < 0) {
/* Must have been an error */
return -1;
}
break;

case SHORT_DATA_TYPE:
if (expandPackedICR(env, rasterP, component, bdataP) < 0) {
/* Must have been an error */
return -1;
}
break;

case INT_DATA_TYPE:
if (expandPackedICR(env, rasterP, component, bdataP) < 0) {
/* Must have been an error */
return -1;
}
break;

default:
/* REMIND: Return some sort of error */
return -1;
}
}
else {
/* REMIND: Return some sort of error */
return -1;
}

return 0;
}

#define NUM_LINES 10

static int
Expand Down Expand Up @@ -2445,8 +2361,8 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
*dataPP = dataP;
return 0;
case sun_awt_image_IntegerComponentRaster_TYPE_BYTE_SAMPLES:
if (!(SAFE_TO_ALLOC_2(width, rasterP->numBands) &&
SAFE_TO_ALLOC_2(rasterP->scanlineStride, height)))
if (!(SAFE_TO_ALLOC_3(width, rasterP->numBands, 1) &&
SAFE_TO_ALLOC_3(rasterP->scanlineStride, height, 1)))
{
return -1;
}
Expand Down
Loading