Skip to content

Commit 8ea6adc

Browse files
committedSep 3, 2024
8339364: AIX build fails: various unused variable and function warnings
Reviewed-by: mdoerr, clanger, jwaters
1 parent 7a418fc commit 8ea6adc

File tree

14 files changed

+25
-56
lines changed

14 files changed

+25
-56
lines changed
 

‎make/modules/java.desktop/lib/AwtLibraries.gmk

+9-3
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,11 @@ ifeq ($(call isTargetOs, windows macosx), false)
181181
$(X_CFLAGS), \
182182
EXTRA_HEADER_DIRS := $(LIBAWT_HEADLESS_EXTRA_HEADER_DIRS), \
183183
DISABLED_WARNINGS_gcc := unused-variable, \
184+
DISABLED_WARNINGS_clang := unused-variable, \
184185
DISABLED_WARNINGS_gcc_X11Renderer.c := unused-function, \
185186
DISABLED_WARNINGS_gcc_X11SurfaceData.c := unused-function, \
187+
DISABLED_WARNINGS_clang_X11Renderer.c := unused-function, \
188+
DISABLED_WARNINGS_clang_X11SurfaceData.c := unused-function, \
186189
JDK_LIBS := libawt java.base:libjava, \
187190
LIBS_linux := $(LIBDL) $(LIBM), \
188191
STATIC_LIB_EXCLUDE_OBJS := $(LIBAWT_HEADLESS_STATIC_EXCLUDE_OBJS), \
@@ -238,6 +241,7 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
238241
CFLAGS := -DXAWT -DXAWT_HACK $(LIBAWT_XAWT_CFLAGS) \
239242
$(FONTCONFIG_CFLAGS) $(CUPS_CFLAGS) $(X_CFLAGS), \
240243
DISABLED_WARNINGS_gcc := int-to-pointer-cast unused-variable, \
244+
DISABLED_WARNINGS_clang := unused-variable, \
241245
DISABLED_WARNINGS_gcc_awt_Taskbar.c := parentheses, \
242246
DISABLED_WARNINGS_gcc_GLXSurfaceData.c := unused-function, \
243247
DISABLED_WARNINGS_gcc_gtk3_interface.c := parentheses type-limits \
@@ -256,20 +260,22 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
256260
DISABLED_WARNINGS_gcc_XToolkit.c := unused-result, \
257261
DISABLED_WARNINGS_gcc_XWindow.c := unused-function, \
258262
DISABLED_WARNINGS_clang_awt_Taskbar.c := parentheses, \
259-
DISABLED_WARNINGS_clang_gtk3_interface.c := parentheses, \
263+
DISABLED_WARNINGS_clang_gtk3_interface.c := unused-function parentheses, \
264+
DISABLED_WARNINGS_clang_GLXSurfaceData.c := unused-function, \
260265
DISABLED_WARNINGS_clang_OGLBufImgOps.c := format-nonliteral, \
261266
DISABLED_WARNINGS_clang_OGLPaints.c := format-nonliteral, \
262267
DISABLED_WARNINGS_clang_screencast_pipewire.c := format-nonliteral, \
263268
DISABLED_WARNINGS_clang_sun_awt_X11_GtkFileDialogPeer.c := parentheses, \
269+
DISABLED_WARNINGS_clang_XWindow.c := unused-function, \
264270
DISABLED_WARNINGS_clang_aix := deprecated-non-prototype, \
265271
DISABLED_WARNINGS_clang_aix_awt_Taskbar.c := parentheses, \
266272
DISABLED_WARNINGS_clang_aix_OGLPaints.c := format-nonliteral, \
267273
DISABLED_WARNINGS_clang_aix_OGLBufImgOps.c := format-nonliteral, \
268-
DISABLED_WARNINGS_clang_aix_gtk3_interface.c := parentheses \
274+
DISABLED_WARNINGS_clang_aix_gtk3_interface.c := unused-function parentheses \
269275
logical-op-parentheses, \
270276
DISABLED_WARNINGS_clang_aix_sun_awt_X11_GtkFileDialogPeer.c := \
271277
parentheses, \
272-
DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := sign-compare, \
278+
DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := unused-function sign-compare, \
273279
JDK_LIBS := libawt java.base:libjava, \
274280
LIBS_unix := $(LIBDL) $(LIBM) $(X_LIBS) -lX11 -lXext -lXi -lXrender \
275281
-lXtst, \

