GNU bug report logs - #11905
Unnecessary '#define unix' in src/s/aix4-2.h

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 10 Jul 2012 23:32:01 UTC

Severity: minor

Found in version 24.1.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11905 in the body.
You can then email your comments to 11905 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to eggert <at> cs.ucla.edu, bug-gnu-emacs <at> gnu.org:
bug#11905; Package emacs. (Tue, 10 Jul 2012 23:32:02 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: Unnecessary '#define unix' in src/s/aix4-2.h
Date: Tue, 10 Jul 2012 19:25:59 -0400
Package: emacs
Version: 24.1.50
Severity: minor

src/s/aix4-2.h does this:

  /* AIX doesn't define this.  */
  #define unix 1

The only place left in Emacs that references '#ifdef unix' is
lib/getloadavg.c, from Gnulib. I suspect that Gnulib already has the AIX
case covered (via "__unix"?), so that src/s/aix4-2.h no longer needs to
define "unix". But I'm not sure, hence this report...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11905; Package emacs. (Tue, 10 Jul 2012 23:58:01 GMT) Full text and rfc822 format available.

Message #6 received at 11905 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Glenn Morris <rgm <at> gnu.org>
Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 11905 <at> debbugs.gnu.org
Subject: Re: bug#11905: Unnecessary '#define unix' in src/s/aix4-2.h
Date: Tue, 10 Jul 2012 16:52:23 -0700
On 07/10/2012 04:25 PM, Glenn Morris wrote:
> I suspect that Gnulib already has the AIX
> case covered (via "__unix"?), so that src/s/aix4-2.h no longer needs to
> define "unix".

Yes, that sounds right.  I have started to fix this by
installing the following patch into gnulib, and will
propagate this into Emacs shortly.

---
 ChangeLog        |    9 +++++++++
 lib/getloadavg.c |   28 +++-------------------------
 m4/getloadavg.m4 |    2 ++
 3 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d94f7b1..b27ef8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-07-10  Paul Eggert  <eggert <at> cs.ucla.edu>
+
+	getloadavg: clean out old Emacs and Autoconf cruft
+	See Glenn Morris in <http://bugs.gnu.org/11905>.
+	* lib/getloadavg.c: Include <config.h>, <stdbool.h> always.
+	Include <sys/param.h> if HAVE_SYS_PARAM_H, not if unix or __unix.
+	(LDAV_CVT): Remove no-longer-used LOAD_AVE_CVT hook.
+	* m4/getloadavg.m4 (gl_PREREQ_GETLOADAVG): Check for <sys/param.h>.
+
 2012-07-10  Akim Demaille  <akim <at> lrde.epita.fr>
 
 	bootstrap: let warn be like tests/init.sh's warn_
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 79ea717..a8ffefe 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -80,45 +80,23 @@
    We also #define LDAV_PRIVILEGED if a program will require
    special installation to be able to call getloadavg.  */
 
-/* "configure" defines CONFIGURING_GETLOADAVG to sidestep problems
-   with partially-configured source directories.  */
-
-#ifndef CONFIGURING_GETLOADAVG
-# include <config.h>
-# include <stdbool.h>
-#endif
+#include <config.h>
 
 /* Specification.  */
 #include <stdlib.h>
 
 #include <errno.h>
+#include <stdbool.h>
 #include <stdio.h>
 
 # include <sys/types.h>
 
-/* Both the Emacs and non-Emacs sections want this.  Some
-   configuration files' definitions for the LOAD_AVE_CVT macro (like
-   sparc.h's) use macros like FSCALE, defined here.  */
-# if defined (unix) || defined (__unix)
+# if HAVE_SYS_PARAM_H
 #  include <sys/param.h>
 # endif
 
 # include "intprops.h"
 
-/* The existing Emacs configuration files define a macro called
-   LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
-   returns the load average multiplied by 100.  What we actually want
-   is a macro called LDAV_CVT, which returns the load average as an
-   unmultiplied double.
-
-   For backwards compatibility, we'll define LDAV_CVT in terms of
-   LOAD_AVE_CVT, but future machine config files should just define
-   LDAV_CVT directly.  */
-
-# if !defined (LDAV_CVT) && defined (LOAD_AVE_CVT)
-#  define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
-# endif
-
 # if !defined (BSD) && defined (ultrix)
 /* Ultrix behaves like BSD on Vaxen.  */
 #  define BSD
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 029da44..7738d2f 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -105,6 +105,8 @@ AC_DEFUN([gl_PREREQ_GETLOADAVG],
 [
 # Figure out what our getloadavg.c needs.
 
+AC_CHECK_HEADERS_ONCE([sys/param.h])
+
 # On HPUX9, an unprivileged user can get load averages this way.
 if test $gl_func_getloadavg_done = no; then
   AC_CHECK_FUNCS([pstat_getdynamic], [gl_func_getloadavg_done=yes])
-- 
1.7.6.5





Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 11 Jul 2012 00:08:01 GMT) Full text and rfc822 format available.

Notification sent to Glenn Morris <rgm <at> gnu.org>:
bug acknowledged by developer. (Wed, 11 Jul 2012 00:08:02 GMT) Full text and rfc822 format available.

Message #11 received at 11905-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 11905-done <at> debbugs.gnu.org
Subject: Re: bug#11905: Unnecessary '#define unix' in src/s/aix4-2.h
Date: Tue, 10 Jul 2012 17:01:48 -0700
I merged the gnulib changes into Emacs as trunk bzr 109007
and am marking this as done.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11905; Package emacs. (Wed, 11 Jul 2012 07:32:01 GMT) Full text and rfc822 format available.

Message #14 received at 11905 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Glenn Morris <rgm <at> gnu.org>, bug-gnulib <bug-gnulib <at> gnu.org>,
	11905 <at> debbugs.gnu.org
Subject: Re: bug#11905: Unnecessary '#define unix' in src/s/aix4-2.h
Date: Wed, 11 Jul 2012 09:26:05 +0200
Paul Eggert wrote:
> On 07/10/2012 04:25 PM, Glenn Morris wrote:
>> I suspect that Gnulib already has the AIX
>> case covered (via "__unix"?), so that src/s/aix4-2.h no longer needs to
>> define "unix".
>
> Yes, that sounds right.  I have started to fix this by
> installing the following patch into gnulib, and will
> propagate this into Emacs shortly.
>
> ---
>  ChangeLog        |    9 +++++++++
>  lib/getloadavg.c |   28 +++-------------------------
>  m4/getloadavg.m4 |    2 ++
>  3 files changed, 14 insertions(+), 25 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index d94f7b1..b27ef8d 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,12 @@
> +2012-07-10  Paul Eggert  <eggert <at> cs.ucla.edu>
> +
> +	getloadavg: clean out old Emacs and Autoconf cruft
> +	See Glenn Morris in <http://bugs.gnu.org/11905>.
> +	* lib/getloadavg.c: Include <config.h>, <stdbool.h> always.
> +	Include <sys/param.h> if HAVE_SYS_PARAM_H, not if unix or __unix.
> +	(LDAV_CVT): Remove no-longer-used LOAD_AVE_CVT hook.
> +	* m4/getloadavg.m4 (gl_PREREQ_GETLOADAVG): Check for <sys/param.h>.

Welcome clean-up.  Thanks!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 08 Aug 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.