GNU bug report logs - #23640
25.1.50; Getting rid of compiler warnings

Previous Next

Package: emacs;

Reported by: Ken Brown <kbrown <at> cornell.edu>

Date: Sat, 28 May 2016 18:41:02 UTC

Severity: normal

Found in version 25.1.50

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23640 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>, Andy Moreton <andrewjmoreton <at> gmail.com>
Subject: bug#23640: 25.1.50; Getting rid of compiler warnings
Date: Mon, 30 May 2016 12:20:24 -0400
On 5/30/2016 10:41 AM, Ken Brown wrote:
> Question: Why bother with IF_LINT at all?  Why not just unconditionally
> initialize the variables that gcc complains about?

If keeping IF_LINT is important, we could do something like this:
 
diff --git a/configure.ac b/configure.ac
index e88a3a9..f628c9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -997,7 +997,14 @@ AC_DEFUN
     gl_WARN_ADD([-Wno-pointer-sign])
   fi
 
-  AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
+  case $opsys in
+   cygwin | freebsd)
+    AC_DEFINE([gcc_warnings], [1], [Define to 1 if gcc warnings are enabled.])
+      ;;
+   *)
+    AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
+      ;;
+  esac
   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
   AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE],
   [/* Enable compile-time and run-time bounds-checking, and some warnings,
diff --git a/src/conf_post.h b/src/conf_post.h
index 5d3394f..987bcad 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -344,7 +344,7 @@ extern int emacs_setenv_TZ (char const *);
 #endif
 
 /* Use this to suppress gcc's `...may be used before initialized' warnings. */
-#ifdef lint
+#if defined lint || defined gcc_warnings
 /* Use CODE only if lint checking is in effect.  */
 # define IF_LINT(Code) Code
 #else






This bug report was last modified 8 years and 350 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.