unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Glenn Morris <rgm@gnu.org>
Cc: bug-gnulib <bug-gnulib@gnu.org>, 11905@debbugs.gnu.org
Subject: bug#11905: Unnecessary '#define unix' in src/s/aix4-2.h
Date: Tue, 10 Jul 2012 16:52:23 -0700	[thread overview]
Message-ID: <4FFCC037.3050801__35944.3891597495$1341964371$gmane$org@cs.ucla.edu> (raw)
In-Reply-To: <dw394z2o6w.fsf@fencepost.gnu.org>

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@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@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	other threads:[~2012-07-10 23:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10 23:25 bug#11905: Unnecessary '#define unix' in src/s/aix4-2.h Glenn Morris
2012-07-10 23:52 ` Paul Eggert [this message]
2012-07-11  0:01 ` Paul Eggert
     [not found] ` <4FFCC037.3050801@cs.ucla.edu>
2012-07-11  7:26   ` Jim Meyering

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='4FFCC037.3050801__35944.3891597495$1341964371$gmane$org@cs.ucla.edu' \
    --to=eggert@cs.ucla.edu \
    --cc=11905@debbugs.gnu.org \
    --cc=bug-gnulib@gnu.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).