Update integer limits code.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29661 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-02-18 07:06:42 +00:00
parent 7cd2a7551b
commit 746afbcb53
7 changed files with 35 additions and 240 deletions

View file

@ -1,3 +1,14 @@
2010-02-18 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: remove obsolete checks for integer limits constants
* Headers/Additions/GNUstepBase/config.h.in: regenerate
* configure: regenerate
* Source/NSScanner.m:
* Source/NSNumber.m:
* Source/GSFormat.m:
New code to define LLONG_MAX,LLONG_MIN,ULLONG_MAX in terms of
__LONG_LONG_MAX__ where they are not found in the normal location.
2010-02-16 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Additions/GNUstepBase/GSXML.h:

View file

@ -9,12 +9,6 @@
/* Define if constructors are automatically loaded */
#undef CON_AUTOLOAD
/* Define if this constant is defined */
#undef HANDLE_LLONG_MAX
/* Define if this constant is defined */
#undef HANDLE_LONG_LONG_MAX
/* Define to 1 if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H

View file

@ -40,28 +40,21 @@
#include "config.h"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#if defined(HAVE_STDINT_H)
#include <stdint.h>
#endif
#if defined(HAVE_LIMITS_H)
#include <limits.h>
#endif
#if !defined(HANDLE_LLONG_MAX) && defined(HANDLE_LONG_LONG_MAX)
#define LLONG_MAX LONG_LONG_MAX
#define LLONG_MIN LONG_LONG_MIN
#define ULLONG_MAX ULONG_LONG_MAX
#endif
#if defined(HANDLE_LLONG_MAX) && !defined(LLONG_MAX)
#error handle_llong_max defined without llong_max being defined
#elif defined(HANDLE_LONG_LONG_MAX) && !defined(LONG_LONG_MAX)
#error handle_long_long_max defined without long_long_max being defined
#if !defined(LLONG_MAX)
# if defined(__LONG_LONG_MAX__)
# define LLONG_MAX __LONG_LONG_MAX__
# define LLONG_MIN (-LLONG_MAX-1)
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
# else
# error Neither LLONG_MAX nor __LONG_LONG_MAX__ found
# endif
#endif
#ifdef HAVE_ALLOCA_H

View file

@ -29,28 +29,21 @@
#import "config.h"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#if defined(HAVE_STDINT_H)
#include <stdint.h>
#endif
#if defined(HAVE_LIMITS_H)
#include <limits.h>
#endif
#if !defined(HANDLE_LLONG_MAX) && defined(HANDLE_LONG_LONG_MAX)
#define LLONG_MAX LONG_LONG_MAX
#define LLONG_MIN LONG_LONG_MIN
#define ULLONG_MAX ULONG_LONG_MAX
#endif
#if defined(HANDLE_LLONG_MAX) && !defined(LLONG_MAX)
#error handle_llong_max defined without llong_max being defined
#elif defined(HANDLE_LONG_LONG_MAX) && !defined(LONG_LONG_MAX)
#error handle_long_long_max defined without long_long_max being defined
#if !defined(LLONG_MAX)
# if defined(__LONG_LONG_MAX__)
# define LLONG_MAX __LONG_LONG_MAX__
# define LLONG_MIN (-LLONG_MAX-1)
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
# else
# error Neither LLONG_MAX nor __LONG_LONG_MAX__ found
# endif
#endif

View file

@ -29,32 +29,24 @@
#import "config.h"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#if defined(HAVE_STDINT_H)
#include <stdint.h>
#endif
#if defined(HAVE_LIMITS_H)
#include <limits.h>
#endif
#if defined(HAVE_FLOAT_H)
#include <float.h>
#endif
#if !defined(HANDLE_LLONG_MAX) && defined(HANDLE_LONG_LONG_MAX)
#define LLONG_MAX LONG_LONG_MAX
#define LLONG_MIN LONG_LONG_MIN
#define ULLONG_MAX ULONG_LONG_MAX
#endif
#if defined(HANDLE_LLONG_MAX) && !defined(LLONG_MAX)
#error handle_llong_max defined without llong_max being defined
#elif defined(HANDLE_LONG_LONG_MAX) && !defined(LONG_LONG_MAX)
#error handle_long_long_max defined without long_long_max being defined
#if !defined(LLONG_MAX)
# if defined(__LONG_LONG_MAX__)
# define LLONG_MAX __LONG_LONG_MAX__
# define LLONG_MIN (-LLONG_MAX-1)
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
# else
# error Neither LLONG_MAX nor __LONG_LONG_MAX__ found
# endif
#endif
#include <math.h>

133
configure vendored
View file

@ -16242,139 +16242,6 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking whether precompiler handles LONG_LONG_MAX" >&5
echo $ECHO_N "checking whether precompiler handles LONG_LONG_MAX... $ECHO_C" >&6
# We need to define _GNU_SOURCE for some systems to enable LONG_LONG_MAX
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <limits.h>
#if defined(LONG_LONG_MAX)
#if LONG_MAX == LONG_LONG_MAX
#error long max equals long long max
#endif
#else
#error long long max not defined
#endif
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
llmax=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
llmax=no
fi
rm -f conftest.err conftest.$ac_ext
if test $llmax = yes; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define HANDLE_LONG_LONG_MAX 1
_ACEOF
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
#
# Solaris and *BSD use LLONG_MAX instead
#
echo "$as_me:$LINENO: checking whether we have LLONG_MAX" >&5
echo $ECHO_N "checking whether we have LLONG_MAX... $ECHO_C" >&6
# We need to use the same header environment as the test above because we
# will be using one or the other set of constants.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <limits.h>
#if defined(LLONG_MAX)
#if LONG_MAX == LLONG_MAX
#error long max equals long long max
#endif
#else
#error llong max not defined
#endif
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
llmax=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
llmax=no
fi
rm -f conftest.err conftest.$ac_ext
if test $llmax = yes; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define HANDLE_LLONG_MAX 1
_ACEOF
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
for ac_header in wchar.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`

View file

@ -1055,61 +1055,6 @@ AC_CHECK_FUNCS(sigsetjmp)
# This type needed by GSFormat
#--------------------------------------------------------------------
AC_CHECK_TYPES([uintmax_t])
AC_MSG_CHECKING([whether precompiler handles LONG_LONG_MAX])
# We need to define _GNU_SOURCE for some systems to enable LONG_LONG_MAX
AC_TRY_CPP([#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <limits.h>
#if defined(LONG_LONG_MAX)
#if LONG_MAX == LONG_LONG_MAX
#error long max equals long long max
#endif
#else
#error long long max not defined
#endif
], llmax=yes, llmax=no)
if test $llmax = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(HANDLE_LONG_LONG_MAX,1,
[Define if this constant is defined])
else
AC_MSG_RESULT(no)
fi
#
# Solaris and *BSD use LLONG_MAX instead
#
AC_MSG_CHECKING([whether we have LLONG_MAX])
# We need to use the same header environment as the test above because we
# will be using one or the other set of constants.
AC_TRY_CPP([#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <limits.h>
#if defined(LLONG_MAX)
#if LONG_MAX == LLONG_MAX
#error long max equals long long max
#endif
#else
#error llong max not defined
#endif
], llmax=yes, llmax=no)
if test $llmax = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(HANDLE_LLONG_MAX,1,
[Define if this constant is defined])
else
AC_MSG_RESULT(no)
fi
AC_CHECK_HEADERS(wchar.h)
#--------------------------------------------------------------------