changeset 10100:369c11a9858d

avoid a warning from gcc * lib/vasnprintf.c (IF_LINT): Define. (scale10_round_decimal_long_double): Use it to avoid a "may be used uninitialized" warning.
author Jim Meyering <meyering@redhat.com>
date Wed, 21 May 2008 18:38:12 +0200
parents 28dbe341d2b2
children daad35fae43c
files ChangeLog lib/vasnprintf.c
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue May 20 15:06:25 2008 +0200
+++ b/ChangeLog	Wed May 21 18:38:12 2008 +0200
@@ -1,3 +1,10 @@
+2008-05-21  Jim Meyering  <meyering@redhat.com>
+
+	avoid a warning from gcc
+	* lib/vasnprintf.c (IF_LINT): Define.
+	(scale10_round_decimal_long_double):
+	Use it to avoid a "may be used uninitialized" warning.
+
 2008-05-21  Simon Josefsson  <simon@josefsson.org>
 
 	* m4/memcmp.m4: When cross-compiling, assume memcmp works if it is
--- a/lib/vasnprintf.c	Tue May 20 15:06:25 2008 +0200
+++ b/lib/vasnprintf.c	Wed May 21 18:38:12 2008 +0200
@@ -117,6 +117,13 @@
 # include "fpucw.h"
 #endif
 
+/* Use this to suppress gcc's `...may be used before initialized' warnings. */
+#ifdef lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
+#endif
+
 #if HAVE_WCHAR_T
 # if HAVE_WCSLEN
 #  define local_wcslen wcslen
@@ -1205,7 +1212,7 @@
 static char *
 scale10_round_decimal_long_double (long double x, int n)
 {
-  int e;
+  int e IF_LINT(= 0);
   mpn_t m;
   void *memory = decode_long_double (x, &e, &m);
   return scale10_round_decimal_decoded (e, m, memory, n);