diff --git a/make/modules/java.desktop/lib/AwtLibraries.gmk b/make/modules/java.desktop/lib/AwtLibraries.gmk index f2c97612ba167..aaf5100d83b37 100644 --- a/make/modules/java.desktop/lib/AwtLibraries.gmk +++ b/make/modules/java.desktop/lib/AwtLibraries.gmk @@ -181,8 +181,11 @@ ifeq ($(call isTargetOs, windows macosx), false) $(X_CFLAGS), \ EXTRA_HEADER_DIRS := $(LIBAWT_HEADLESS_EXTRA_HEADER_DIRS), \ DISABLED_WARNINGS_gcc := unused-variable, \ + DISABLED_WARNINGS_clang := unused-variable, \ DISABLED_WARNINGS_gcc_X11Renderer.c := unused-function, \ DISABLED_WARNINGS_gcc_X11SurfaceData.c := unused-function, \ + DISABLED_WARNINGS_clang_X11Renderer.c := unused-function, \ + DISABLED_WARNINGS_clang_X11SurfaceData.c := unused-function, \ JDK_LIBS := libawt java.base:libjava, \ LIBS_linux := $(LIBDL) $(LIBM), \ STATIC_LIB_EXCLUDE_OBJS := $(LIBAWT_HEADLESS_STATIC_EXCLUDE_OBJS), \ @@ -238,6 +241,7 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false) CFLAGS := -DXAWT -DXAWT_HACK $(LIBAWT_XAWT_CFLAGS) \ $(FONTCONFIG_CFLAGS) $(CUPS_CFLAGS) $(X_CFLAGS), \ DISABLED_WARNINGS_gcc := int-to-pointer-cast unused-variable, \ + DISABLED_WARNINGS_clang := unused-variable, \ DISABLED_WARNINGS_gcc_awt_Taskbar.c := parentheses, \ DISABLED_WARNINGS_gcc_GLXSurfaceData.c := unused-function, \ DISABLED_WARNINGS_gcc_gtk3_interface.c := parentheses type-limits \ @@ -256,20 +260,22 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false) DISABLED_WARNINGS_gcc_XToolkit.c := unused-result, \ DISABLED_WARNINGS_gcc_XWindow.c := unused-function, \ DISABLED_WARNINGS_clang_awt_Taskbar.c := parentheses, \ - DISABLED_WARNINGS_clang_gtk3_interface.c := parentheses, \ + DISABLED_WARNINGS_clang_gtk3_interface.c := unused-function parentheses, \ + DISABLED_WARNINGS_clang_GLXSurfaceData.c := unused-function, \ DISABLED_WARNINGS_clang_OGLBufImgOps.c := format-nonliteral, \ DISABLED_WARNINGS_clang_OGLPaints.c := format-nonliteral, \ DISABLED_WARNINGS_clang_screencast_pipewire.c := format-nonliteral, \ DISABLED_WARNINGS_clang_sun_awt_X11_GtkFileDialogPeer.c := parentheses, \ + DISABLED_WARNINGS_clang_XWindow.c := unused-function, \ DISABLED_WARNINGS_clang_aix := deprecated-non-prototype, \ DISABLED_WARNINGS_clang_aix_awt_Taskbar.c := parentheses, \ DISABLED_WARNINGS_clang_aix_OGLPaints.c := format-nonliteral, \ DISABLED_WARNINGS_clang_aix_OGLBufImgOps.c := format-nonliteral, \ - DISABLED_WARNINGS_clang_aix_gtk3_interface.c := parentheses \ + DISABLED_WARNINGS_clang_aix_gtk3_interface.c := unused-function parentheses \ logical-op-parentheses, \ DISABLED_WARNINGS_clang_aix_sun_awt_X11_GtkFileDialogPeer.c := \ parentheses, \ - DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := sign-compare, \ + DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := unused-function sign-compare, \ JDK_LIBS := libawt java.base:libjava, \ LIBS_unix := $(LIBDL) $(LIBM) $(X_LIBS) -lX11 -lXext -lXi -lXrender \ -lXtst, \ diff --git a/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c b/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c index 57d911e35de0a..acc7f0c73c903 100644 --- a/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c +++ b/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c @@ -661,11 +661,8 @@ pid_t unix_getParentPidAndTimings(JNIEnv *env, pid_t pid, void unix_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) { psinfo_t psinfo; - char fn[32]; - char exePath[PATH_MAX]; char prargs[PRARGSZ + 1]; jstring cmdexe = NULL; - int ret; /* * Now try to open /proc/%d/psinfo diff --git a/src/java.base/unix/native/libjava/TimeZone_md.c b/src/java.base/unix/native/libjava/TimeZone_md.c index 988c4bd2646f9..92d1314c330be 100644 --- a/src/java.base/unix/native/libjava/TimeZone_md.c +++ b/src/java.base/unix/native/libjava/TimeZone_md.c @@ -41,8 +41,6 @@ #include "TimeZone_md.h" #include "path_util.h" -static char *isFileIdentical(char* buf, size_t size, char *pathname); - #define fileopen fopen #define filegets fgets #define fileclose fclose @@ -61,6 +59,8 @@ static const char popularZones[][4] = {"UTC", "GMT"}; #if defined(_AIX) static const char *ETC_ENVIRONMENT_FILE = "/etc/environment"; +#else +static char *isFileIdentical(char* buf, size_t size, char *pathname); #endif #if defined(__linux__) || defined(MACOSX) diff --git a/src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c b/src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c index 4907200db72e8..908b7cca653cc 100644 --- a/src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c +++ b/src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c @@ -493,9 +493,6 @@ static StatusWindow *createStatusWindow(Window parent) { XWindowAttributes xwa; XWindowAttributes xxwa; /* Variable for XCreateFontSet()*/ - char **mclr; - int mccr = 0; - char *dsr; unsigned long bg, fg, light, dim; int x, y, off_x, off_y, xx, yy; unsigned int w, h, bw, depth; diff --git a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c index 216da01e0cd62..173d44d96c845 100644 --- a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c +++ b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c @@ -202,7 +202,6 @@ Java_sun_print_CUPSPrinter_getCupsDefaultPrinter(JNIEnv *env, cups_dest_t *dests; char *defaultPrinter = NULL; int num_dests = j2d_cupsGetDests(&dests); - int i = 0; cups_dest_t *dest = j2d_cupsGetDest(NULL, NULL, num_dests, dests); if (dest != NULL) { defaultPrinter = dest->name; diff --git a/src/java.desktop/unix/native/common/awt/X11Color.c b/src/java.desktop/unix/native/common/awt/X11Color.c index 6d3f4e7b246e9..feaba732b4ac1 100644 --- a/src/java.desktop/unix/native/common/awt/X11Color.c +++ b/src/java.desktop/unix/native/common/awt/X11Color.c @@ -338,7 +338,7 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data) unsigned char reds[256], greens[256], blues[256]; int indices[256]; Colormap cm; - int i, j, k, cmapsize, nfree, depth, bpp; + int i, k, cmapsize, nfree, depth, bpp; int allocatedColorsNum, unavailableColorsNum; XPixmapFormatValues *pPFV; int numpfv; @@ -878,7 +878,6 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data) jobject getColorSpace(JNIEnv* env, jint csID) { jclass clazz; - jobject cspaceL; jmethodID mid; clazz = (*env)->FindClass(env,"java/awt/color/ColorSpace"); @@ -1033,7 +1032,6 @@ jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData) jobject validBits = NULL; ColorEntry *c; int i, allocAllGray, b, allvalid, paletteSize; - jlong pData; if (aData->awt_visInfo.depth == 12) { paletteSize = MAX_PALETTE12_SIZE; @@ -1233,11 +1231,10 @@ jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData) void awt_allocate_systemrgbcolors (jint *rgbColors, int num_colors, AwtGraphicsConfigDataPtr awtData) { - int i, pixel; - for (i = 0; i < num_colors; i++) - pixel = alloc_col (awt_display, awtData->awt_cmap, red (rgbColors [i]), - green (rgbColors [i]), blue (rgbColors [i]), -1, - awtData); + for (int i = 0; i < num_colors; i++) + alloc_col (awt_display, awtData->awt_cmap, red (rgbColors [i]), + green (rgbColors [i]), blue (rgbColors [i]), -1, + awtData); } int diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c index b270a3fc94d7f..2da0ec0328bee 100644 --- a/src/java.desktop/unix/native/common/awt/fontpath.c +++ b/src/java.desktop/unix/native/common/awt/fontpath.c @@ -100,7 +100,6 @@ typedef struct { jboolean isDisplayLocal(JNIEnv *env) { static jboolean isLocal = False; static jboolean isLocalSet = False; - jboolean ret; if (! isLocalSet) { jclass geCls = (*env)->FindClass(env, "java/awt/GraphicsEnvironment"); @@ -134,7 +133,7 @@ jboolean isDisplayLocal(JNIEnv *env) { static char **getX11FontPath () { char **x11Path, **fontdirs; - int i, pos, slen, nPaths, numDirs; + int i, pos, slen, nPaths; x11Path = XGetFontPath (awt_display, &nPaths); @@ -533,7 +532,6 @@ static char **getFontConfigLocations() { char **fontdirs; int numdirs = 0; - FcInitLoadConfigFuncType FcInitLoadConfig; FcPatternBuildFuncType FcPatternBuild; FcObjectSetFuncType FcObjectSetBuild; FcFontListFuncType FcFontList; @@ -543,14 +541,10 @@ static char **getFontConfigLocations() { FcObjectSetDestroyFuncType FcObjectSetDestroy; FcFontSetDestroyFuncType FcFontSetDestroy; - FcConfig *fontconfig; FcPattern *pattern; FcObjectSet *objset; FcFontSet *fontSet; - FcStrList *strList; - FcChar8 *str; - int i, f, found, len=0; - char **fontPath; + int i, f, found; void* libfontconfig = openFontConfig(); diff --git a/src/java.desktop/unix/native/common/java2d/x11/X11FontScaler_md.c b/src/java.desktop/unix/native/common/java2d/x11/X11FontScaler_md.c index 2ab6f287b690f..521b7cfef3ab4 100644 --- a/src/java.desktop/unix/native/common/java2d/x11/X11FontScaler_md.c +++ b/src/java.desktop/unix/native/common/java2d/x11/X11FontScaler_md.c @@ -43,8 +43,6 @@ static GC pixmapGC = 0; static Pixmap pixmap = 0; -static Atom psAtom = 0; -static Atom fullNameAtom = 0; static int pixmapWidth = 0; static int pixmapHeight = 0; @@ -127,9 +125,9 @@ JNIEXPORT int JNICALL AWTCountFonts(char* xlfd) { } JNIEXPORT void JNICALL AWTLoadFont(char* name, AWTFont *pReturn) { - JNIEnv *env; *pReturn = NULL; #ifndef HEADLESS + JNIEnv *env; FONT_AWT_LOCK(); *pReturn = (AWTFont)XLoadQueryFont(awt_display, name); AWT_UNLOCK(); @@ -268,7 +266,7 @@ JNIEXPORT jlong JNICALL AWTFontGenerateImage(AWTFont pFont, AWTChar2b* xChar) { XCharStruct xcs; XImage *ximage; int h, i, j, nbytes; - unsigned char *srcRow, *dstRow, *dstByte; + unsigned char *srcRow, *dstRow; int wholeByteCount, remainingBitsCount; unsigned int imageSize; JNIEnv *env; diff --git a/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c b/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c index 871c129ca913d..216fe8090ff2e 100644 --- a/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c +++ b/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c @@ -571,7 +571,6 @@ Java_sun_java2d_x11_X11Renderer_XDoPath #ifndef HEADLESS X11SDOps *xsdo = (X11SDOps *) pXSData; jarray typesArray; - jobject pointArray; jarray coordsArray; jint numTypes; jint fillRule; diff --git a/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c b/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c index 36d6feb6029a7..e62ccff4653a2 100644 --- a/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c +++ b/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c @@ -882,11 +882,9 @@ static void X11SD_GetRasInfo(JNIEnv *env, } else #endif /* MITSHM */ if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE) { - int x, y, w, h; + int x, y; x = pRasInfo->bounds.x1; y = pRasInfo->bounds.y1; - w = pRasInfo->bounds.x2 - x; - h = pRasInfo->bounds.y2 - y; xpriv->img = X11SD_GetImage(env, xsdo, &pRasInfo->bounds, lockFlags); if (xpriv->img) { diff --git a/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c b/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c index c7aff6f34c84f..d50ef00f94532 100644 --- a/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c +++ b/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c @@ -213,7 +213,7 @@ AWTDrawGlyphList(JNIEnv *env, jobject xtr, XImage *theImage; Pixmap thePixmap; XGCValues xgcv; - int scan, screen; + int screen; AwtGraphicsConfigDataPtr cData; X11SDOps *xsdo = (X11SDOps *)jlong_to_ptr(dstData); jint cx1, cy1, cx2, cy2; @@ -236,8 +236,6 @@ AWTDrawGlyphList(JNIEnv *env, jobject xtr, thePixmap = cData->monoPixmap; theGC = cData->monoPixmapGC; - scan = theImage->bytes_per_line; - xgcv.fill_style = FillStippled; xgcv.stipple = thePixmap; xgcv.ts_x_origin = bounds->x1; diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c index aa2e88940dcae..33d2aeb66bbc1 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c +++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c @@ -304,7 +304,6 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) { AwtGraphicsConfigDataPtr *graphicsConfigs; AwtGraphicsConfigDataPtr defaultConfig; int ind; - char errmsg[128]; int xinawareScreen; void* xrenderLibHandle = NULL; XRenderFindVisualFormatFunc* xrenderFindVisualFormat = NULL; @@ -722,7 +721,6 @@ awt_init_Display(JNIEnv *env, jobject this) jclass klass; Display *dpy; char errmsg[128]; - int i; if (awt_display) { return awt_display; @@ -872,7 +870,6 @@ extern int mitShmPermissionMask; void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) { XShmSegmentInfo shminfo; int XShmMajor, XShmMinor; - int a, b, c; AWT_LOCK(); if (canUseShmExt != UNSET_MITSHM) { @@ -1154,7 +1151,7 @@ JNIEnv *env, jobject this, jint visualNum, jint screen) AwtGraphicsConfigData *adata = NULL; AwtScreenData asd = x11Screens[screen]; - int i, n; + int i; int depth; XImage * tempImage; diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c b/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c index e2e3cd1180948..93c1f4d0c1a3f 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c +++ b/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c @@ -793,8 +793,6 @@ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox, XRectangle clip; int image_only; - int count=0 ; - *hasNonDefault = False; XUnionRectWithRegion( bbox, bbox_region, bbox_region); XGetWindowAttributes( disp, win, &win_attrs); @@ -823,8 +821,6 @@ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox, malloc( sizeof( image_region_type)))) { return (list_ptr) NULL; } - count++; - new_reg->visible_region = XCreateRegion(); new_reg->win = base_src->win; new_reg->vis = base_src->vis; diff --git a/src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c b/src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c index e990cd9014a04..5a008d10a482c 100644 --- a/src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c +++ b/src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c @@ -209,7 +209,7 @@ FreeColors(Display * display, Screen * screen, int numColors, } static void SplashCenter(Splash * splash) { - Atom type, atom, actual_type; + Atom atom, actual_type; int status, actual_format; unsigned long nitems, bytes_after; CARD16 *prop = NULL; @@ -251,8 +251,6 @@ static void SplashUpdateSizeHints(Splash * splash) { void SplashCreateWindow(Splash * splash) { - XSizeHints sizeHints; - XSetWindowAttributes attr; attr.backing_store = NotUseful; @@ -740,11 +738,10 @@ void SplashCreateThread(Splash * splash) { pthread_t thr; pthread_attr_t attr; - int rc; int rslt = pthread_attr_init(&attr); if (rslt != 0) return; - rc = pthread_create(&thr, &attr, SplashScreenThread, (void *) splash); + pthread_create(&thr, &attr, SplashScreenThread, (void *) splash); pthread_attr_destroy(&attr); }