‎src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c

-3
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,8 @@ pid_t unix_getParentPidAndTimings(JNIEnv *env, pid_t pid,
661661

662662
void unix_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
663663
psinfo_t psinfo;
664-
char fn[32];
665-
char exePath[PATH_MAX];
666664
char prargs[PRARGSZ + 1];
667665
jstring cmdexe = NULL;
668-
int ret;
669666

670667
/*
671668
* Now try to open /proc/%d/psinfo

‎src/java.base/unix/native/libjava/TimeZone_md.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
#include "TimeZone_md.h"
4242
#include "path_util.h"
4343

44-
static char *isFileIdentical(char* buf, size_t size, char *pathname);
45-
4644
#define fileopen fopen
4745
#define filegets fgets
4846
#define fileclose fclose
@@ -59,11 +57,8 @@ static const char *DEFAULT_ZONEINFO_FILE = "/usr/share/lib/zoneinfo/localtime";
5957

6058
static const char popularZones[][4] = {"UTC", "GMT"};
6159

62-
#if defined(_AIX)
63-
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
64-
#endif
65-
6660
#if defined(__linux__) || defined(MACOSX)
61+
static char *isFileIdentical(char* buf, size_t size, char *pathname);
6762

6863
/*
6964
* remove repeated path separators ('/') in the given 'path'.
@@ -356,6 +351,7 @@ getPlatformTimeZoneID()
356351
}
357352

358353
#elif defined(_AIX)
354+
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
359355

360356
static char *
361357
getPlatformTimeZoneID()

‎src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c

-3
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,6 @@ static StatusWindow *createStatusWindow(Window parent) {
493493
XWindowAttributes xwa;
494494
XWindowAttributes xxwa;
495495
/* Variable for XCreateFontSet()*/
496-
char **mclr;
497-
int mccr = 0;
498-
char *dsr;
499496
unsigned long bg, fg, light, dim;
500497
int x, y, off_x, off_y, xx, yy;
501498
unsigned int w, h, bw, depth;

‎src/java.desktop/unix/native/common/awt/CUPSfuncs.c

-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ Java_sun_print_CUPSPrinter_getCupsDefaultPrinter(JNIEnv *env,
202202
cups_dest_t *dests;
203203
char *defaultPrinter = NULL;
204204
int num_dests = j2d_cupsGetDests(&dests);
205-
int i = 0;
206205
cups_dest_t *dest = j2d_cupsGetDest(NULL, NULL, num_dests, dests);
207206
if (dest != NULL) {
208207
defaultPrinter = dest->name;

‎src/java.desktop/unix/native/common/awt/X11Color.c

+5-8
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
338338
unsigned char reds[256], greens[256], blues[256];
339339
int indices[256];
340340
Colormap cm;
341-
int i, j, k, cmapsize, nfree, depth, bpp;
341+
int i, k, cmapsize, nfree, depth, bpp;
342342
int allocatedColorsNum, unavailableColorsNum;
343343
XPixmapFormatValues *pPFV;
344344
int numpfv;
@@ -878,7 +878,6 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
878878

879879
jobject getColorSpace(JNIEnv* env, jint csID) {
880880
jclass clazz;
881-
jobject cspaceL;
882881
jmethodID mid;
883882

884883
clazz = (*env)->FindClass(env,"java/awt/color/ColorSpace");
@@ -1033,7 +1032,6 @@ jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
10331032
jobject validBits = NULL;
10341033
ColorEntry *c;
10351034
int i, allocAllGray, b, allvalid, paletteSize;
1036-
jlong pData;
10371035

10381036
if (aData->awt_visInfo.depth == 12) {
10391037
paletteSize = MAX_PALETTE12_SIZE;
@@ -1233,11 +1231,10 @@ jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
12331231
void
12341232
awt_allocate_systemrgbcolors (jint *rgbColors, int num_colors,
12351233
AwtGraphicsConfigDataPtr awtData) {
1236-
int i, pixel;
1237-
for (i = 0; i < num_colors; i++)
1238-
pixel = alloc_col (awt_display, awtData->awt_cmap, red (rgbColors [i]),
1239-
green (rgbColors [i]), blue (rgbColors [i]), -1,
1240-
awtData);
1234+
for (int i = 0; i < num_colors; i++)
1235+
alloc_col (awt_display, awtData->awt_cmap, red (rgbColors [i]),
1236+
green (rgbColors [i]), blue (rgbColors [i]), -1,
1237+
awtData);
12411238
}
12421239

12431240
int

‎src/java.desktop/unix/native/common/awt/fontpath.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ typedef struct {
100100
jboolean isDisplayLocal(JNIEnv *env) {
101101
static jboolean isLocal = False;
102102
static jboolean isLocalSet = False;
103-
jboolean ret;
104103

105104
if (! isLocalSet) {
106105
jclass geCls = (*env)->FindClass(env, "java/awt/GraphicsEnvironment");
@@ -134,7 +133,7 @@ jboolean isDisplayLocal(JNIEnv *env) {
134133
static char **getX11FontPath ()
135134
{
136135
char **x11Path, **fontdirs;
137-
int i, pos, slen, nPaths, numDirs;
136+
int i, pos, slen, nPaths;
138137

139138
x11Path = XGetFontPath (awt_display, &nPaths);
140139

@@ -533,7 +532,6 @@ static char **getFontConfigLocations() {
533532

534533
char **fontdirs;
535534
int numdirs = 0;
536-
FcInitLoadConfigFuncType FcInitLoadConfig;
537535
FcPatternBuildFuncType FcPatternBuild;
538536
FcObjectSetFuncType FcObjectSetBuild;
539537
FcFontListFuncType FcFontList;
@@ -543,14 +541,10 @@ static char **getFontConfigLocations() {
543541
FcObjectSetDestroyFuncType FcObjectSetDestroy;
544542
FcFontSetDestroyFuncType FcFontSetDestroy;
545543

546-
FcConfig *fontconfig;
547544
FcPattern *pattern;
548545
FcObjectSet *objset;
549546
FcFontSet *fontSet;
550-
FcStrList *strList;
551-
FcChar8 *str;
552-
int i, f, found, len=0;
553-
char **fontPath;
547+
int i, f, found;
554548

555549
void* libfontconfig = openFontConfig();
556550

‎src/java.desktop/unix/native/common/java2d/x11/X11FontScaler_md.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343

4444
static GC pixmapGC = 0;
4545
static Pixmap pixmap = 0;
46-
static Atom psAtom = 0;
47-
static Atom fullNameAtom = 0;
4846
static int pixmapWidth = 0;
4947
static int pixmapHeight = 0;
5048

@@ -127,9 +125,9 @@ JNIEXPORT int JNICALL AWTCountFonts(char* xlfd) {
127125
}
128126

129127
JNIEXPORT void JNICALL AWTLoadFont(char* name, AWTFont *pReturn) {
130-
JNIEnv *env;
131128
*pReturn = NULL;
132129
#ifndef HEADLESS
130+
JNIEnv *env;
133131
FONT_AWT_LOCK();
134132
*pReturn = (AWTFont)XLoadQueryFont(awt_display, name);
135133
AWT_UNLOCK();
@@ -268,7 +266,7 @@ JNIEXPORT jlong JNICALL AWTFontGenerateImage(AWTFont pFont, AWTChar2b* xChar) {
268266
XCharStruct xcs;
269267
XImage *ximage;
270268
int h, i, j, nbytes;
271-
unsigned char *srcRow, *dstRow, *dstByte;
269+
unsigned char *srcRow, *dstRow;
272270
int wholeByteCount, remainingBitsCount;
273271
unsigned int imageSize;
274272
JNIEnv *env;

‎src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c

-1
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,6 @@ Java_sun_java2d_x11_X11Renderer_XDoPath
571571
#ifndef HEADLESS
572572
X11SDOps *xsdo = (X11SDOps *) pXSData;
573573
jarray typesArray;
574-
jobject pointArray;
575574
jarray coordsArray;
576575
jint numTypes;
577576
jint fillRule;

‎src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -882,11 +882,9 @@ static void X11SD_GetRasInfo(JNIEnv *env,
882882
} else
883883
#endif /* MITSHM */
884884
if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE) {
885-
int x, y, w, h;
885+
int x, y;
886886
x = pRasInfo->bounds.x1;
887887
y = pRasInfo->bounds.y1;
888-
w = pRasInfo->bounds.x2 - x;
889-
h = pRasInfo->bounds.y2 - y;
890888

891889
xpriv->img = X11SD_GetImage(env, xsdo, &pRasInfo->bounds, lockFlags);
892890
if (xpriv->img) {

‎src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ AWTDrawGlyphList(JNIEnv *env, jobject xtr,
213213
XImage *theImage;
214214
Pixmap thePixmap;
215215
XGCValues xgcv;
216-
int scan, screen;
216+
int screen;
217217
AwtGraphicsConfigDataPtr cData;
218218
X11SDOps *xsdo = (X11SDOps *)jlong_to_ptr(dstData);
219219
jint cx1, cy1, cx2, cy2;
@@ -236,8 +236,6 @@ AWTDrawGlyphList(JNIEnv *env, jobject xtr,
236236
thePixmap = cData->monoPixmap;
237237
theGC = cData->monoPixmapGC;
238238

239-
scan = theImage->bytes_per_line;
240-
241239
xgcv.fill_style = FillStippled;
242240
xgcv.stipple = thePixmap;
243241
xgcv.ts_x_origin = bounds->x1;

‎src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
304304
AwtGraphicsConfigDataPtr *graphicsConfigs;
305305
AwtGraphicsConfigDataPtr defaultConfig;
306306
int ind;
307-
char errmsg[128];
308307
int xinawareScreen;
309308
void* xrenderLibHandle = NULL;
310309
XRenderFindVisualFormatFunc* xrenderFindVisualFormat = NULL;
@@ -722,7 +721,6 @@ awt_init_Display(JNIEnv *env, jobject this)
722721
jclass klass;
723722
Display *dpy;
724723
char errmsg[128];
725-
int i;
726724

727725
if (awt_display) {
728726
return awt_display;
@@ -872,7 +870,6 @@ extern int mitShmPermissionMask;
872870
void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) {
873871
XShmSegmentInfo shminfo;
874872
int XShmMajor, XShmMinor;
875-
int a, b, c;
876873

877874
AWT_LOCK();
878875
if (canUseShmExt != UNSET_MITSHM) {
@@ -1154,7 +1151,7 @@ JNIEnv *env, jobject this, jint visualNum, jint screen)
11541151

11551152
AwtGraphicsConfigData *adata = NULL;
11561153
AwtScreenData asd = x11Screens[screen];
1157-
int i, n;
1154+
int i;
11581155
int depth;
11591156
XImage * tempImage;
11601157

‎src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c

-4
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,6 @@ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox,
793793
XRectangle clip;
794794
int image_only;
795795

796-
int count=0 ;
797-
798796
*hasNonDefault = False;
799797
XUnionRectWithRegion( bbox, bbox_region, bbox_region);
800798
XGetWindowAttributes( disp, win, &win_attrs);
@@ -823,8 +821,6 @@ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox,
823821
malloc( sizeof( image_region_type)))) {
824822
return (list_ptr) NULL;
825823
}
826-
count++;
827-
828824
new_reg->visible_region = XCreateRegion();
829825
new_reg->win = base_src->win;
830826
new_reg->vis = base_src->vis;

‎src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ FreeColors(Display * display, Screen * screen, int numColors,
209209
}
210210

211211
static void SplashCenter(Splash * splash) {
212-
Atom type, atom, actual_type;
212+
Atom atom, actual_type;
213213
int status, actual_format;
214214
unsigned long nitems, bytes_after;
215215
CARD16 *prop = NULL;
@@ -251,8 +251,6 @@ static void SplashUpdateSizeHints(Splash * splash) {
251251

252252
void
253253
SplashCreateWindow(Splash * splash) {
254-
XSizeHints sizeHints;
255-
256254
XSetWindowAttributes attr;
257255

258256
attr.backing_store = NotUseful;
@@ -740,11 +738,10 @@ void
740738
SplashCreateThread(Splash * splash) {
741739
pthread_t thr;
742740
pthread_attr_t attr;
743-
int rc;
744741

745742
int rslt = pthread_attr_init(&attr);
746743
if (rslt != 0) return;
747-
rc = pthread_create(&thr, &attr, SplashScreenThread, (void *) splash);
744+
pthread_create(&thr, &attr, SplashScreenThread, (void *) splash);
748745
pthread_attr_destroy(&attr);
749746
}
750747

0 commit comments

Comments
 (0)
Please sign in to comment.