changeset 97405:58e6e58841ce

(procfs_system_process_attributes): Use EMACS_INTs to silence gcc "limited range of data type" warnings in some make_fixnum_or_float calls.
author Glenn Morris <rgm@gnu.org>
date Sun, 10 Aug 2008 22:44:25 +0000
parents 4b2fa911beae
children 135add94125a
files src/process.c
diffstat 1 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/process.c	Sun Aug 10 20:18:12 2008 +0000
+++ b/src/process.c	Sun Aug 10 22:44:25 2008 +0000
@@ -7260,6 +7260,7 @@
   Lisp_Object attrs = Qnil;
   Lisp_Object cmd_str, decoded_cmd, tem;
   struct gcpro gcpro1, gcpro2;
+  EMACS_INT uid_eint, gid_eint;
 
   CHECK_NUMBER_OR_FLOAT (pid);
   proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid);
@@ -7271,15 +7272,18 @@
 
   /* euid egid */
   uid = st.st_uid;
-  attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
+  /* Use of EMACS_INT stops GCC whining about limited range of data type.  */
+  uid_eint = uid;
+  attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid_eint)), attrs);
   BLOCK_INPUT;
   pw = (struct passwd *) getpwuid (uid);
   UNBLOCK_INPUT;
   if (pw)
     attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
-  
+
   gid = st.st_gid;
-  attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
+  gid_eint = gid;
+  attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid_eint)), attrs);
   BLOCK_INPUT;
   gr = (struct group *) getgrgid (gid);
   UNBLOCK_INPUT;
@@ -7313,6 +7317,7 @@
 
       if (q)
 	{
+	  EMACS_INT ppid_eint, pgrp_eint, sess_eint, tpgid_eint, thcount_eint;
 	  p = q + 2;
 	  /* state ppid pgrp sess tty tpgid . minflt cminflt majflt cmajflt utime stime cutime cstime priority nice thcount . start vsize rss */
 	  sscanf (p, "%c %d %d %d %d %d %*u %lu %lu %lu %lu %Lu %Lu %Lu %Lu %ld %ld %d %*d %Lu %lu %ld",
@@ -7328,11 +7333,17 @@
 	    tem =  build_string (state_str);
 	    attrs = Fcons (Fcons (Qstate, tem), attrs);
 	  }
-	  attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (ppid)), attrs);
-	  attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pgrp)), attrs);
-	  attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (sess)), attrs);
+	  /* Stops GCC whining about limited range of data type.  */
+	  ppid_eint = ppid;
+	  pgrp_eint = pgrp;
+	  sess_eint = sess;
+	  tpgid_eint = tpgid;
+	  thcount_eint = thcount;
+	  attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (ppid_eint)), attrs);
+	  attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pgrp_eint)), attrs);
+	  attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (sess_eint)), attrs);
 	  attrs = Fcons (Fcons (Qttname, procfs_ttyname (tty)), attrs);
-	  attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (tpgid)), attrs);
+	  attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (tpgid_eint)), attrs);
 	  attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (minflt)), attrs);
 	  attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (majflt)), attrs);
 	  attrs = Fcons (Fcons (Qcminflt, make_fixnum_or_float (cminflt)), attrs);
@@ -7354,7 +7365,7 @@
 			 attrs);
 	  attrs = Fcons (Fcons (Qpri, make_number (priority)), attrs);
 	  attrs = Fcons (Fcons (Qnice, make_number (nice)), attrs);
-	  attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount)), attrs);
+	  attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount_eint)), attrs);
 	  EMACS_GET_TIME (tnow);
 	  get_up_time (&sec, &usec);
 	  EMACS_SET_SECS (telapsed, sec);