This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

A patch for "statement with no effect" warnings in intl calls


	This patch fixes 20 "statement with no effect" warnings caused
by libintl.h defining textdomain/bindtextdomain as macros which do
nothing but resolve to one of their macro arguments.  The solution I
used was to cast the expression to (void). 

	I decided it was better to do this inline instead of in the
definition in libintl.h.  This is so we stay as close as possible to the
original intl code in case we want to upgrade the version we use in the
future.  Also its possible somewhere in the code we'd want to use the
return value from these functions so again it would be wrong to cast to
void in the macro definition. 

	I also squashed a few other warnings in cccp.c.

Okay to install?

		--Kaveh



Sat Mar 13 10:23:29 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* cccp.c (default_include): Initialize structure memebers.
  	(pass_thru_directive): Change the type of 'keyword_length' to int.
  	(main): Cast the result of bindtextdomain/textdomain to (void).

	* collect2.c (main): Likewise.

	* cppmain.c (main): Likewise.

	* gcc.c (main): Likewise.

	* gcov.c (main): Likewise.

	* protoize.c (main): Likewise.

	* toplev.c (main): Likewise.

diff -rup orig/egcs-CVS19990312/gcc/cccp.c egcs-CVS19990312/gcc/cccp.c
--- orig/egcs-CVS19990312/gcc/cccp.c	Thu Mar 11 09:26:27 1999
+++ egcs-CVS19990312/gcc/cccp.c	Sat Mar 13 08:03:43 1999
@@ -385,42 +385,42 @@ static struct default_include {
 #else
   = {
     /* Pick up GNU C++ specific include files.  */
-    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },
+    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0 },
 #ifdef CROSS_COMPILE
     /* This is the dir for fixincludes.  Put it just before
        the files that we fix.  */
-    { GCC_INCLUDE_DIR, "GCC", 0, 0 },
+    { GCC_INCLUDE_DIR, "GCC", 0, 0, 0 },
     /* For cross-compilation, this dir name is generated
        automatically in Makefile.in.  */
-    { CROSS_INCLUDE_DIR, "GCC", 0, 0 },
+    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0 },
 #ifdef TOOL_INCLUDE_DIR
     /* This is another place that the target system's headers might be.  */
-    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0 },
+    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 },
 #endif
 #else /* not CROSS_COMPILE */
 #ifdef LOCAL_INCLUDE_DIR
     /* This should be /usr/local/include and should come before
        the fixincludes-fixed header files.  */
-    { LOCAL_INCLUDE_DIR, 0, 0, 1 },
+    { LOCAL_INCLUDE_DIR, 0, 0, 1, 0 },
 #endif
 #ifdef TOOL_INCLUDE_DIR
     /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
        Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h.  */
-    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0 },
+    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 },
 #endif
     /* This is the dir for fixincludes.  Put it just before
        the files that we fix.  */
-    { GCC_INCLUDE_DIR, "GCC", 0, 0 },
+    { GCC_INCLUDE_DIR, "GCC", 0, 0, 0 },
     /* Some systems have an extra dir of include files.  */
 #ifdef SYSTEM_INCLUDE_DIR
-    { SYSTEM_INCLUDE_DIR, 0, 0, 0 },
+    { SYSTEM_INCLUDE_DIR, 0, 0, 0, 0 },
 #endif
 #ifndef STANDARD_INCLUDE_COMPONENT
 #define STANDARD_INCLUDE_COMPONENT 0
 #endif
-    { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 },
+    { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 0 },
 #endif /* not CROSS_COMPILE */
-    { 0, 0, 0, 0 }
+    { 0, 0, 0, 0, 0 }
     };
 #endif /* no INCLUDE_DEFAULTS */
 
@@ -1250,8 +1250,8 @@ main (argc, argv)
 #ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-  bindtextdomain (PACKAGE, localedir);
-  textdomain (PACKAGE);
+  (void) bindtextdomain (PACKAGE, localedir);
+  (void) textdomain (PACKAGE);
 
   progname = base_name (argv[0]);
 
