Remove HAVE_LIMITS_H

The `<limits.h>` header file is part of the standard C89 headers [1]
and on current systems can be included unconditionally.

Since PHP requires at least C89 or greater, the `HAVE_LIMITS_H` symbol
defined by Autoconf in configure.ac [2] can be ommitted and simplifed
however due to bundled file library (libmagic) and timelib still using
it, the removal there was omitted and done only in Zend.m4 file.

Current bundled libraries libtime, oniguruma, and libmagic still include
partial `HAVE_LIMITS_H` usage and will be more refactored when this is
possible.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
This commit is contained in:
Peter Kokot 2019-04-07 15:20:02 +02:00
parent afd52f9d99
commit fd1ad1e25a
8 changed files with 2 additions and 21 deletions

View file

@ -35,9 +35,7 @@ char *alloca ();
#include <unistd.h> #include <unistd.h>
#endif #endif
#if HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#endif
#ifndef MAXPATHLEN #ifndef MAXPATHLEN
# if _WIN32 # if _WIN32

View file

@ -8,7 +8,6 @@ AC_REQUIRE([AC_PROG_CC])
AC_CHECK_HEADERS( AC_CHECK_HEADERS(
inttypes.h \ inttypes.h \
stdint.h \ stdint.h \
limits.h \
malloc.h \ malloc.h \
unistd.h \ unistd.h \
sys/types.h \ sys/types.h \

View file

@ -77,9 +77,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#if HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>

View file

@ -60,9 +60,7 @@
# include <dlfcn.h> # include <dlfcn.h>
#endif #endif
#ifdef HAVE_LIMITS_H #include <limits.h>
# include <limits.h>
#endif
#if HAVE_ALLOCA_H && !defined(_ALLOCA_H) #if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
# include <alloca.h> # include <alloca.h>

View file

@ -49,9 +49,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#endif
#ifdef PHP_WIN32 #ifdef PHP_WIN32
# include "win32/nice.h" # include "win32/nice.h"

View file

@ -90,12 +90,6 @@ void register_string_constants(INIT_FUNC_ARGS)
#ifdef HAVE_LOCALECONV #ifdef HAVE_LOCALECONV
/* If last members of struct lconv equal CHAR_MAX, no grouping is done */ /* If last members of struct lconv equal CHAR_MAX, no grouping is done */
/* This is bad, but since we are going to be hardcoding in the POSIX stuff anyway... */
# ifndef HAVE_LIMITS_H
# define CHAR_MAX 127
# endif
REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
#endif #endif

View file

@ -22,10 +22,8 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View file

@ -243,9 +243,7 @@ char *strerror(int);
# endif # endif
#endif #endif
#if HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#endif
#ifndef LONG_MAX #ifndef LONG_MAX
#define LONG_MAX 2147483647L #define LONG_MAX 2147483647L