diff options
| author | Paul Eggert | 2011-07-06 18:32:56 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-06 18:32:56 -0700 |
| commit | 0e926e561c259468174b16407dd7271c2c8fe904 (patch) | |
| tree | 6a226d2950e17e8e117874c6714fd054600ffba6 /src | |
| parent | 59361254a6ea5fcfc2f1ec344665aa719fbb936f (diff) | |
| download | emacs-0e926e561c259468174b16407dd7271c2c8fe904.tar.gz emacs-0e926e561c259468174b16407dd7271c2c8fe904.zip | |
Assume freestanding C89 headers, string.h, stdlib.h.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/data.c | 3 | ||||
| -rw-r--r-- | src/doprnt.c | 5 | ||||
| -rw-r--r-- | src/floatfns.c | 3 | ||||
| -rw-r--r-- | src/gmalloc.c | 56 | ||||
| -rw-r--r-- | src/print.c | 3 | ||||
| -rw-r--r-- | src/regex.c | 56 | ||||
| -rw-r--r-- | src/s/aix4-2.h | 5 | ||||
| -rw-r--r-- | src/s/ms-w32.h | 5 | ||||
| -rw-r--r-- | src/sysdep.c | 2 |
10 files changed, 35 insertions, 117 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b0fb0f213ab..d91837877e1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2011-07-07 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume freestanding C89 headers, string.h, stdlib.h. | ||
| 4 | * data.c, doprnt.c, floatfns.c, print.c: | ||
| 5 | Include float.h unconditionally. | ||
| 6 | * gmalloc.c: Assume C89-at-least behavior for preprocessor, | ||
| 7 | limits.h, stddef.h, string.h. Use memset instead of 'flood'. | ||
| 8 | * regex.c: Likewise for stddef.h, string.h. | ||
| 9 | (ISASCII): Remove; can assume it returns 1 now. All uses removed. | ||
| 10 | * s/aix4-2.h (HAVE_STRING_H): Remove obsolete undef. | ||
| 11 | * s/ms-w32.h (HAVE_LIMITS_H, HAVE_STRING_H, HAVE_STDLIB_H) | ||
| 12 | (STDC_HEADERS): Remove obsolete defines. | ||
| 13 | * sysdep.c: Include limits.h unconditionally. | ||
| 14 | |||
| 1 | 2011-07-06 Paul Eggert <eggert@cs.ucla.edu> | 15 | 2011-07-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 16 | ||
| 3 | Assume support for memcmp, memcpy, memmove, memset. | 17 | Assume support for memcmp, memcpy, memmove, memset. |
diff --git a/src/data.c b/src/data.c index 6b4ea32ac9e..eb3f870b97c 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -35,10 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | #include "termhooks.h" /* For FRAME_KBOARD reference in y-or-n-p. */ | 35 | #include "termhooks.h" /* For FRAME_KBOARD reference in y-or-n-p. */ |
| 36 | #include "font.h" | 36 | #include "font.h" |
| 37 | 37 | ||
| 38 | #ifdef STDC_HEADERS | ||
| 39 | #include <float.h> | 38 | #include <float.h> |
| 40 | #endif | ||
| 41 | |||
| 42 | /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ | 39 | /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ |
| 43 | #ifndef IEEE_FLOATING_POINT | 40 | #ifndef IEEE_FLOATING_POINT |
| 44 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ | 41 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ |
diff --git a/src/doprnt.c b/src/doprnt.c index 195598c07ea..0632046525a 100644 --- a/src/doprnt.c +++ b/src/doprnt.c | |||
| @@ -102,13 +102,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 102 | #include <stdio.h> | 102 | #include <stdio.h> |
| 103 | #include <ctype.h> | 103 | #include <ctype.h> |
| 104 | #include <setjmp.h> | 104 | #include <setjmp.h> |
| 105 | |||
| 106 | #ifdef STDC_HEADERS | ||
| 107 | #include <float.h> | 105 | #include <float.h> |
| 108 | #endif | ||
| 109 | |||
| 110 | #include <unistd.h> | 106 | #include <unistd.h> |
| 111 | |||
| 112 | #include <limits.h> | 107 | #include <limits.h> |
| 113 | 108 | ||
| 114 | #include "lisp.h" | 109 | #include "lisp.h" |
diff --git a/src/floatfns.c b/src/floatfns.c index b5c8b4af5c3..850eb9f1bcc 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -53,10 +53,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 53 | #include "lisp.h" | 53 | #include "lisp.h" |
| 54 | #include "syssignal.h" | 54 | #include "syssignal.h" |
| 55 | 55 | ||
| 56 | #if STDC_HEADERS | ||
| 57 | #include <float.h> | 56 | #include <float.h> |
| 58 | #endif | ||
| 59 | |||
| 60 | /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ | 57 | /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ |
| 61 | #ifndef IEEE_FLOATING_POINT | 58 | #ifndef IEEE_FLOATING_POINT |
| 62 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ | 59 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ |
diff --git a/src/gmalloc.c b/src/gmalloc.c index 4f27ea3079a..fa4aa1fdf6a 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c | |||
| @@ -41,28 +41,13 @@ Fifth Floor, Boston, MA 02110-1301, USA. | |||
| 41 | #define USE_PTHREAD | 41 | #define USE_PTHREAD |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | #if ((defined __cplusplus || (defined (__STDC__) && __STDC__) \ | ||
| 45 | || defined STDC_HEADERS || defined PROTOTYPES)) | ||
| 46 | #undef PP | 44 | #undef PP |
| 47 | #define PP(args) args | 45 | #define PP(args) args |
| 48 | #undef __ptr_t | 46 | #undef __ptr_t |
| 49 | #define __ptr_t void * | 47 | #define __ptr_t void * |
| 50 | #else /* Not C++ or ANSI C. */ | ||
| 51 | #undef PP | ||
| 52 | #define PP(args) () | ||
| 53 | #undef __ptr_t | ||
| 54 | #define __ptr_t char * | ||
| 55 | #endif /* C++ or ANSI C. */ | ||
| 56 | 48 | ||
| 57 | #include <string.h> | 49 | #include <string.h> |
| 58 | |||
| 59 | #ifdef HAVE_LIMITS_H | ||
| 60 | #include <limits.h> | 50 | #include <limits.h> |
| 61 | #endif | ||
| 62 | #ifndef CHAR_BIT | ||
| 63 | #define CHAR_BIT 8 | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <unistd.h> | 51 | #include <unistd.h> |
| 67 | 52 | ||
| 68 | #ifdef USE_PTHREAD | 53 | #ifdef USE_PTHREAD |
| @@ -77,26 +62,9 @@ extern "C" | |||
| 77 | { | 62 | { |
| 78 | #endif | 63 | #endif |
| 79 | 64 | ||
| 80 | #ifdef STDC_HEADERS | ||
| 81 | #include <stddef.h> | 65 | #include <stddef.h> |
| 82 | #define __malloc_size_t size_t | 66 | #define __malloc_size_t size_t |
| 83 | #define __malloc_ptrdiff_t ptrdiff_t | 67 | #define __malloc_ptrdiff_t ptrdiff_t |
| 84 | #else | ||
| 85 | #ifdef __GNUC__ | ||
| 86 | #include <stddef.h> | ||
| 87 | #ifdef __SIZE_TYPE__ | ||
| 88 | #define __malloc_size_t __SIZE_TYPE__ | ||
| 89 | #endif | ||
| 90 | #endif | ||
| 91 | #ifndef __malloc_size_t | ||
| 92 | #define __malloc_size_t unsigned int | ||
| 93 | #endif | ||
| 94 | #define __malloc_ptrdiff_t int | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #ifndef NULL | ||
| 98 | #define NULL 0 | ||
| 99 | #endif | ||
| 100 | 68 | ||
| 101 | 69 | ||
| 102 | /* Allocate SIZE bytes of memory. */ | 70 | /* Allocate SIZE bytes of memory. */ |
| @@ -1881,22 +1849,6 @@ struct hdr | |||
| 1881 | unsigned long int magic; /* Magic number to check header integrity. */ | 1849 | unsigned long int magic; /* Magic number to check header integrity. */ |
| 1882 | }; | 1850 | }; |
| 1883 | 1851 | ||
| 1884 | #if defined(_LIBC) || defined(STDC_HEADERS) || defined(USG) | ||
| 1885 | #define flood memset | ||
| 1886 | #else | ||
| 1887 | static void flood (__ptr_t, int, __malloc_size_t); | ||
| 1888 | static void | ||
| 1889 | flood (ptr, val, size) | ||
| 1890 | __ptr_t ptr; | ||
| 1891 | int val; | ||
| 1892 | __malloc_size_t size; | ||
| 1893 | { | ||
| 1894 | char *cp = ptr; | ||
| 1895 | while (size--) | ||
| 1896 | *cp++ = val; | ||
| 1897 | } | ||
| 1898 | #endif | ||
| 1899 | |||
| 1900 | static enum mcheck_status checkhdr (const struct hdr *); | 1852 | static enum mcheck_status checkhdr (const struct hdr *); |
| 1901 | static enum mcheck_status | 1853 | static enum mcheck_status |
| 1902 | checkhdr (hdr) | 1854 | checkhdr (hdr) |
| @@ -1935,7 +1887,7 @@ freehook (ptr) | |||
| 1935 | hdr = ((struct hdr *) ptr) - 1; | 1887 | hdr = ((struct hdr *) ptr) - 1; |
| 1936 | checkhdr (hdr); | 1888 | checkhdr (hdr); |
| 1937 | hdr->magic = MAGICFREE; | 1889 | hdr->magic = MAGICFREE; |
| 1938 | flood (ptr, FREEFLOOD, hdr->size); | 1890 | memset (ptr, FREEFLOOD, hdr->size); |
| 1939 | } | 1891 | } |
| 1940 | else | 1892 | else |
| 1941 | hdr = NULL; | 1893 | hdr = NULL; |
| @@ -1961,7 +1913,7 @@ mallochook (size) | |||
| 1961 | hdr->size = size; | 1913 | hdr->size = size; |
| 1962 | hdr->magic = MAGICWORD; | 1914 | hdr->magic = MAGICWORD; |
| 1963 | ((char *) &hdr[1])[size] = MAGICBYTE; | 1915 | ((char *) &hdr[1])[size] = MAGICBYTE; |
| 1964 | flood ((__ptr_t) (hdr + 1), MALLOCFLOOD, size); | 1916 | memset ((__ptr_t) (hdr + 1), MALLOCFLOOD, size); |
| 1965 | return (__ptr_t) (hdr + 1); | 1917 | return (__ptr_t) (hdr + 1); |
| 1966 | } | 1918 | } |
| 1967 | 1919 | ||
| @@ -1981,7 +1933,7 @@ reallochook (ptr, size) | |||
| 1981 | 1933 | ||
| 1982 | checkhdr (hdr); | 1934 | checkhdr (hdr); |
| 1983 | if (size < osize) | 1935 | if (size < osize) |
| 1984 | flood ((char *) ptr + size, FREEFLOOD, osize - size); | 1936 | memset ((char *) ptr + size, FREEFLOOD, osize - size); |
| 1985 | } | 1937 | } |
| 1986 | 1938 | ||
| 1987 | __free_hook = old_free_hook; | 1939 | __free_hook = old_free_hook; |
| @@ -1998,7 +1950,7 @@ reallochook (ptr, size) | |||
| 1998 | hdr->magic = MAGICWORD; | 1950 | hdr->magic = MAGICWORD; |
| 1999 | ((char *) &hdr[1])[size] = MAGICBYTE; | 1951 | ((char *) &hdr[1])[size] = MAGICBYTE; |
| 2000 | if (size > osize) | 1952 | if (size > osize) |
| 2001 | flood ((char *) (hdr + 1) + osize, MALLOCFLOOD, size - osize); | 1953 | memset ((char *) (hdr + 1) + osize, MALLOCFLOOD, size - osize); |
| 2002 | return (__ptr_t) (hdr + 1); | 1954 | return (__ptr_t) (hdr + 1); |
| 2003 | } | 1955 | } |
| 2004 | 1956 | ||
diff --git a/src/print.c b/src/print.c index 14b4326bb6f..f1907a31465 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -46,10 +46,7 @@ static Lisp_Object Qtemp_buffer_setup_hook; | |||
| 46 | static Lisp_Object Qfloat_output_format; | 46 | static Lisp_Object Qfloat_output_format; |
| 47 | 47 | ||
| 48 | #include <math.h> | 48 | #include <math.h> |
| 49 | |||
| 50 | #if STDC_HEADERS | ||
| 51 | #include <float.h> | 49 | #include <float.h> |
| 52 | #endif | ||
| 53 | #include <ftoastr.h> | 50 | #include <ftoastr.h> |
| 54 | 51 | ||
| 55 | /* Default to values appropriate for IEEE floating point. */ | 52 | /* Default to values appropriate for IEEE floating point. */ |
diff --git a/src/regex.c b/src/regex.c index f514b603488..d347d274819 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -37,9 +37,9 @@ | |||
| 37 | # include <config.h> | 37 | # include <config.h> |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #if defined STDC_HEADERS && !defined emacs | 40 | #include <stddef.h> |
| 41 | # include <stddef.h> | 41 | |
| 42 | #else | 42 | #ifdef emacs |
| 43 | /* We need this for `regex.h', and perhaps for the Emacs include files. */ | 43 | /* We need this for `regex.h', and perhaps for the Emacs include files. */ |
| 44 | # include <sys/types.h> | 44 | # include <sys/types.h> |
| 45 | #endif | 45 | #endif |
| @@ -346,25 +346,6 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; | |||
| 346 | 346 | ||
| 347 | #else /* not emacs */ | 347 | #else /* not emacs */ |
| 348 | 348 | ||
| 349 | /* Jim Meyering writes: | ||
| 350 | |||
| 351 | "... Some ctype macros are valid only for character codes that | ||
| 352 | isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when | ||
| 353 | using /bin/cc or gcc but without giving an ansi option). So, all | ||
| 354 | ctype uses should be through macros like ISPRINT... If | ||
| 355 | STDC_HEADERS is defined, then autoconf has verified that the ctype | ||
| 356 | macros don't need to be guarded with references to isascii. ... | ||
| 357 | Defining isascii to 1 should let any compiler worth its salt | ||
| 358 | eliminate the && through constant folding." | ||
| 359 | Solaris defines some of these symbols so we must undefine them first. */ | ||
| 360 | |||
| 361 | # undef ISASCII | ||
| 362 | # if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) | ||
| 363 | # define ISASCII(c) 1 | ||
| 364 | # else | ||
| 365 | # define ISASCII(c) isascii(c) | ||
| 366 | # endif | ||
| 367 | |||
| 368 | /* 1 if C is an ASCII character. */ | 349 | /* 1 if C is an ASCII character. */ |
| 369 | # define IS_REAL_ASCII(c) ((c) < 0200) | 350 | # define IS_REAL_ASCII(c) ((c) < 0200) |
| 370 | 351 | ||
| @@ -372,27 +353,28 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; | |||
| 372 | # define ISUNIBYTE(c) 1 | 353 | # define ISUNIBYTE(c) 1 |
| 373 | 354 | ||
| 374 | # ifdef isblank | 355 | # ifdef isblank |
| 375 | # define ISBLANK(c) (ISASCII (c) && isblank (c)) | 356 | # define ISBLANK(c) isblank (c) |
| 376 | # else | 357 | # else |
| 377 | # define ISBLANK(c) ((c) == ' ' || (c) == '\t') | 358 | # define ISBLANK(c) ((c) == ' ' || (c) == '\t') |
| 378 | # endif | 359 | # endif |
| 379 | # ifdef isgraph | 360 | # ifdef isgraph |
| 380 | # define ISGRAPH(c) (ISASCII (c) && isgraph (c)) | 361 | # define ISGRAPH(c) isgraph (c) |
| 381 | # else | 362 | # else |
| 382 | # define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) | 363 | # define ISGRAPH(c) (isprint (c) && !isspace (c)) |
| 383 | # endif | 364 | # endif |
| 384 | 365 | ||
| 366 | /* Solaris defines ISPRINT so we must undefine it first. */ | ||
| 385 | # undef ISPRINT | 367 | # undef ISPRINT |
| 386 | # define ISPRINT(c) (ISASCII (c) && isprint (c)) | 368 | # define ISPRINT(c) isprint (c) |
| 387 | # define ISDIGIT(c) (ISASCII (c) && isdigit (c)) | 369 | # define ISDIGIT(c) isdigit (c) |
| 388 | # define ISALNUM(c) (ISASCII (c) && isalnum (c)) | 370 | # define ISALNUM(c) isalnum (c) |
| 389 | # define ISALPHA(c) (ISASCII (c) && isalpha (c)) | 371 | # define ISALPHA(c) isalpha (c) |
| 390 | # define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) | 372 | # define ISCNTRL(c) iscntrl (c) |
| 391 | # define ISLOWER(c) (ISASCII (c) && islower (c)) | 373 | # define ISLOWER(c) islower (c) |
| 392 | # define ISPUNCT(c) (ISASCII (c) && ispunct (c)) | 374 | # define ISPUNCT(c) ispunct (c) |
| 393 | # define ISSPACE(c) (ISASCII (c) && isspace (c)) | 375 | # define ISSPACE(c) isspace (c) |
| 394 | # define ISUPPER(c) (ISASCII (c) && isupper (c)) | 376 | # define ISUPPER(c) isupper (c) |
| 395 | # define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) | 377 | # define ISXDIGIT(c) isxdigit (c) |
| 396 | 378 | ||
| 397 | # define ISWORD(c) ISALPHA(c) | 379 | # define ISWORD(c) ISALPHA(c) |
| 398 | 380 | ||
| @@ -439,10 +421,6 @@ init_syntax_once (void) | |||
| 439 | 421 | ||
| 440 | #endif /* not emacs */ | 422 | #endif /* not emacs */ |
| 441 | 423 | ||
| 442 | #ifndef NULL | ||
| 443 | # define NULL (void *)0 | ||
| 444 | #endif | ||
| 445 | |||
| 446 | /* We remove any previous definition of `SIGN_EXTEND_CHAR', | 424 | /* We remove any previous definition of `SIGN_EXTEND_CHAR', |
| 447 | since ours (we hope) works properly with all combinations of | 425 | since ours (we hope) works properly with all combinations of |
| 448 | machines, compilers, `char' and `unsigned char' argument types. | 426 | machines, compilers, `char' and `unsigned char' argument types. |
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h index c2715fffe01..b44bd0308a3 100644 --- a/src/s/aix4-2.h +++ b/src/s/aix4-2.h | |||
| @@ -47,11 +47,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 47 | /* AIX doesn't define this. */ | 47 | /* AIX doesn't define this. */ |
| 48 | #define unix 1 | 48 | #define unix 1 |
| 49 | 49 | ||
| 50 | /* string.h defines rindex as a macro, at least with native cc, so we | ||
| 51 | lose declaring char * rindex without this. | ||
| 52 | It is just a guess which versions of AIX need this definition. */ | ||
| 53 | #undef HAVE_STRING_H | ||
| 54 | |||
| 55 | /* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct. */ | 50 | /* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct. */ |
| 56 | #define SIGNALS_VIA_CHARACTERS | 51 | #define SIGNALS_VIA_CHARACTERS |
| 57 | #define CLASH_DETECTION | 52 | #define CLASH_DETECTION |
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h index bf6cc66798c..813c3cef115 100644 --- a/src/s/ms-w32.h +++ b/src/s/ms-w32.h | |||
| @@ -111,11 +111,7 @@ struct sigaction { | |||
| 111 | #undef HAVE_UTIME_H | 111 | #undef HAVE_UTIME_H |
| 112 | #undef HAVE_LINUX_VERSION_H | 112 | #undef HAVE_LINUX_VERSION_H |
| 113 | #undef HAVE_SYS_SYSTEMINFO_H | 113 | #undef HAVE_SYS_SYSTEMINFO_H |
| 114 | #define HAVE_LIMITS_H 1 | ||
| 115 | #define HAVE_STRING_H 1 | ||
| 116 | #define HAVE_STDLIB_H 1 | ||
| 117 | #define HAVE_PWD_H 1 | 114 | #define HAVE_PWD_H 1 |
| 118 | #define STDC_HEADERS 1 | ||
| 119 | #define TIME_WITH_SYS_TIME 1 | 115 | #define TIME_WITH_SYS_TIME 1 |
| 120 | 116 | ||
| 121 | #define HAVE_GETTIMEOFDAY 1 | 117 | #define HAVE_GETTIMEOFDAY 1 |
| @@ -386,4 +382,3 @@ extern void _DebPrint (const char *fmt, ...); | |||
| 386 | 382 | ||
| 387 | 383 | ||
| 388 | /* ============================================================ */ | 384 | /* ============================================================ */ |
| 389 | |||
diff --git a/src/sysdep.c b/src/sysdep.c index f157baf3e76..155d577ebfa 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -26,9 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include <pwd.h> | 26 | #include <pwd.h> |
| 27 | #include <grp.h> | 27 | #include <grp.h> |
| 28 | #endif /* HAVE_PWD_H */ | 28 | #endif /* HAVE_PWD_H */ |
| 29 | #ifdef HAVE_LIMITS_H | ||
| 30 | #include <limits.h> | 29 | #include <limits.h> |
| 31 | #endif /* HAVE_LIMITS_H */ | ||
| 32 | #include <unistd.h> | 30 | #include <unistd.h> |
| 33 | 31 | ||
| 34 | #include <allocator.h> | 32 | #include <allocator.h> |