Suppress bogus precision loss warnings on amd64

Stephen J. Turnbull stephen at xemacs.org
Fri Jun 22 13:59:42 EDT 2007


APPROVE COMMIT 21.5

GCC warns about load of precision when assigning a void* to an int on
amd64.  These are bogus for values that are file descriptors.

Index: src/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1073
diff -u -r1.1073 ChangeLog
--- src/ChangeLog	22 Jun 2007 17:39:04 -0000	1.1073
+++ src/ChangeLog	22 Jun 2007 17:45:13 -0000
@@ -0,0 +1,6 @@
+2007-06-23  Stephen J. Turnbull  <stephen at xemacs.org>
+
+	* event-unixoid.c (event_stream_unixoid_create_io_streams):
+	* process-unix.c (unix_init_process_io_handles): 
+	Cast out bogus warnings about 64-bit value truncation.
+
 
Index: src/event-unixoid.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/event-unixoid.c,v
retrieving revision 1.21
diff -u -r1.21 event-unixoid.c
--- src/event-unixoid.c	7 Feb 2003 11:50:53 -0000	1.21
+++ src/event-unixoid.c	22 Jun 2007 17:45:13 -0000
@@ -360,10 +360,11 @@
   int infd, outfd, errfd;
   /* Decode inhandle and outhandle. Their meaning depends on
      the process implementation being used. */
-  /* We are passed plain old file descs */
-  infd  = (int) inhandle;
-  outfd = (int) outhandle;
-  errfd = (int) errhandle;
+  /* We are passed plain old file descs, which are ints, so */
+  /* if sizeof(EMACS_INT) > sizeof(int) it's OK. */
+  infd  = (EMACS_INT) inhandle;
+  outfd = (EMACS_INT) outhandle;
+  errfd = (EMACS_INT) errhandle;
 
   *instream = (infd >= 0
 	       ? make_filedesc_input_stream (infd, 0, -1, 0)
Index: src/process-unix.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/process-unix.c,v
retrieving revision 1.58
diff -u -r1.58 process-unix.c
--- src/process-unix.c	1 Apr 2006 16:21:11 -0000	1.58
+++ src/process-unix.c	22 Jun 2007 17:45:13 -0000
@@ -846,8 +846,9 @@
 unix_init_process_io_handles (Lisp_Process *p, void *in, void *UNUSED (out),
 			      void *err, int UNUSED (flags))
 {
-  UNIX_DATA(p)->infd = (int) in;
-  UNIX_DATA(p)->errfd = (int) err;
+  /* if sizeof(EMACS_INT) > sizeof(int) this truncates the value */
+  UNIX_DATA(p)->infd = (EMACS_INT) in;
+  UNIX_DATA(p)->errfd = (EMACS_INT) err;
 }
 
 /* Move the file descriptor FD so that its number is not less than MIN. *




More information about the XEmacs-Patches mailing list