changeset 4710:3a87551bfeb5

Fixes for a number of minor warnings issued by gcc. See xemacs-patches message <870180fe0910051206s13dca5c3j6303732e33c478f5@mail.gmail.com>.
author Jerry James <james@xemacs.org>
date Mon, 05 Oct 2009 13:07:34 -0600
parents db7068430402
children 985886265686
files modules/ChangeLog modules/ldap/eldap.c src/ChangeLog src/emacs.c src/input-method-xlib.c src/objects-tty.c src/syntax.c
diffstat 7 files changed, 40 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/modules/ChangeLog	Mon Oct 05 11:08:59 2009 -0600
+++ b/modules/ChangeLog	Mon Oct 05 13:07:34 2009 -0600
@@ -1,3 +1,9 @@
+2009-10-05  Jerry James  <james@xemacs.org>
+
+	* ldap/eldap.c (Fldap_search_basic): quiet gcc warnings due to
+	NEW_LISP_STRING_TO_EXTERNAL modifying a variable while computing a
+	result to be passed as a parameter.
+
 2009-05-18  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* XEmacs 21.5.29 "garbanzo" is released.
--- a/modules/ldap/eldap.c	Mon Oct 05 11:08:59 2009 -0600
+++ b/modules/ldap/eldap.c	Mon Oct 05 13:07:34 2009 -0600
@@ -425,7 +425,7 @@
   LDAP *ld;
   LDAPMessage *e;
   BerElement *ptr;
-  Extbyte *a, *dn;
+  Extbyte *a, *dn, *bs, *filt;
   int i, rc;
   int  matches;
   struct ldap_unwind_struct unwind;
@@ -497,14 +497,10 @@
   CHECK_SYMBOL (attrsonly);
 
   /* Perform the search */
-  if (ldap_search (ld,
-                   NILP (base) ? "" :
-		   NEW_LISP_STRING_TO_EXTERNAL (base, Qnative),
-                   ldap_scope,
-                   NILP (filter) ? "" :
-		   NEW_LISP_STRING_TO_EXTERNAL (filter, Qnative),
-                   ldap_attributes,
-                   NILP (attrsonly) ? 0 : 1)
+  bs = NILP (base) ? "" : NEW_LISP_STRING_TO_EXTERNAL (base, Qnative);
+  filt = NILP (filter) ? "" : NEW_LISP_STRING_TO_EXTERNAL (filter, Qnative);
+  if (ldap_search (ld, bs, ldap_scope, filt, ldap_attributes,
+		   NILP (attrsonly) ? 0 : 1)
       == -1)
     {
       signal_ldap_error (ld, NULL, 0);
--- a/src/ChangeLog	Mon Oct 05 11:08:59 2009 -0600
+++ b/src/ChangeLog	Mon Oct 05 13:07:34 2009 -0600
@@ -1,3 +1,14 @@
+2009-10-05  Jerry James  <james@xemacs.org>
+
+	* emacs.c (main_1): Check the return value of dup() to quiet gcc.
+	* input-method-xlib.c (describe_Window): Check the return value of
+	system() to quiet gcc.
+	* objects-tty.c (UNUSED_IF_NEW_GC): New macro.
+	(tty_finalize_color_instance): Use it to quiet gcc.
+	(tty_finalize_font_instance): Ditto.
+	* syntax.c (UNUSED_IF_NEW_GC): New macro.
+	(uninit_buffer_syntax_cache): Use it to quiet gcc.
+
 2009-10-05  Jerry James  <james@xemacs.org>
 
 	* glade.c: Add GPL v2 or later notice with explicit permission of
--- a/src/emacs.c	Mon Oct 05 11:08:59 2009 -0600
+++ b/src/emacs.c	Mon Oct 05 13:07:34 2009 -0600
@@ -1240,9 +1240,8 @@
 	fd = wext_retry_open (term, O_RDWR | OPEN_BINARY, 2);
 	/* Conversions are not possible yet, and printing will be in
 	   external format, so strerror() and ttyname() are OK. */
-	if (fd < 0)
+	if (fd < 0 || dup (0) < 0)
 	  fatal ("%s: %s", WEXTTEXT_TO_8_BIT (term), strerror (errno));
-	dup (0);
 	if (! isatty (0))
 	  fatal ("%s: not a tty", WEXTTEXT_TO_8_BIT (term));
 
--- a/src/input-method-xlib.c	Mon Oct 05 11:08:59 2009 -0600
+++ b/src/input-method-xlib.c	Mon Oct 05 13:07:34 2009 -0600
@@ -895,7 +895,8 @@
   char xwincmd[128];
   sprintf (xwincmd, "xwininfo -id 0x%x >&2; xwininfo -events -id 0x%x >&2",
            (int) win, (int) win);
-  system (xwincmd);
+  if (system (xwincmd) == -1)
+    stderr_out ("Unable to execute xwininfo\n");
 }
 
 void
--- a/src/objects-tty.c	Mon Oct 05 11:08:59 2009 -0600
+++ b/src/objects-tty.c	Mon Oct 05 13:07:34 2009 -0600
@@ -30,6 +30,12 @@
 #include "device.h"
 #include "charset.h"
 
+#ifdef NEW_GC
+# define UNUSED_IF_NEW_GC(decl) UNUSED (decl)
+#else
+# define UNUSED_IF_NEW_GC(decl) decl
+#endif
+
 /* An alist mapping from color names to a cons of (FG-STRING, BG-STRING). */
 Lisp_Object Vtty_color_alist;
 #if 0 /* This stuff doesn't quite work yet */
@@ -219,7 +225,7 @@
 }
 
 static void
-tty_finalize_color_instance (Lisp_Color_Instance *c)
+tty_finalize_color_instance (Lisp_Color_Instance *UNUSED_IF_NEW_GC (c))
 {
 #ifndef NEW_GC
   if (c->data)
@@ -314,7 +320,7 @@
 }
 
 static void
-tty_finalize_font_instance (Lisp_Font_Instance *f)
+tty_finalize_font_instance (Lisp_Font_Instance *UNUSED_IF_NEW_GC (f))
 {
 #ifndef NEW_GC
   if (f->data)
--- a/src/syntax.c	Mon Oct 05 11:08:59 2009 -0600
+++ b/src/syntax.c	Mon Oct 05 13:07:34 2009 -0600
@@ -31,6 +31,12 @@
 #include "syntax.h"
 #include "extents.h"
 
+#ifdef NEW_GC
+# define UNUSED_IF_NEW_GC(decl) UNUSED (decl)
+#else
+# define UNUSED_IF_NEW_GC(decl) decl
+#endif
+
 #define ST_COMMENT_STYLE 0x101
 #define ST_STRING_STYLE  0x102
 
@@ -540,7 +546,7 @@
 /* finalize the syntax cache for BUF */
 
 void
-uninit_buffer_syntax_cache (struct buffer *buf)
+uninit_buffer_syntax_cache (struct buffer *UNUSED_IF_NEW_GC (buf))
 {
 #ifndef NEW_GC
   xfree (buf->syntax_cache, struct syntax_cache *);