diff configure.ac @ 5016:2ade80e8c640

enable more warnings and fix them -------------------- ChangeLog entries follow: -------------------- ChangeLog addition: 2010-02-08 Ben Wing <ben@xemacs.org> * configure: * configure.ac (TAB): Various warnings that used to be present had mistakenly gotten turned off. Turn them back on. lwlib/ChangeLog addition: 2010-02-08 Ben Wing <ben@xemacs.org> * xt-wrappers.h: * xt-wrappers.h (Xt_SET_VALUE): * xt-wrappers.h (Xt_GET_VALUE): Rename var to avoid shadowing problems. src/ChangeLog addition: 2010-02-08 Ben Wing <ben@xemacs.org> * alloc.c: Add prototypes for debugging functions. * alloc.c (compact_string_chars): Make static. * console-x.c (x_initially_selected_for_input): * console-x.h: * console-x.h (X_ERROR_OCCURRED): Delete x_has_keysym() prototype from console-x.c, move to console-x.h. * eval.c (multiple_value_call): Real bug: Fix shadowing local vars. * event-unixoid.c (read_event_from_tty_or_stream_desc): * event-unixoid.c (signal_fake_event): * lread.c (check_if_suppressed): * strftime.c (strftime): Fix stupid global shadowing warnings. * event-unixoid.c (signal_fake_event): * event-unixoid.c (drain_signal_event_pipe): Use Rawbyte, not char. * frame.h: Remove old prototype. * gc.c: * gc.c (show_gc_cursor_and_message): * gc.c (remove_gc_cursor_and_message): * gc.c (gc_prepare): * gc.c (gc_finish_mark): * gc.c (gc_finalize): * gc.c (gc_sweep): * gc.c (gc_finish): * gc.c (gc_suspend_mark_phase): * gc.c (gc_resume_mark_phase): * gc.c (gc_mark): * gc.c (gc_resume_mark): Make fns static. * glyphs-eimage.c (gif_decode_error_string): Fix non-prototype. * lisp.h: Hack around global shadowing warnings involving `index'. * intl-win32.c (wcsncpy): * number-gmp.c (bigfloat_to_string): * objects-msw.c (mswindows_font_spec_matches_charset_stage_2): * specifier.c (call_charset_predicate): * specifier.c (DEFINE_SPECIFIER_TAG_FROB): Declarations cannot follow statements in standard C. * search.c (search_buffer): Fix local shadowing warnings.
author Ben Wing <ben@xemacs.org>
date Mon, 08 Feb 2010 21:28:57 -0600
parents 97c45e3ad810
children 6f2158fa75ed 861f2601a38b
line wrap: on
line diff
--- a/configure.ac	Mon Feb 08 16:51:25 2010 -0600
+++ b/configure.ac	Mon Feb 08 21:28:57 2010 -0600
@@ -2053,28 +2053,52 @@
     dnl Ulrich Drepper has rejected patches to fix the glibc header files.
     test "$have_glibc" != "yes" && \
       with_cflags_warning="$with_cflags_warning -Wpointer-arith"
+    dnl
     dnl Warning flags that may differ for gcc and g++ (xemacs_compiler)
+    dnl
     dnl With g++, -Wshadow produces five zillion utterly random warnings --
     dnl a local var named `buffer' conflicts with `struct buffer' for
     dnl example.  Even with gcc, -Wshadow is questionable because of its
     dnl complaints about parameters with the same names as global functions.
-    dnl There is no -Wmissing-declarations under g++.
+    dnl There is no -Wmissing-declarations, -Wmissing-prototypes, or
+    dnl -Wstrict-prototypes under g++.
     dnl But gcc warns about -Weffc++ in C compiles.
+    dnl
+    dnl with_cflags_warning_c is for C-only warnings.
+    dnl with_cflags_warning_cxx is for C++-only warnings.
+    dnl with_cflags_warning_c_xe is for C-only warnings and only when
+    dnl   compiling the source tree (i.e. when --xemacs-compiler is used).
+    with_cflags_warning_c="-Wshadow -Wmissing-declarations"
+    with_cflags_warning_c="$with_cflags_warning_c -Wmissing-prototypes -Wstrict-prototypes"
+    with_cflags_warning_cxx="-Weffc++"
+    with_cflags_warning_c_xe=""
+    dnl -Wunused-parameter only appeared in gcc 3.
+    dnl -Wdeclaration-after-statement only appeared in gcc 3.4, and is C-only.
+    dnl -Wunused-parameter is too annoying for use in lib-src, partly because
+    dnl the UNUSED() decl is in compiler.h and we don't include that in any
+    dnl of the lib-src files.
     dnl With g++, there is no effective way to use -Wunused-parameter without
     dnl some very ugly code changes.
-    if test "$XEMACS_CC_GPP" = "yes"; then
-      xe_cflags_warning="$with_cflags_warning -Weffc++"
-    elif test "$__GCC" -ge 3; then
-      xe_cflags_warning="$with_cflags_warning -Wunused-parameter"
+    if test "$__GCC" -ge 3; then
+      with_cflags_warning_c_xe="$with_cflags_warning_c_xe -Wunused-parameter"
       if test "$__GCC" -gt 3 || test "$__GCC_MINOR" -ge 4; then
-        with_cflags_warning="$with_cflags_warning -Wdeclaration-after-statement"
+        with_cflags_warning_c="$with_cflags_warning_c -Wdeclaration-after-statement"
       fi
     fi
-    with_cflags_warning="$with_cflags_warning -Wshadow -Wmissing-declarations"
-    with_cflags_warning="$with_cflags_warning -Wmissing-prototypes -Wstrict-prototypes"
-    dnl **** If more gcc/g++ flags are added, from here on must handle
-    dnl **** with_cflags_warning and xe_cflags_warning in parallel
+    dnl **** If more gcc/g++ flags are added, add them above, not below
+    dnl
+    dnl Now set warnings for the source tree (xe_cflags_warning) and for
+    dnl lib-src (with_cflags_warning).  Note that if we didn't set
+    dnl xe_cflags_warning, it would automatically be initialized from
+    dnl with_cflags_warning.
+    if test "$XEMACS_CC_GPP" = "yes"; then
+      xe_cflags_warning="$with_cflags_warning $with_cflags_warning_cxx"
+    else
+      xe_cflags_warning="$with_cflags_warning $with_cflags_warning_c $with_cflags_warning_c_xe"
+    fi
+    with_cflags_warning="$with_cflags_warning $with_cflags_warning_c"
   elif test "$__ICC" = "yes"; then
+    dnl This will apply to both source tree and lib-src
     with_cflags_warning="-Wall -w1 -we147"
   dnl ### Add optimal with_cflags_warning support for other compilers HERE!
   fi