Ever since I updated my system to gcc 4.2.x, mtn has been worthless,
dumping core on any attempted invocation (even 'mtn version'). But
this weekend, I updated my system to a somewhat newer 4.2.x, and mtn
0.37, and something in that process allowed it to start working again.
To celebrate, I decided to fiddle with ctwm instead of getting real
work done today. So I went through, cranked up the intensity on the
compiler warning flags, and cleaned up a bunch of warnings. See
attached patch. I believe the changes are such that if it compiles,
it'll work. Some testing here has supported the idea that I've broken
nothing. However, I'd like another set of eyeballs or three to go
over it before I feel safe merging it in. The most likely trouble
spot would be the yacc/flex file changes, and interactions with
versions other than than I have.
With the flags specified and my version of gcc (and a hack on the
built Makefile to use -isystem instead of -I for /usr/local/include
headers, thus avoiding warnings originating there), the only warnings
remaining are a handful on the lex.[cl] file, which TTBOMK all
originate inside lex and so aren't really under my control, sadly.
Reevyou! Gimme reevyou!
--
Matthew Fuller (MF4839) | [EMAIL PROTECTED]
Systems/Network Administrator | http://www.over-yonder.net/~fullermd/
On the Internet, nobody can hear you scream.
#
#
# patch "Imakefile"
# from [ff68e27bd83c76f682b7943dfe0acf324db7c40e]
# to [24023a8affee072c6558ad42d30b22c73fcc5e95]
#
# patch "add_window.c"
# from [32b936cdaba147612081b1fbe65e7ceb9a22b463]
# to [31705f70831cc555f963f8c65afc82e907095668]
#
# patch "ctwm.c"
# from [85ebd1c921b013aed697fa8ab8f42832817f00eb]
# to [b280c514a7d41937d4cac50730089139cd49f797]
#
# patch "events.c"
# from [685d604d51fbec43362bed358703bb39c23dd5b4]
# to [39f3358ff082d672b599845150ceab6806a03603]
#
# patch "gram.y"
# from [e27e6bb86324a57246031cd0d54cd98540f31ff3]
# to [f2d8e73825d7ce599e46d90a6a80cfaea8174c87]
#
# patch "iconmgr.c"
# from [f00de9c3a0a0eb4e1383551f60e5e7c54315778f]
# to [1913a0dfec0f14363674c5aaae659aae4f1f184b]
#
# patch "lex.l"
# from [42990f85e25cfa917cc0abbca579ca2c1061913b]
# to [5c3aacac9e7be64a40528463042849078f206fc1]
#
# patch "libctwm.c"
# from [decb7ec8dc7edb365362c7220f8560ab118a7cd8]
# to [ea6442fdfa5ee8be8d3705d2fa2052ad0e78b835]
#
# patch "menus.c"
# from [39180761b17dc3976d2882a57dc29ebcfb83b0be]
# to [632c430163ddf41f989803e968b849bac87001f5]
#
# patch "parse.c"
# from [a981dab6c1497614bbf93a9eb19a1e28fe871249]
# to [d0e2286f01a52c83893c9bffa10ca4ab214abda8]
#
# patch "siconify.bm"
# from [9f8036b04cc5732c911a2c9d3c009ff62f9ed795]
# to [fdcf54778c00bf4b3ec290dde3bd90b5625063fb]
#
# patch "util.c"
# from [94efd2be21b528cc2b88738e412a17c656309150]
# to [511d6c1cf0fdf697b6b34ec558f64aa4a94b4155]
#
# patch "util.h"
# from [086a3b87e05de5bca8bb5221a7fce8478059865e]
# to [d8a995b60f289e1038c500a7641c5ee56022f10f]
#
# patch "vscreen.c"
# from [9c5d09d51fefe8231e9de7ce18694c4852254ac7]
# to [9c8e13bbd28f15cf2881a7f2daf932ac025a9856]
#
# patch "workmgr.c"
# from [6ae1b763af5d189dad48ba1c9cb1db121f5c3f60]
# to [cbbb225102a852d23956bec573e7e10b61620c54]
#
============================================================
--- Imakefile ff68e27bd83c76f682b7943dfe0acf324db7c40e
+++ Imakefile 24023a8affee072c6558ad42d30b22c73fcc5e95
@@ -115,6 +115,8 @@ DEBUGPARSERDEFINES = -DYYDEBUG=1
#ifdef GCC_PEDANTIC
CCOPTIONS = -pedantic -ansi -Wall \
-Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wundef \
+ -Wredundant-decls -Wcast-align -Wcast-qual -Wchar-subscripts \
+ -Winline -Wnested-externs -Wmissing-declarations \
-aux-info [EMAIL PROTECTED]
#endif
============================================================
--- add_window.c 32b936cdaba147612081b1fbe65e7ceb9a22b463
+++ add_window.c 31705f70831cc555f963f8c65afc82e907095668
@@ -128,7 +128,6 @@ extern Atom _OL_WIN_ATTR;
int resizeWhenAdd;
extern Atom _OL_WIN_ATTR;
-extern int captive;
#if defined(__hpux) && !defined(_XPG4_EXTENDED)
# define FDSET int*
@@ -2539,7 +2538,7 @@ void RemoveWindowFromRegion (TwmWindow *
* this approach assumes screens that are next to each other horizontally,
* Other possibilities need to be investigated and accounted for.
*/
-void DealWithNonSensicalGeometries(Display *dpy, Window vroot, TwmWindow *tmp_win)
+void DealWithNonSensicalGeometries(Display *mydpy, Window vroot, TwmWindow *tmp_win)
{
Window vvroot;
int x,y;
@@ -2551,7 +2550,7 @@ void DealWithNonSensicalGeometries(Displ
if(! vroot)
return;
- if(!(XGetGeometry(dpy, vroot, &vvroot, &x, &y, &w, &h, &j, &j)))
+ if(!(XGetGeometry(mydpy, vroot, &vvroot, &x, &y, &w, &h, &j, &j)))
return;
myvs = findIfVScreenOf(x, y);
============================================================
--- ctwm.c 85ebd1c921b013aed697fa8ab8f42832817f00eb
+++ ctwm.c b280c514a7d41937d4cac50730089139cd49f797
@@ -338,7 +338,8 @@ int main(int argc, char **argv, char **e
MultiScreen = False;
if ((i + 1) >= argc) continue;
if (*(argv [i + 1]) == '-') continue;
- if (sscanf (argv [i + 1], "%x", &capwin) != 1) continue;
+ if (sscanf (argv [i + 1], "%x", (unsigned int *)&capwin) != 1)
+ continue;
i++;
continue;
#ifdef USEM4
@@ -1159,7 +1160,6 @@ void CreateFonts (void)
}
-void RestoreWithdrawnLocation (TwmWindow *tmp);
void RestoreWithdrawnLocation (TwmWindow *tmp)
{
int gravx, gravy;
@@ -1322,8 +1322,6 @@ void DoRestart(Time t)
void DoRestart(Time t)
{
- extern SmcConn smcConn;
-
RestartFlag = 0;
StopAnimation ();
============================================================
--- events.c 685d604d51fbec43362bed358703bb39c23dd5b4
+++ events.c 39f3358ff082d672b599845150ceab6806a03603
@@ -111,9 +111,8 @@ extern char *CurrentSelectedWorkspace;
extern unsigned int mods_used;
extern int menuFromFrameOrWindowOrTitlebar;
extern char *CurrentSelectedWorkspace;
+extern int RaiseDelay;
-extern int captive;
-
#ifdef USE_SIGNALS
extern Bool AnimationPending;
#else /* USE_SIGNALS */
@@ -131,6 +130,7 @@ void RedoIconName(void);
static void do_key_menu (MenuRoot *menu, /* menu to pop up */
Window w); /* invoking window or None */
void RedoIconName(void);
+extern void twmrc_error_prefix(void);
#ifdef SOUNDS
extern void play_sound(int snd);
@@ -3335,7 +3335,6 @@ void HandleEnterNotify(void)
XEnterWindowEvent *ewp = &Event.xcrossing;
HENScanArgs scanArgs;
XEvent dummy;
- extern int RaiseDelay;
virtualScreen *vs;
/*
@@ -4247,7 +4246,6 @@ void ConfigureRootWindow (XEvent *ev)
Window root, child;
int x, y;
unsigned int w, h, bw, d, oldw, oldh;
- extern void twmrc_error_prefix(void);
XGetGeometry (dpy, Scr->CaptiveRoot, &root, &x, &y, &w, &h, &bw, &d);
XTranslateCoordinates (dpy, Scr->CaptiveRoot, root, 0, 0, &Scr->crootx, &Scr->crooty, &child);
============================================================
--- gram.y e27e6bb86324a57246031cd0d54cd98540f31ff3
+++ gram.y f2d8e73825d7ce599e46d90a6a80cfaea8174c87
@@ -115,6 +115,7 @@ extern int yylex(void);
extern void twmrc_error_prefix(void);
extern int yylex(void);
+extern int yyparse(void);
%}
%union
============================================================
--- iconmgr.c f00de9c3a0a0eb4e1383551f60e5e7c54315778f
+++ iconmgr.c 1913a0dfec0f14363674c5aaae659aae4f1f184b
@@ -72,6 +72,7 @@
#include "screen.h"
#include "resize.h"
#include "add_window.h"
+#define __WANT_SICONIFY_BITS
#include "siconify.bm"
#ifdef VMS
#include <decw$include/Xos.h>
============================================================
--- lex.l 42990f85e25cfa917cc0abbca579ca2c1061913b
+++ lex.l 5c3aacac9e7be64a40528463042849078f206fc1
@@ -77,12 +77,11 @@ extern void twmrc_error_prefix(void);
extern int ParseError;
extern void twmrc_error_prefix(void);
#ifdef FLEX_SCANNER
- int yylineno;
# undef YY_INPUT
# define YY_INPUT(buf,result,max_size) {buf[0]=twmInputFunc();result=(buf[0] != 0);}
#endif
-int twmrc_lineno;
+extern int yylex(void);
%}
string \"([^"]|\\.)*\"
============================================================
--- libctwm.c decb7ec8dc7edb365362c7220f8560ab118a7cd8
+++ libctwm.c ea6442fdfa5ee8be8d3705d2fa2052ad0e78b835
@@ -65,7 +65,8 @@ char **CtwmListWorkspaces (Display *disp
int actual_format;
char **ret;
int count;
- int i, l;
+ int i;
+ unsigned long l;
_XA_WM_WORKSPACESLIST = XInternAtom (display, "_WIN_WORKSPACE_NAMES", True);
@@ -133,7 +134,8 @@ char **CtwmCurrentOccupation (Display *d
unsigned long len;
Atom actual_type;
int actual_format;
- int count, l, i;
+ int count, i;
+ unsigned long l;
char **ret;
_XA_WM_OCCUPATION = XInternAtom (display, "WM_OCCUPATION", True);
============================================================
--- menus.c 39180761b17dc3976d2882a57dc29ebcfb83b0be
+++ menus.c 632c430163ddf41f989803e968b849bac87001f5
@@ -129,8 +129,6 @@
#endif
#define ABS(x) ((x)<0?-(x):(x))
-extern XEvent Event;
-
int RootFunction = 0;
MenuRoot *ActiveMenu = NULL; /* the active menu */
MenuItem *ActiveItem = NULL; /* the active menu item */
@@ -141,7 +139,6 @@ Bool AlternateContext;
int AlternateKeymap;
Bool AlternateContext;
-extern int captive;
extern char *captivename;
int ConstMove = FALSE; /* constrained move variables */
@@ -172,8 +169,9 @@ extern TwmWindow *ButtonWindow, *Tmp_win
extern char *Action;
extern int Context;
extern TwmWindow *ButtonWindow, *Tmp_win;
-extern XEvent Event, ButtonEvent;
+extern XEvent ButtonEvent;
extern char *InitFile;
+extern int ConstrainedMoveTime;
static void Identify (TwmWindow *t);
#define SHADOWWIDTH 5 /* in pixels */
@@ -1898,7 +1896,6 @@ int ExecuteFunction(int func, char *acti
int moving_icon = FALSE;
Bool fromtitlebar = False;
Bool from3dborder = False;
- extern int ConstrainedMoveTime;
TwmWindow *t;
RootFunction = 0;
@@ -2529,6 +2526,8 @@ int ExecuteFunction(int func, char *acti
else
Scr->OpaqueMove = FALSE;
+ dragroot = Scr->XineramaRoot;
+
if (tmp_win->winbox) {
XTranslateCoordinates (dpy, dragroot, tmp_win->winbox->window,
eventp->xbutton.x_root, eventp->xbutton.y_root,
@@ -2625,8 +2624,6 @@ int ExecuteFunction(int func, char *acti
}
last_time = eventp->xbutton.time;
- dragroot = Scr->XineramaRoot;
-
if (!Scr->OpaqueMove)
{
InstallRootColormap();
@@ -3083,17 +3080,17 @@ int ExecuteFunction(int func, char *acti
* Keep within [ -denom, -1] or [ 0, denom >.
*/
{
- int w = tmp_win->frame_width; /* or si->denom; if it were != 0 */
+ int wtmp = tmp_win->frame_width; /* or si->denom; if it were != 0 */
if (origNum < 0) {
if (newx >= 0)
newx = -1;
- else if (newx < -w)
- newx = -w;
+ else if (newx < -wtmp)
+ newx = -wtmp;
} else if (origNum >= 0) {
if (newx < 0)
newx = 0;
- else if (newx >= w)
- newx = w - 1;
+ else if (newx >= wtmp)
+ newx = wtmp - 1;
}
}
============================================================
--- parse.c a981dab6c1497614bbf93a9eb19a1e28fe871249
+++ parse.c d0e2286f01a52c83893c9bffa10ca4ab214abda8
@@ -105,6 +105,10 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
+
+extern int GoThroughM4;
+extern char *keepM4_filename;
+extern int KeepTmpFile;
#endif
#if defined(ultrix)
@@ -138,7 +142,6 @@ static char *m4_defs(Display *display, c
static char *m4_defs(Display *display, char *host);
#endif
-extern int twmrc_lineno;
extern int mods;
int ConstrainedMoveTime = 400; /* milliseconds, event times */
@@ -151,12 +154,10 @@ static int m4twmFileInput (void);
#else
static int m4twmFileInput (void);
#endif
-void twmUnput(int c);
int (*twmInputFunc)(void);
extern char *defTwmrc[]; /* default bindings */
-extern int captive;
extern char *captivename;
/***********************************************************************
@@ -205,7 +206,6 @@ int ParseTwmrc (char *filename)
char tmpfilename[257];
#ifdef USEM4
static FILE *raw;
- extern int GoThroughM4;
#endif
/*
@@ -465,7 +465,6 @@ static int m4twmFileInput(void)
static int m4twmFileInput(void)
{
int line;
- extern char *keepM4_filename;
static FILE *cp = NULL;
if ( cp == NULL && keepM4_filename ) {
@@ -2199,7 +2198,6 @@ static char *m4_defs(Display *display, c
static char *m4_defs(Display *display, char *host)
{
- extern int KeepTmpFile;
Screen *screen;
Visual *visual;
char client[MAXHOSTNAME], server[MAXHOSTNAME], *colon;
============================================================
--- siconify.bm 9f8036b04cc5732c911a2c9d3c009ff62f9ed795
+++ siconify.bm fdcf54778c00bf4b3ec290dde3bd90b5625063fb
@@ -1,5 +1,8 @@
#define siconify_width 11
#define siconify_height 11
+
+#ifdef __WANT_SICONIFY_BITS
static unsigned char siconify_bits[] = {
0xff, 0x07, 0x01, 0x04, 0x0d, 0x05, 0x9d, 0x05, 0xb9, 0x04, 0x51, 0x04,
0xe9, 0x04, 0xcd, 0x05, 0x85, 0x05, 0x01, 0x04, 0xff, 0x07};
+#endif
============================================================
--- util.c 94efd2be21b528cc2b88738e412a17c656309150
+++ util.c 511d6c1cf0fdf697b6b34ec558f64aa4a94b4155
@@ -165,7 +165,6 @@
#define MAXANIMATIONSPEED 20
-extern int captive;
extern Atom _XA_WM_WORKSPACESLIST;
static Image *LoadBitmapImage (char *name, ColorPair cp);
@@ -1156,8 +1155,8 @@ void TryToAnimate (void)
gettimeofday (&tp, &tzp);
gap = ((tp.tv_sec - lastsec) * 1000000) + (tp.tv_usec - lastusec);
if (tracefile) {
- fprintf (tracefile, "Time = %lu, %ld, %u, %d, %lu\n", lastsec, lastusec,
- tp.tv_sec, tp.tv_usec, gap);
+ fprintf (tracefile, "Time = %lu, %ld, %ld, %ld, %lu\n", lastsec,
+ lastusec, (long)tp.tv_sec, (long)tp.tv_usec, gap);
fflush (tracefile);
}
gap *= AnimationSpeed;
@@ -3880,7 +3879,7 @@ unsigned char *GetWMPropertyString(Windo
return stringptr;
}
-void FreeWMPropertyString(unsigned char *prop)
+void FreeWMPropertyString(char *prop)
{
if (prop && (char *)prop != NoName) {
free(prop);
============================================================
--- util.h 086a3b87e05de5bca8bb5221a7fce8478059865e
+++ util.h d8a995b60f289e1038c500a7641c5ee56022f10f
@@ -141,7 +141,7 @@ extern unsigned char *GetWMPropertyStrin
extern Image *GetImage (char *name, ColorPair cp);
extern unsigned char *GetWMPropertyString(Window w, Atom prop);
-extern void FreeWMPropertyString(unsigned char *prop);
+extern void FreeWMPropertyString(char *prop);
extern void ConstrainByBorders1 (int *left, int width, int *top, int height);
extern void ConstrainByBorders (TwmWindow *twmwin,
int *left, int width,
============================================================
--- vscreen.c 9c5d09d51fefe8231e9de7ce18694c4852254ac7
+++ vscreen.c 9c8e13bbd28f15cf2881a7f2daf932ac025a9856
@@ -30,6 +30,8 @@
#include "cursor.h"
#include "screen.h"
+extern void twmrc_error_prefix(void);
+
void InitVirtualScreens (ScreenInfo *scr) {
Cursor cursor;
unsigned long valuemask, attrmask;
@@ -37,7 +39,6 @@ void InitVirtualScreens (ScreenInfo *scr
name_list *nptr;
Atom _XA_WM_VIRTUALROOT = XInternAtom (dpy, "WM_VIRTUALROOT", False);
Bool userealroot = True;
- extern void twmrc_error_prefix(void);
NewFontCursor (&cursor, "X_cursor");
@@ -184,6 +185,6 @@ Bool CtwmSetVScreenMap(Display *display,
if(! tally) return(False);
XChangeProperty(display, rootw, _XA_WM_CTWM_VSCREENMAP, XA_STRING, 8,
- PropModeReplace, buf, strlen(buf));
+ PropModeReplace, (unsigned char *)buf, strlen(buf));
return(True);
}
============================================================
--- workmgr.c 6ae1b763af5d189dad48ba1c9cb1db121f5c3f60
+++ workmgr.c cbbb225102a852d23956bec573e7e10b61620c54
@@ -63,7 +63,7 @@ static void fakeRaiseLower ();
extern Atom _XA_WIN_STATE;
#endif /* GNOME */
-extern void twmrc_error_prefix (void); /* in ctwm.c */
+extern void twmrc_error_prefix (void); /* in gram.c */
extern char *captivename;
/***********************************************************************