changeset 7455:8d41d3f68c28

Don't include <config.h> twice; this doesn't work in some cases, e.g., when config.h has "#define intmax_t long long int" and we include <config.h>, <inttypes.h>, <config.h> in that order. * fprintftime.c: Don't include config.h or fprintftime.h. * fts-cycle.c: Don't include config.h. * strftime.c: Include fprintftime.h if FPRINTFTIME is defined. * xstrtoimax.c: Remove copyright notice since it's short tnow. Don't include config.h or xstrtol.h. Define STRTOL_T_MINIMUM and STRTOL_T_MAXIMUM unconditionally, since we now assume gnulib inttypes.h. * xstrtoumax.c: Likewise. * xstrtol.c: Include config.h and xstrtol.h after defining __strtol and the like, so that this module is more like its siblings. (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM) [! defined STRTOL_T_MINIMUM]: Remove; no longer needed now that we assume gnulib inttypes.h. 2006-10-07 Bruno Haible <bruno@clisp.org>
author Paul Eggert <eggert@cs.ucla.edu>
date Sun, 08 Oct 2006 07:24:56 +0000
parents adb8b0c0c238
children 63ca43b34be9
files lib/ChangeLog lib/fprintftime.c lib/fts-cycle.c lib/strftime.c lib/xstrtoimax.c lib/xstrtol.c lib/xstrtoumax.c
diffstat 7 files changed, 30 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,4 +1,22 @@
-2006-10-03  Bruno Haible  <bruno@clisp.org>
+2006-10-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Don't include <config.h> twice; this doesn't work in some cases,
+	e.g., when config.h has "#define intmax_t long long int" and
+	we include <config.h>, <inttypes.h>, <config.h> in that order.
+	* fprintftime.c: Don't include config.h or fprintftime.h.
+	* fts-cycle.c: Don't include config.h.
+	* strftime.c: Include fprintftime.h if FPRINTFTIME is defined.
+	* xstrtoimax.c: Remove copyright notice since it's short tnow.
+	Don't include config.h or xstrtol.h.  Define STRTOL_T_MINIMUM
+	and STRTOL_T_MAXIMUM unconditionally, since we now assume gnulib
+	inttypes.h.
+	* xstrtoumax.c: Likewise.
+	* xstrtol.c: Include config.h and xstrtol.h after defining
+	__strtol and the like, so that this module is more like its siblings.
+	(STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM) [! defined STRTOL_T_MINIMUM]:
+	Remove; no longer needed now that we assume gnulib inttypes.h.
+
+2006-10-07  Bruno Haible  <bruno@clisp.org>
 
 	* gl_sublist.h: New file.
 	* gl_sublist.c: New file.
--- a/lib/fprintftime.c
+++ b/lib/fprintftime.c
@@ -1,5 +1,2 @@
-#include <config.h>
-
-#include "fprintftime.h"
 #define FPRINTFTIME 1
 #include "strftime.c"
--- a/lib/fts-cycle.c
+++ b/lib/fts-cycle.c
@@ -18,8 +18,6 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#include <config.h>
-
 #include "cycle-check.h"
 #include "hash.h"
 
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -30,6 +30,9 @@
 # include "../locale/localeinfo.h"
 #else
 # include <config.h>
+# if FPRINTFTIME
+#  include "fprintftime.h"
+# endif
 #endif
 
 #include <ctype.h>
--- a/lib/xstrtoimax.c
+++ b/lib/xstrtoimax.c
@@ -1,32 +1,6 @@
-/* xstrtoimax.c -- A more useful interface to strtoimax.
-
-   Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Cloned by Jim Meyering. */
-
-#include <config.h>
-
-#include "xstrtol.h"
-
 #define __strtol strtoimax
 #define __strtol_t intmax_t
 #define __xstrtol xstrtoimax
-#ifdef INTMAX_MAX
-# define STRTOL_T_MINIMUM INTMAX_MIN
-# define STRTOL_T_MAXIMUM INTMAX_MAX
-#endif
+#define STRTOL_T_MINIMUM INTMAX_MIN
+#define STRTOL_T_MAXIMUM INTMAX_MAX
 #include "xstrtol.c"
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -19,10 +19,6 @@
 
 /* Written by Jim Meyering. */
 
-#include <config.h>
-
-#include "xstrtol.h"
-
 #ifndef __strtol
 # define __strtol strtol
 # define __strtol_t long int
@@ -31,6 +27,10 @@
 # define STRTOL_T_MAXIMUM LONG_MAX
 #endif
 
+#include <config.h>
+
+#include "xstrtol.h"
+
 /* Some pre-ANSI implementations (e.g. SunOS 4)
    need stderr defined if assertion checking is enabled.  */
 #include <stdio.h>
@@ -44,19 +44,6 @@
 
 #include "intprops.h"
 
-#ifndef STRTOL_T_MINIMUM
-# define STRTOL_T_MINIMUM TYPE_MINIMUM (__strtol_t)
-# define STRTOL_T_MAXIMUM TYPE_MAXIMUM (__strtol_t)
-#endif
-
-#if !HAVE_DECL_STRTOIMAX && !defined strtoimax
-intmax_t strtoimax ();
-#endif
-
-#if !HAVE_DECL_STRTOUMAX && !defined strtoumax
-uintmax_t strtoumax ();
-#endif
-
 static strtol_error
 bkm_scale (__strtol_t *x, int scale_factor)
 {
--- a/lib/xstrtoumax.c
+++ b/lib/xstrtoumax.c
@@ -1,32 +1,6 @@
-/* xstrtoumax.c -- A more useful interface to strtoumax.
-
-   Copyright (C) 1999, 2003, 2004, 2006 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Paul Eggert. */
-
-#include <config.h>
-
-#include "xstrtol.h"
-
 #define __strtol strtoumax
 #define __strtol_t uintmax_t
 #define __xstrtol xstrtoumax
-#ifdef UINTMAX_MAX
-# define STRTOL_T_MINIMUM 0
-# define STRTOL_T_MAXIMUM UINTMAX_MAX
-#endif
+#define STRTOL_T_MINIMUM 0
+#define STRTOL_T_MAXIMUM UINTMAX_MAX
 #include "xstrtol.c"