[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] inttypes.h and stdint.h
From: |
Bruno Haible |
Subject: |
[Bug-gnulib] inttypes.h and stdint.h |
Date: |
Tue, 31 Dec 2002 14:33:01 +0100 (CET) |
Hi,
I propose to add this patch. There is confusion about the required headers
for uintmax_t and intmax_t. Since
1) autoconf uses the pattern
# if HAVE_INTTYPES_H
# include <inttypes.h>
# else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
# endif
in its default declarations,
2) fsusage.c uses the same pattern, without apparent problems,
3) it does probably not harm to #include these headers even if they
don't define uintmax_t,
4) it is likely that some system will come along with <stdint.h> but
no <inttypes.h> (isn't this the purpose of the prefix "std", after
all?)
let's try this. OK?
2002-12-25 Bruno Haible <address@hidden>
* strtoimax.c: Include <stdint.h> as an alternative to <inttypes.h>.
* xstrtol.h: Likewise.
* xstrtoimax.c: Likewise.
* xstrtoumax.c: Likewise.
* human.h: Likewise.
* tempname.c: Include <inttypes.h> too. Avoids a compilation error
on systems that have <inttypes.h> but not <stdint.h>.
diff -r -c3 gnulib-cvs/lib/strtoimax.c gnulib/lib/strtoimax.c
*** gnulib-cvs/lib/strtoimax.c 2001-09-17 12:24:20.000000000 +0200
--- gnulib/lib/strtoimax.c 2002-12-25 10:53:44.000000000 +0100
***************
*** 1,5 ****
/* Convert string representation of a number into an intmax_t value.
! Copyright 1999, 2001 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
--- 1,5 ----
/* Convert string representation of a number into an intmax_t value.
! Copyright 1999, 2001, 2002 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
***************
*** 23,28 ****
--- 23,32 ----
#if HAVE_INTTYPES_H
# include <inttypes.h>
+ #else
+ # if HAVE_STDINT_H
+ # include <stdint.h>
+ # endif
#endif
#if HAVE_STDLIB_H
diff -r -c3 gnulib-cvs/lib/xstrtol.h gnulib/lib/xstrtol.h
*** gnulib-cvs/lib/xstrtol.h 2001-08-31 10:15:10.000000000 +0200
--- gnulib/lib/xstrtol.h 2002-12-25 10:57:25.000000000 +0100
***************
*** 1,5 ****
/* A more useful interface to strtol.
! Copyright 1995, 1996, 1998, 1999, 2001 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
--- 1,5 ----
/* A more useful interface to strtol.
! Copyright 1995, 1996, 1998, 1999, 2001, 2002 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
***************
*** 18,25 ****
#ifndef XSTRTOL_H_
# define XSTRTOL_H_ 1
# if HAVE_INTTYPES_H
! # include <inttypes.h> /* for uintmax_t */
# endif
# ifndef PARAMS
--- 18,30 ----
#ifndef XSTRTOL_H_
# define XSTRTOL_H_ 1
+ /* Get uintmax_t. */
# if HAVE_INTTYPES_H
! # include <inttypes.h>
! # else
! # if HAVE_STDINT_H
! # include <stdint.h>
! # endif
# endif
# ifndef PARAMS
diff -r -c3 gnulib-cvs/lib/xstrtoimax.c gnulib/lib/xstrtoimax.c
*** gnulib-cvs/lib/xstrtoimax.c 2001-08-26 09:03:07.000000000 +0200
--- gnulib/lib/xstrtoimax.c 2002-12-25 10:58:01.000000000 +0100
***************
*** 1,5 ****
/* xstrtoimax.c -- A more useful interface to strtoimax.
! Copyright 2001 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
--- 1,5 ----
/* xstrtoimax.c -- A more useful interface to strtoimax.
! Copyright 2001-2002 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
***************
*** 23,28 ****
--- 23,32 ----
#if HAVE_INTTYPES_H
# include <inttypes.h>
+ #else
+ # if HAVE_STDINT_H
+ # include <stdint.h>
+ # endif
#endif
#define __strtol strtoimax
diff -r -c3 gnulib-cvs/lib/xstrtoumax.c gnulib/lib/xstrtoumax.c
*** gnulib-cvs/lib/xstrtoumax.c 2000-08-07 17:48:19.000000000 +0200
--- gnulib/lib/xstrtoumax.c 2002-12-25 10:57:59.000000000 +0100
***************
*** 1,5 ****
/* xstrtoumax.c -- A more useful interface to strtoumax.
! Copyright 1999 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
--- 1,5 ----
/* xstrtoumax.c -- A more useful interface to strtoumax.
! Copyright 1999, 2002 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
***************
*** 23,28 ****
--- 23,32 ----
#if HAVE_INTTYPES_H
# include <inttypes.h>
+ #else
+ # if HAVE_STDINT_H
+ # include <stdint.h>
+ # endif
#endif
#define __strtol strtoumax
diff -r -c3 gnulib-cvs/lib/human.h gnulib/lib/human.h
*** gnulib-cvs/lib/human.h 1999-07-04 10:47:49.000000000 +0200
--- gnulib/lib/human.h 2002-12-25 10:53:01.000000000 +0100
***************
*** 7,12 ****
--- 7,16 ----
# if HAVE_INTTYPES_H
# include <inttypes.h>
+ # else
+ # if HAVE_STDINT_H
+ # include <stdint.h>
+ # endif
# endif
/* A conservative bound on the maximum length of a human-readable string.
diff -r -c3 gnulib-cvs/lib/tempname.c gnulib/lib/tempname.c
*** gnulib-cvs/lib/tempname.c 2002-11-25 14:09:14.000000000 +0100
--- gnulib/lib/tempname.c 2002-12-25 10:54:41.000000000 +0100
***************
*** 61,66 ****
--- 61,69 ----
#if HAVE_STDINT_H || _LIBC
# include <stdint.h>
#endif
+ #if HAVE_INTTYPES_H
+ # include <inttypes.h>
+ #endif
#if HAVE_UNISTD_H || _LIBC
# include <unistd.h>
- [Bug-gnulib] inttypes.h and stdint.h,
Bruno Haible <=