diff --git a/acinclude.m4 b/acinclude.m4 index 20d94e21..69490632 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -7,7 +7,7 @@ dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS dnl -AC_DEFUN(AM_PATH_ESD, +AC_DEFUN([AM_PATH_ESD], [dnl dnl Get the cflags and libraries from the esd-config script dnl @@ -162,4 +162,18 @@ int main () AC_SUBST(ESD_LIBS) rm -f conf.esdtest ]) + +AC_DEFUN([AC_C___ATTRIBUTE__], +[ + AC_MSG_CHECKING(for __attribute__) + AC_CACHE_VAL(ac_cv___attribute__, [ + AC_TRY_COMPILE([#include ], + [int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }], + ac_cv___attribute__=yes, ac_cv___attribute__=no)]) + if test "$ac_cv___attribute__" = "yes"; then + AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__]) + fi + AC_MSG_RESULT($ac_cv___attribute__) +]) + AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/configure.in b/configure.in index f1fd7d49..edc7b9a9 100644 --- a/configure.in +++ b/configure.in @@ -53,6 +53,7 @@ AC_CHECK_HEADERS(alloca.h stdarg.h wctype.h) AC_TYPE_SIGNAL AC_C_BIGENDIAN +AC_C___ATTRIBUTE__ AC_CHECK_FUNCS(getcwd) AC_CHECK_FUNCS(mkdir) @@ -187,7 +188,7 @@ fi AC_SUBST(XVM_LIBS) AC_ARG_ENABLE(xrandr, - [ --enable-xrandr compile with RandR support [default=no]], ,enable_xrandr=no) + [ --enable-xrandr compile with RandR support [default=no]], ,enable_xrandr=no) if test "x$enable_xrandr" = "xyes"; then AC_CHECK_LIB(Xrandr, XRRQueryExtension, AC_DEFINE(HAS_XRANDR, 1, [RandR support]) XRANDR_LIBS=-lXrandr, ,$X_LIBS) @@ -203,6 +204,13 @@ echo "Warning: No ales were found in your refrigerator." echo " We highly suggest that you rectify this situation immediately." ]) +AC_ARG_ENABLE(gcc-warnings, + [ --enable-gcc-warnings enable GCC compiler warnings [default=no]], , + enable_gcc_warnings=no) +if test "x$enable_gcc_warnings" = "xyes"; then + CFLAGS="$CFLAGS -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Waggregate-return -Wcast-align -Wpointer-arith #-Wshadow -Wwrite-strings -Wunreachable-code" +fi + AC_OUTPUT([ Makefile src/Makefile diff --git a/dox/dox.h b/dox/dox.h index 221d3614..073836e3 100644 --- a/dox/dox.h +++ b/dox/dox.h @@ -164,6 +164,12 @@ extern Drawable vIcDrw; #include #endif +#if HAVE___ATTRIBUTE__ +#define __UNUSED__ __attribute__((unused)) +#else +#define __UNUSED__ +#endif + #define FILEPATH_LEN_MAX 4096 #define DEFAULT_LINKCOLOR_R 30 diff --git a/dox/ttfont.c b/dox/ttfont.c index 468075df..12f82628 100644 --- a/dox/ttfont.c +++ b/dox/ttfont.c @@ -45,7 +45,7 @@ ImlibSetFgColorFromGC(Display * disp, GC gc, Colormap cm) void EFont_draw_string(Display * disp, Drawable win, GC gc, int x, int y, char *text, - Efont * f, Visual * vis, Colormap cm) + Efont * f, Visual * vis __UNUSED__, Colormap cm) { Imlib_Image im; int w, h, ascent, descent; @@ -98,7 +98,7 @@ void Efont_extents(Efont * f, char *text, int *font_ascent_return, int *font_descent_return, int *width_return, int *max_ascent_return, int *max_descent_return, - int *lbearing_return, int *rbearing_return) + int *lbearing_return __UNUSED__, int *rbearing_return __UNUSED__) { int height; diff --git a/src/E.h b/src/E.h index 32485e4c..776ca116 100644 --- a/src/E.h +++ b/src/E.h @@ -191,6 +191,12 @@ if (__xim) XDestroyImage(__xim);} #include #include +#if HAVE___ATTRIBUTE__ +#define __UNUSED__ __attribute__((unused)) +#else +#define __UNUSED__ +#endif + /* workaround for 64bit architectures - xlib expects 32bit CARDINALS to be */ /* long's on 64bit machines... thus well the CARD32's Im unsing shoudl be.. */ #define CARD32 long diff --git a/src/stacking.c b/src/stacking.c index 5216cbca..0266962a 100644 --- a/src/stacking.c +++ b/src/stacking.c @@ -178,8 +178,8 @@ EwinListRaise(EWinList * ewl, EWin * ewin, int mode) /* * The global stacking and focus lists */ -EWinList EwinListFocus = { "Focus" }; -EWinList EwinListStack = { "Stack" }; +EWinList EwinListFocus = { "Focus", 0, 0, NULL }; +EWinList EwinListStack = { "Stack", 0, 0, NULL }; EWin ** EwinListGetStacking(int *num)