@@ -5738,7 +5738,7 @@ pass_thru_directive (buf, limit, op, key
      FILE_BUF *op;
      struct directive *keyword;
 {
-  register unsigned keyword_length = keyword->length;
+  register int keyword_length = keyword->length;
 
   check_expand (op, 1 + keyword_length + (limit - buf));
   *op->bufp++ = '#';
diff -rup orig/egcs-CVS19990312/gcc/collect2.c egcs-CVS19990312/gcc/collect2.c
--- orig/egcs-CVS19990312/gcc/collect2.c	Wed Feb 10 15:12:16 1999
+++ egcs-CVS19990312/gcc/collect2.c	Sat Mar 13 09:27:00 1999
@@ -1002,8 +1002,8 @@ main (argc, argv)
 #ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-  bindtextdomain (PACKAGE, localedir);
-  textdomain (PACKAGE);
+  (void) bindtextdomain (PACKAGE, localedir);
+  (void) textdomain (PACKAGE);
 
   /* Do not invoke xcalloc before this point, since locale needs to be
      set first, in case a diagnostic is issued.  */
diff -rup orig/egcs-CVS19990312/gcc/cppmain.c egcs-CVS19990312/gcc/cppmain.c
--- orig/egcs-CVS19990312/gcc/cppmain.c	Sat Jan 30 13:57:00 1999
+++ egcs-CVS19990312/gcc/cppmain.c	Sat Mar 13 09:29:55 1999
@@ -72,8 +72,8 @@ main (argc, argv)
 #ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-  bindtextdomain (PACKAGE, localedir);
-  textdomain (PACKAGE);
+  (void) bindtextdomain (PACKAGE, localedir);
+  (void) textdomain (PACKAGE);
 
   cpp_reader_init (&parse_in);
   parse_in.opts = opts;
diff -rup orig/egcs-CVS19990312/gcc/gcc.c egcs-CVS19990312/gcc/gcc.c
--- orig/egcs-CVS19990312/gcc/gcc.c	Wed Mar 10 23:07:40 1999
+++ egcs-CVS19990312/gcc/gcc.c	Sat Mar 13 09:24:17 1999
@@ -4654,8 +4654,8 @@ main (argc, argv)
 #ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-  bindtextdomain (PACKAGE, localedir);
-  textdomain (PACKAGE);
+  (void) bindtextdomain (PACKAGE, localedir);
+  (void) textdomain (PACKAGE);
 
   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
     signal (SIGINT, fatal_error);
diff -rup orig/egcs-CVS19990312/gcc/gcov.c egcs-CVS19990312/gcc/gcov.c
--- orig/egcs-CVS19990312/gcc/gcov.c	Sat Jan 30 15:18:48 1999
+++ egcs-CVS19990312/gcc/gcov.c	Sat Mar 13 09:25:55 1999
@@ -228,8 +228,8 @@ main (argc, argv)
 #ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-  bindtextdomain (PACKAGE, localedir);
-  textdomain (PACKAGE);
+  (void) bindtextdomain (PACKAGE, localedir);
+  (void) textdomain (PACKAGE);
 
   process_args (argc, argv);
 
diff -rup orig/egcs-CVS19990312/gcc/protoize.c egcs-CVS19990312/gcc/protoize.c
--- orig/egcs-CVS19990312/gcc/protoize.c	Thu Mar 11 09:27:31 1999
+++ egcs-CVS19990312/gcc/protoize.c	Sat Mar 13 08:10:34 1999
@@ -4560,8 +4560,8 @@ main (argc, argv)
 #ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-  bindtextdomain (PACKAGE, localedir);
-  textdomain (PACKAGE);
+  (void) bindtextdomain (PACKAGE, localedir);
+  (void) textdomain (PACKAGE);
 
   cwd_buffer = getpwd ();
   if (!cwd_buffer)
diff -rup orig/egcs-CVS19990312/gcc/toplev.c egcs-CVS19990312/gcc/toplev.c
--- orig/egcs-CVS19990312/gcc/toplev.c	Wed Mar 10 23:04:43 1999
+++ egcs-CVS19990312/gcc/toplev.c	Sat Mar 13 08:06:27 1999
@@ -4651,8 +4651,8 @@ main (argc, argv)
 #ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-  bindtextdomain (PACKAGE, localedir);
-  textdomain (PACKAGE);
+  (void) bindtextdomain (PACKAGE, localedir);
+  (void) textdomain (PACKAGE);
 
   signal (SIGFPE, float_signal);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]