diff options
| author | Paul Eggert | 2014-05-17 01:11:31 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-05-17 01:11:31 -0700 |
| commit | 8208d2bf95f924ed810dc06e84fc4c7d5ac004a5 (patch) | |
| tree | b66944645e971c516adfef8f8bc74517bda8dfa1 | |
| parent | f63fc858c3d4a7d91ccac850025e407cc57b77fc (diff) | |
| download | emacs-8208d2bf95f924ed810dc06e84fc4c7d5ac004a5.tar.gz emacs-8208d2bf95f924ed810dc06e84fc4c7d5ac004a5.zip | |
Assume C99 or later.
* lib/stdarg.in.h, lib/stdbool.in.h, m4/stdarg.m4, m4/stdbool.m4:
Remove.
* configure.ac (_AC_PROG_CC_C89): Define a dummy, to keep 'configure'
smaller.
(gl_PROG_CC_C99): Use this to get C99 or later.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Remove stdarg, stdbool.
(GNULIB_TOOL_FLAGS): Avoid stdarg, stdbool.
* doc/lispref/internals.texi (C Dialect): Document this.
* etc/NEWS: Document this.
* nt/gnulib.mk: Remove stdarg and stdbool modules.
* src/bytecode.c (B__dummy__): Remove.
* src/conf_post.h (bool_bf) [!NS_IMPL_GNUSTEP]: Use bool.
(FLEXIBLE_ARRAY_MEMBER): Now always empty.
* src/dbusbind.c (XD_DEBUG_MESSAGE) [!DBUS_DEBUG]:
* src/regex.c (DEBUG_PRINT): Assume varargs macros.
* src/lisp.h (DEFUN_FUNCTION_INIT): Remove. All uses now assume C99.
Fixes: debbugs:17487
| -rw-r--r-- | ChangeLog | 10 | ||||
| -rw-r--r-- | admin/ChangeLog | 6 | ||||
| -rwxr-xr-x | admin/merge-gnulib | 3 | ||||
| -rw-r--r-- | configure.ac | 8 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/internals.texi | 13 | ||||
| -rw-r--r-- | etc/ChangeLog | 4 | ||||
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lib/gnulib.mk | 53 | ||||
| -rw-r--r-- | lib/stdarg.in.h | 35 | ||||
| -rw-r--r-- | lib/stdbool.in.h | 132 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 13 | ||||
| -rw-r--r-- | m4/stdarg.m4 | 78 | ||||
| -rw-r--r-- | m4/stdbool.m4 | 100 | ||||
| -rw-r--r-- | nt/ChangeLog | 5 | ||||
| -rw-r--r-- | nt/gnulib.mk | 51 | ||||
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/bytecode.c | 2 | ||||
| -rw-r--r-- | src/conf_post.h | 20 | ||||
| -rw-r--r-- | src/dbusbind.c | 6 | ||||
| -rw-r--r-- | src/emacs.c | 2 | ||||
| -rw-r--r-- | src/lisp.h | 7 | ||||
| -rw-r--r-- | src/regex.c | 7 |
23 files changed, 71 insertions, 501 deletions
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume C99 or later (Bug#17487). | ||
| 4 | * lib/stdarg.in.h, lib/stdbool.in.h, m4/stdarg.m4, m4/stdbool.m4: | ||
| 5 | Remove. | ||
| 6 | * configure.ac (_AC_PROG_CC_C89): Define a dummy, to keep 'configure' | ||
| 7 | smaller. | ||
| 8 | (gl_PROG_CC_C99): Use this to get C99 or later. | ||
| 9 | * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. | ||
| 10 | |||
| 1 | 2014-05-16 Paul Eggert <eggert@cs.ucla.edu> | 11 | 2014-05-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 12 | ||
| 3 | Don't require pkg-config when building from repository. | 13 | Don't require pkg-config when building from repository. |
diff --git a/admin/ChangeLog b/admin/ChangeLog index 0981e0eaf10..3d8b21ff144 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume C99 or later (Bug#17487). | ||
| 4 | * merge-gnulib (GNULIB_MODULES): Remove stdarg, stdbool. | ||
| 5 | (GNULIB_TOOL_FLAGS): Avoid stdarg, stdbool. | ||
| 6 | |||
| 1 | 2014-05-16 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2014-05-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | Don't require pkg-config when building from repository. | 9 | Don't require pkg-config when building from repository. |
diff --git a/admin/merge-gnulib b/admin/merge-gnulib index b93d12fbd20..5df2020f3aa 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib | |||
| @@ -35,7 +35,7 @@ GNULIB_MODULES=' | |||
| 35 | intprops largefile lstat | 35 | intprops largefile lstat |
| 36 | manywarnings memrchr mkostemp mktime | 36 | manywarnings memrchr mkostemp mktime |
| 37 | pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat | 37 | pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat |
| 38 | sig2str socklen stat-time stdalign stdarg stdbool stdio | 38 | sig2str socklen stat-time stdalign stdio |
| 39 | strftime strtoimax strtoumax symlink sys_stat | 39 | strftime strtoimax strtoumax symlink sys_stat |
| 40 | sys_time time timer-time timespec-add timespec-sub | 40 | sys_time time timer-time timespec-add timespec-sub |
| 41 | unsetenv update-copyright utimens | 41 | unsetenv update-copyright utimens |
| @@ -49,6 +49,7 @@ GNULIB_TOOL_FLAGS=' | |||
| 49 | --avoid=open --avoid=openat-die --avoid=opendir | 49 | --avoid=open --avoid=openat-die --avoid=opendir |
| 50 | --avoid=raise | 50 | --avoid=raise |
| 51 | --avoid=save-cwd --avoid=select --avoid=sigprocmask | 51 | --avoid=save-cwd --avoid=select --avoid=sigprocmask |
| 52 | --avoid=stdarg --avoid=stdbool | ||
| 52 | --avoid=threadlib | 53 | --avoid=threadlib |
| 53 | --conditional-dependencies --import --no-changelog --no-vc-files | 54 | --conditional-dependencies --import --no-changelog --no-vc-files |
| 54 | --makefile-name=gnulib.mk | 55 | --makefile-name=gnulib.mk |
diff --git a/configure.ac b/configure.ac index 55e5b8c0b5f..0119685394b 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -670,6 +670,9 @@ fi | |||
| 670 | 670 | ||
| 671 | #### Choose a compiler. | 671 | #### Choose a compiler. |
| 672 | 672 | ||
| 673 | dnl Don't bother to test for C89. | ||
| 674 | AC_DEFUN([_AC_PROG_CC_C89], [$2]) | ||
| 675 | |||
| 673 | dnl Sets GCC=yes if using gcc. | 676 | dnl Sets GCC=yes if using gcc. |
| 674 | AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"]) | 677 | AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"]) |
| 675 | if test -n "$XCRUN"; then | 678 | if test -n "$XCRUN"; then |
| @@ -677,6 +680,9 @@ if test -n "$XCRUN"; then | |||
| 677 | test -n "$AR" && export AR | 680 | test -n "$AR" && export AR |
| 678 | fi | 681 | fi |
| 679 | 682 | ||
| 683 | dnl Emacs needs C99 or later. | ||
| 684 | gl_PROG_CC_C99 | ||
| 685 | |||
| 680 | AM_PROG_CC_C_O | 686 | AM_PROG_CC_C_O |
| 681 | 687 | ||
| 682 | if test x$GCC = xyes; then | 688 | if test x$GCC = xyes; then |
| @@ -1303,7 +1309,7 @@ else | |||
| 1303 | CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS" | 1309 | CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS" |
| 1304 | fi | 1310 | fi |
| 1305 | 1311 | ||
| 1306 | # Suppress obsolescent Autoconf test for size_t; Emacs assumes C89 or better. | 1312 | # Suppress obsolescent Autoconf test for size_t; Emacs assumes C99 or better. |
| 1307 | AC_DEFUN([AC_TYPE_SIZE_T]) | 1313 | AC_DEFUN([AC_TYPE_SIZE_T]) |
| 1308 | # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them. | 1314 | # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them. |
| 1309 | AC_DEFUN([AC_TYPE_UID_T]) | 1315 | AC_DEFUN([AC_TYPE_UID_T]) |
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 7d85e4059c9..d892e1307a0 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume C99 or later (Bug#17487). | ||
| 4 | * internals.texi (C Dialect): Document this. | ||
| 5 | |||
| 1 | 2014-05-15 Dmitry Antipov <dmantipov@yandex.ru> | 6 | 2014-05-15 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 7 | ||
| 3 | * lists.texi (Building Cons Cells and Lists): Remove | 8 | * lists.texi (Building Cons Cells and Lists): Remove |
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index bfc9d491c5e..3a5bd4aea7e 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi | |||
| @@ -580,15 +580,14 @@ Emacs session. | |||
| 580 | @section C Dialect | 580 | @section C Dialect |
| 581 | @cindex C programming language | 581 | @cindex C programming language |
| 582 | 582 | ||
| 583 | The C part of Emacs is portable to C89: C99-specific features such as | 583 | The C part of Emacs is portable to C99 or later: C11-specific features such |
| 584 | @samp{<stdbool.h>} and @samp{inline} are not used without a check, | 584 | as @samp{<stdalign.h>} and @samp{_Noreturn} are not used without a check, |
| 585 | typically at configuration time, and the Emacs build procedure | 585 | typically at configuration time, and the Emacs build procedure |
| 586 | provides a substitute implementation if necessary. Some C99 features, | 586 | provides a substitute implementation if necessary. Some C11 features, |
| 587 | such as declarations after statements, are too difficult to provide | 587 | such as anonymous structures and unions, are too difficult to emulate, |
| 588 | substitutes for, so they are avoided entirely. | 588 | so they are avoided entirely. |
| 589 | 589 | ||
| 590 | At some point in the not-too-distant future the base C dialect will | 590 | At some point in the future the base C dialect will no doubt change to C11. |
| 591 | change from C89 to C99, and eventually it will no doubt change to C11. | ||
| 592 | 591 | ||
| 593 | @node Writing Emacs Primitives | 592 | @node Writing Emacs Primitives |
| 594 | @section Writing Emacs Primitives | 593 | @section Writing Emacs Primitives |
diff --git a/etc/ChangeLog b/etc/ChangeLog index 80f3bf54a11..5a359e02863 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * NEWS: Assume C99 or later (Bug#17487). | ||
| 4 | |||
| 1 | 2014-05-16 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2014-05-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | Don't require pkg-config when building from repository. | 7 | Don't require pkg-config when building from repository. |
| @@ -25,6 +25,8 @@ otherwise leave it unmarked. | |||
| 25 | * Installation Changes in Emacs 24.5 | 25 | * Installation Changes in Emacs 24.5 |
| 26 | 26 | ||
| 27 | +++ | 27 | +++ |
| 28 | ** Building Emacs now requires C99 or later. | ||
| 29 | |||
| 28 | ** Building Emacs now requires GNU make. | 30 | ** Building Emacs now requires GNU make. |
| 29 | 31 | ||
| 30 | ** By default, Emacs no longer works on IRIX. We expect that Emacs | 32 | ** By default, Emacs no longer works on IRIX. We expect that Emacs |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index e219292aa34..231b38dbf03 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | # the same distribution terms as the rest of that program. | 21 | # the same distribution terms as the rest of that program. |
| 22 | # | 22 | # |
| 23 | # Generated by gnulib-tool. | 23 | # Generated by gnulib-tool. |
| 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv update-copyright utimens warnings | 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv update-copyright utimens warnings |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | MOSTLYCLEANFILES += core *.stackdump | 27 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -900,57 +900,6 @@ EXTRA_DIST += stdalign.in.h | |||
| 900 | 900 | ||
| 901 | ## end gnulib module stdalign | 901 | ## end gnulib module stdalign |
| 902 | 902 | ||
| 903 | ## begin gnulib module stdarg | ||
| 904 | |||
| 905 | BUILT_SOURCES += $(STDARG_H) | ||
| 906 | |||
| 907 | # We need the following in order to create <stdarg.h> when the system | ||
| 908 | # doesn't have one that works with the given compiler. | ||
| 909 | if GL_GENERATE_STDARG_H | ||
| 910 | stdarg.h: stdarg.in.h $(top_builddir)/config.status | ||
| 911 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 912 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 913 | sed -e 's|@''GUARD_PREFIX''@|GL|g' \ | ||
| 914 | -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 915 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 916 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 917 | -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ | ||
| 918 | < $(srcdir)/stdarg.in.h; \ | ||
| 919 | } > $@-t && \ | ||
| 920 | mv $@-t $@ | ||
| 921 | else | ||
| 922 | stdarg.h: $(top_builddir)/config.status | ||
| 923 | rm -f $@ | ||
| 924 | endif | ||
| 925 | MOSTLYCLEANFILES += stdarg.h stdarg.h-t | ||
| 926 | |||
| 927 | EXTRA_DIST += stdarg.in.h | ||
| 928 | |||
| 929 | ## end gnulib module stdarg | ||
| 930 | |||
| 931 | ## begin gnulib module stdbool | ||
| 932 | |||
| 933 | BUILT_SOURCES += $(STDBOOL_H) | ||
| 934 | |||
| 935 | # We need the following in order to create <stdbool.h> when the system | ||
| 936 | # doesn't have one that works. | ||
| 937 | if GL_GENERATE_STDBOOL_H | ||
| 938 | stdbool.h: stdbool.in.h $(top_builddir)/config.status | ||
| 939 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 940 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 941 | sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ | ||
| 942 | } > $@-t && \ | ||
| 943 | mv $@-t $@ | ||
| 944 | else | ||
| 945 | stdbool.h: $(top_builddir)/config.status | ||
| 946 | rm -f $@ | ||
| 947 | endif | ||
| 948 | MOSTLYCLEANFILES += stdbool.h stdbool.h-t | ||
| 949 | |||
| 950 | EXTRA_DIST += stdbool.in.h | ||
| 951 | |||
| 952 | ## end gnulib module stdbool | ||
| 953 | |||
| 954 | ## begin gnulib module stddef | 903 | ## begin gnulib module stddef |
| 955 | 904 | ||
| 956 | BUILT_SOURCES += $(STDDEF_H) | 905 | BUILT_SOURCES += $(STDDEF_H) |
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h deleted file mode 100644 index 5b37dd3601a..00000000000 --- a/lib/stdarg.in.h +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | /* Substitute for and wrapper around <stdarg.h>. | ||
| 2 | Copyright (C) 2008-2014 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
| 16 | |||
| 17 | #ifndef _@GUARD_PREFIX@_STDARG_H | ||
| 18 | |||
| 19 | #if __GNUC__ >= 3 | ||
| 20 | @PRAGMA_SYSTEM_HEADER@ | ||
| 21 | #endif | ||
| 22 | @PRAGMA_COLUMNS@ | ||
| 23 | |||
| 24 | /* The include_next requires a split double-inclusion guard. */ | ||
| 25 | #@INCLUDE_NEXT@ @NEXT_STDARG_H@ | ||
| 26 | |||
| 27 | #ifndef _@GUARD_PREFIX@_STDARG_H | ||
| 28 | #define _@GUARD_PREFIX@_STDARG_H | ||
| 29 | |||
| 30 | #ifndef va_copy | ||
| 31 | # define va_copy(a,b) ((a) = (b)) | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #endif /* _@GUARD_PREFIX@_STDARG_H */ | ||
| 35 | #endif /* _@GUARD_PREFIX@_STDARG_H */ | ||
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h deleted file mode 100644 index 651e8dffdb3..00000000000 --- a/lib/stdbool.in.h +++ /dev/null | |||
| @@ -1,132 +0,0 @@ | |||
| 1 | /* Copyright (C) 2001-2003, 2006-2014 Free Software Foundation, Inc. | ||
| 2 | Written by Bruno Haible <haible@clisp.cons.org>, 2001. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
| 16 | |||
| 17 | #ifndef _GL_STDBOOL_H | ||
| 18 | #define _GL_STDBOOL_H | ||
| 19 | |||
| 20 | /* ISO C 99 <stdbool.h> for platforms that lack it. */ | ||
| 21 | |||
| 22 | /* Usage suggestions: | ||
| 23 | |||
| 24 | Programs that use <stdbool.h> should be aware of some limitations | ||
| 25 | and standards compliance issues. | ||
| 26 | |||
| 27 | Standards compliance: | ||
| 28 | |||
| 29 | - <stdbool.h> must be #included before 'bool', 'false', 'true' | ||
| 30 | can be used. | ||
| 31 | |||
| 32 | - You cannot assume that sizeof (bool) == 1. | ||
| 33 | |||
| 34 | - Programs should not undefine the macros bool, true, and false, | ||
| 35 | as C99 lists that as an "obsolescent feature". | ||
| 36 | |||
| 37 | Limitations of this substitute, when used in a C89 environment: | ||
| 38 | |||
| 39 | - <stdbool.h> must be #included before the '_Bool' type can be used. | ||
| 40 | |||
| 41 | - You cannot assume that _Bool is a typedef; it might be a macro. | ||
| 42 | |||
| 43 | - Bit-fields of type 'bool' are not supported. Portable code | ||
| 44 | should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. | ||
| 45 | |||
| 46 | - In C99, casts and automatic conversions to '_Bool' or 'bool' are | ||
| 47 | performed in such a way that every nonzero value gets converted | ||
| 48 | to 'true', and zero gets converted to 'false'. This doesn't work | ||
| 49 | with this substitute. With this substitute, only the values 0 and 1 | ||
| 50 | give the expected result when converted to _Bool' or 'bool'. | ||
| 51 | |||
| 52 | - C99 allows the use of (_Bool)0.0 in constant expressions, but | ||
| 53 | this substitute cannot always provide this property. | ||
| 54 | |||
| 55 | Also, it is suggested that programs use 'bool' rather than '_Bool'; | ||
| 56 | this isn't required, but 'bool' is more common. */ | ||
| 57 | |||
| 58 | |||
| 59 | /* 7.16. Boolean type and values */ | ||
| 60 | |||
| 61 | /* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same | ||
| 62 | definitions below, but temporarily we have to #undef them. */ | ||
| 63 | #if defined __BEOS__ && !defined __HAIKU__ | ||
| 64 | # include <OS.h> /* defines bool but not _Bool */ | ||
| 65 | # undef false | ||
| 66 | # undef true | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #ifdef __cplusplus | ||
| 70 | # define _Bool bool | ||
| 71 | # define bool bool | ||
| 72 | #else | ||
| 73 | # if defined __BEOS__ && !defined __HAIKU__ | ||
| 74 | /* A compiler known to have 'bool'. */ | ||
| 75 | /* If the compiler already has both 'bool' and '_Bool', we can assume they | ||
| 76 | are the same types. */ | ||
| 77 | # if !@HAVE__BOOL@ | ||
| 78 | typedef bool _Bool; | ||
| 79 | # endif | ||
| 80 | # else | ||
| 81 | # if !defined __GNUC__ | ||
| 82 | /* If @HAVE__BOOL@: | ||
| 83 | Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when | ||
| 84 | the built-in _Bool type is used. See | ||
| 85 | http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html | ||
| 86 | http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html | ||
| 87 | http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html | ||
| 88 | Similar bugs are likely with other compilers as well; this file | ||
| 89 | wouldn't be used if <stdbool.h> was working. | ||
| 90 | So we override the _Bool type. | ||
| 91 | If !@HAVE__BOOL@: | ||
| 92 | Need to define _Bool ourselves. As 'signed char' or as an enum type? | ||
| 93 | Use of a typedef, with SunPRO C, leads to a stupid | ||
| 94 | "warning: _Bool is a keyword in ISO C99". | ||
| 95 | Use of an enum type, with IRIX cc, leads to a stupid | ||
| 96 | "warning(1185): enumerated type mixed with another type". | ||
| 97 | Even the existence of an enum type, without a typedef, | ||
| 98 | "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. | ||
| 99 | The only benefit of the enum, debuggability, is not important | ||
| 100 | with these compilers. So use 'signed char' and no enum. */ | ||
| 101 | # define _Bool signed char | ||
| 102 | # else | ||
| 103 | /* With this compiler, trust the _Bool type if the compiler has it. */ | ||
| 104 | # if !@HAVE__BOOL@ | ||
| 105 | /* For the sake of symbolic names in gdb, define true and false as | ||
| 106 | enum constants, not only as macros. | ||
| 107 | It is tempting to write | ||
| 108 | typedef enum { false = 0, true = 1 } _Bool; | ||
| 109 | so that gdb prints values of type 'bool' symbolically. But then | ||
| 110 | values of type '_Bool' might promote to 'int' or 'unsigned int' | ||
| 111 | (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' | ||
| 112 | (see ISO C 99 6.3.1.1.(2)). So add a negative value to the | ||
| 113 | enum; this ensures that '_Bool' promotes to 'int'. */ | ||
| 114 | typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; | ||
| 115 | # endif | ||
| 116 | # endif | ||
| 117 | # endif | ||
| 118 | # define bool _Bool | ||
| 119 | #endif | ||
| 120 | |||
| 121 | /* The other macros must be usable in preprocessor directives. */ | ||
| 122 | #ifdef __cplusplus | ||
| 123 | # define false false | ||
| 124 | # define true true | ||
| 125 | #else | ||
| 126 | # define false 0 | ||
| 127 | # define true 1 | ||
| 128 | #endif | ||
| 129 | |||
| 130 | #define __bool_true_false_are_defined 1 | ||
| 131 | |||
| 132 | #endif /* _GL_STDBOOL_H */ | ||
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 0ba2d7950af..98acc069c92 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 | |||
| @@ -119,13 +119,6 @@ AC_DEFUN([gl_EARLY], | |||
| 119 | # Code from module stat: | 119 | # Code from module stat: |
| 120 | # Code from module stat-time: | 120 | # Code from module stat-time: |
| 121 | # Code from module stdalign: | 121 | # Code from module stdalign: |
| 122 | # Code from module stdarg: | ||
| 123 | dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode | ||
| 124 | dnl for the builtin va_copy to work. With Autoconf 2.60 or later, | ||
| 125 | dnl gl_PROG_CC_C99 arranges for this. With older Autoconf gl_PROG_CC_C99 | ||
| 126 | dnl shouldn't hurt, though installers are on their own to set c99 mode. | ||
| 127 | gl_PROG_CC_C99 | ||
| 128 | # Code from module stdbool: | ||
| 129 | # Code from module stddef: | 122 | # Code from module stddef: |
| 130 | # Code from module stdint: | 123 | # Code from module stdint: |
| 131 | # Code from module stdio: | 124 | # Code from module stdio: |
| @@ -342,8 +335,6 @@ AC_DEFUN([gl_INIT], | |||
| 342 | gl_STAT_TIME | 335 | gl_STAT_TIME |
| 343 | gl_STAT_BIRTHTIME | 336 | gl_STAT_BIRTHTIME |
| 344 | gl_STDALIGN_H | 337 | gl_STDALIGN_H |
| 345 | gl_STDARG_H | ||
| 346 | AM_STDBOOL_H | ||
| 347 | gl_STDDEF_H | 338 | gl_STDDEF_H |
| 348 | gl_STDINT_H | 339 | gl_STDINT_H |
| 349 | gl_STDIO_H | 340 | gl_STDIO_H |
| @@ -891,8 +882,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 891 | lib/stat-time.h | 882 | lib/stat-time.h |
| 892 | lib/stat.c | 883 | lib/stat.c |
| 893 | lib/stdalign.in.h | 884 | lib/stdalign.in.h |
| 894 | lib/stdarg.in.h | ||
| 895 | lib/stdbool.in.h | ||
| 896 | lib/stddef.in.h | 885 | lib/stddef.in.h |
| 897 | lib/stdint.in.h | 886 | lib/stdint.in.h |
| 898 | lib/stdio.in.h | 887 | lib/stdio.in.h |
| @@ -998,8 +987,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 998 | m4/stat-time.m4 | 987 | m4/stat-time.m4 |
| 999 | m4/stat.m4 | 988 | m4/stat.m4 |
| 1000 | m4/stdalign.m4 | 989 | m4/stdalign.m4 |
| 1001 | m4/stdarg.m4 | ||
| 1002 | m4/stdbool.m4 | ||
| 1003 | m4/stddef_h.m4 | 990 | m4/stddef_h.m4 |
| 1004 | m4/stdint.m4 | 991 | m4/stdint.m4 |
| 1005 | m4/stdio_h.m4 | 992 | m4/stdio_h.m4 |
diff --git a/m4/stdarg.m4 b/m4/stdarg.m4 deleted file mode 100644 index 732aa313b6a..00000000000 --- a/m4/stdarg.m4 +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | # stdarg.m4 serial 6 | ||
| 2 | dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Bruno Haible. | ||
| 8 | dnl Provide a working va_copy in combination with <stdarg.h>. | ||
| 9 | |||
| 10 | AC_DEFUN([gl_STDARG_H], | ||
| 11 | [ | ||
| 12 | STDARG_H='' | ||
| 13 | NEXT_STDARG_H='<stdarg.h>' | ||
| 14 | AC_MSG_CHECKING([for va_copy]) | ||
| 15 | AC_CACHE_VAL([gl_cv_func_va_copy], [ | ||
| 16 | AC_COMPILE_IFELSE( | ||
| 17 | [AC_LANG_PROGRAM( | ||
| 18 | [[#include <stdarg.h>]], | ||
| 19 | [[ | ||
| 20 | #ifndef va_copy | ||
| 21 | void (*func) (va_list, va_list) = va_copy; | ||
| 22 | #endif | ||
| 23 | ]])], | ||
| 24 | [gl_cv_func_va_copy=yes], | ||
| 25 | [gl_cv_func_va_copy=no])]) | ||
| 26 | AC_MSG_RESULT([$gl_cv_func_va_copy]) | ||
| 27 | if test $gl_cv_func_va_copy = no; then | ||
| 28 | dnl Provide a substitute. | ||
| 29 | dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5 | ||
| 30 | dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h> | ||
| 31 | dnl which does '#undef va_copy', leading to a missing va_copy symbol. For | ||
| 32 | dnl this platform, we use an <stdarg.h> substitute. But we cannot use this | ||
| 33 | dnl approach on other platforms, because <stdarg.h> often defines only | ||
| 34 | dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do | ||
| 35 | dnl not work in this situation. | ||
| 36 | AC_EGREP_CPP([vaccine], | ||
| 37 | [#if defined _AIX && !defined __GNUC__ | ||
| 38 | AIX vaccine | ||
| 39 | #endif | ||
| 40 | ], [gl_aixcc=yes], [gl_aixcc=no]) | ||
| 41 | if test $gl_aixcc = yes; then | ||
| 42 | dnl Provide a substitute <stdarg.h> file. | ||
| 43 | STDARG_H=stdarg.h | ||
| 44 | gl_NEXT_HEADERS([stdarg.h]) | ||
| 45 | dnl Fallback for the case when <stdarg.h> contains only macro definitions. | ||
| 46 | if test "$gl_cv_next_stdarg_h" = '""'; then | ||
| 47 | gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' | ||
| 48 | NEXT_STDARG_H="$gl_cv_next_stdarg_h" | ||
| 49 | fi | ||
| 50 | else | ||
| 51 | dnl Provide a substitute in <config.h>, either __va_copy or as a simple | ||
| 52 | dnl assignment. | ||
| 53 | gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [ | ||
| 54 | AC_COMPILE_IFELSE( | ||
| 55 | [AC_LANG_PROGRAM( | ||
| 56 | [[#include <stdarg.h>]], | ||
| 57 | [[ | ||
| 58 | #ifndef __va_copy | ||
| 59 | error, bail out | ||
| 60 | #endif | ||
| 61 | ]])], | ||
| 62 | [gl_cv_func___va_copy=yes], | ||
| 63 | [gl_cv_func___va_copy=no])]) | ||
| 64 | if test $gl_cv_func___va_copy = yes; then | ||
| 65 | AC_DEFINE([va_copy], [__va_copy], | ||
| 66 | [Define as a macro for copying va_list variables.]) | ||
| 67 | else | ||
| 68 | AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ | ||
| 69 | #define gl_va_copy(a,b) ((a) = (b))]) | ||
| 70 | AC_DEFINE([va_copy], [gl_va_copy], | ||
| 71 | [Define as a macro for copying va_list variables.]) | ||
| 72 | fi | ||
| 73 | fi | ||
| 74 | fi | ||
| 75 | AC_SUBST([STDARG_H]) | ||
| 76 | AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"]) | ||
| 77 | AC_SUBST([NEXT_STDARG_H]) | ||
| 78 | ]) | ||
diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 deleted file mode 100644 index 006ed52de5d..00000000000 --- a/m4/stdbool.m4 +++ /dev/null | |||
| @@ -1,100 +0,0 @@ | |||
| 1 | # Check for stdbool.h that conforms to C99. | ||
| 2 | |||
| 3 | dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc. | ||
| 4 | dnl This file is free software; the Free Software Foundation | ||
| 5 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 6 | dnl with or without modifications, as long as this notice is preserved. | ||
| 7 | |||
| 8 | #serial 5 | ||
| 9 | |||
| 10 | # Prepare for substituting <stdbool.h> if it is not supported. | ||
| 11 | |||
| 12 | AC_DEFUN([AM_STDBOOL_H], | ||
| 13 | [ | ||
| 14 | AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) | ||
| 15 | |||
| 16 | # Define two additional variables used in the Makefile substitution. | ||
| 17 | |||
| 18 | if test "$ac_cv_header_stdbool_h" = yes; then | ||
| 19 | STDBOOL_H='' | ||
| 20 | else | ||
| 21 | STDBOOL_H='stdbool.h' | ||
| 22 | fi | ||
| 23 | AC_SUBST([STDBOOL_H]) | ||
| 24 | AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) | ||
| 25 | |||
| 26 | if test "$ac_cv_type__Bool" = yes; then | ||
| 27 | HAVE__BOOL=1 | ||
| 28 | else | ||
| 29 | HAVE__BOOL=0 | ||
| 30 | fi | ||
| 31 | AC_SUBST([HAVE__BOOL]) | ||
| 32 | ]) | ||
| 33 | |||
| 34 | # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. | ||
| 35 | AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) | ||
| 36 | |||
| 37 | # This version of the macro is needed in autoconf <= 2.68. | ||
| 38 | |||
| 39 | AC_DEFUN([AC_CHECK_HEADER_STDBOOL], | ||
| 40 | [AC_CACHE_CHECK([for stdbool.h that conforms to C99], | ||
| 41 | [ac_cv_header_stdbool_h], | ||
| 42 | [AC_COMPILE_IFELSE( | ||
| 43 | [AC_LANG_PROGRAM( | ||
| 44 | [[ | ||
| 45 | #include <stdbool.h> | ||
| 46 | #ifndef bool | ||
| 47 | "error: bool is not defined" | ||
| 48 | #endif | ||
| 49 | #ifndef false | ||
| 50 | "error: false is not defined" | ||
| 51 | #endif | ||
| 52 | #if false | ||
| 53 | "error: false is not 0" | ||
| 54 | #endif | ||
| 55 | #ifndef true | ||
| 56 | "error: true is not defined" | ||
| 57 | #endif | ||
| 58 | #if true != 1 | ||
| 59 | "error: true is not 1" | ||
| 60 | #endif | ||
| 61 | #ifndef __bool_true_false_are_defined | ||
| 62 | "error: __bool_true_false_are_defined is not defined" | ||
| 63 | #endif | ||
| 64 | |||
| 65 | struct s { _Bool s: 1; _Bool t; } s; | ||
| 66 | |||
| 67 | char a[true == 1 ? 1 : -1]; | ||
| 68 | char b[false == 0 ? 1 : -1]; | ||
| 69 | char c[__bool_true_false_are_defined == 1 ? 1 : -1]; | ||
| 70 | char d[(bool) 0.5 == true ? 1 : -1]; | ||
| 71 | /* See body of main program for 'e'. */ | ||
| 72 | char f[(_Bool) 0.0 == false ? 1 : -1]; | ||
| 73 | char g[true]; | ||
| 74 | char h[sizeof (_Bool)]; | ||
| 75 | char i[sizeof s.t]; | ||
| 76 | enum { j = false, k = true, l = false * true, m = true * 256 }; | ||
| 77 | /* The following fails for | ||
| 78 | HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ | ||
| 79 | _Bool n[m]; | ||
| 80 | char o[sizeof n == m * sizeof n[0] ? 1 : -1]; | ||
| 81 | char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; | ||
| 82 | /* Catch a bug in an HP-UX C compiler. See | ||
| 83 | http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html | ||
| 84 | http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html | ||
| 85 | */ | ||
| 86 | _Bool q = true; | ||
| 87 | _Bool *pq = &q; | ||
| 88 | ]], | ||
| 89 | [[ | ||
| 90 | bool e = &s; | ||
| 91 | *pq |= q; | ||
| 92 | *pq |= ! q; | ||
| 93 | /* Refer to every declared value, to avoid compiler optimizations. */ | ||
| 94 | return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l | ||
| 95 | + !m + !n + !o + !p + !q + !pq); | ||
| 96 | ]])], | ||
| 97 | [ac_cv_header_stdbool_h=yes], | ||
| 98 | [ac_cv_header_stdbool_h=no])]) | ||
| 99 | AC_CHECK_TYPES([_Bool]) | ||
| 100 | ]) | ||
diff --git a/nt/ChangeLog b/nt/ChangeLog index fc1b0a09102..a3cb5e62dac 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume C99 or later (Bug#17487). | ||
| 4 | * gnulib.mk: Remove stdarg and stdbool modules. | ||
| 5 | |||
| 1 | 2014-05-16 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2014-05-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | Don't require pkg-config when building from repository. | 8 | Don't require pkg-config when building from repository. |
diff --git a/nt/gnulib.mk b/nt/gnulib.mk index 7877c154b96..7c2cceb959f 100644 --- a/nt/gnulib.mk +++ b/nt/gnulib.mk | |||
| @@ -671,57 +671,6 @@ EXTRA_DIST += stdalign.in.h | |||
| 671 | 671 | ||
| 672 | ## end gnulib module stdalign | 672 | ## end gnulib module stdalign |
| 673 | 673 | ||
| 674 | ## begin gnulib module stdarg | ||
| 675 | |||
| 676 | BUILT_SOURCES += $(STDARG_H) | ||
| 677 | |||
| 678 | # We need the following in order to create <stdarg.h> when the system | ||
| 679 | # doesn't have one that works with the given compiler. | ||
| 680 | if GL_GENERATE_STDARG_H | ||
| 681 | stdarg.h: stdarg.in.h $(top_builddir)/config.status | ||
| 682 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 683 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 684 | sed -e 's|@''GUARD_PREFIX''@|GL|g' \ | ||
| 685 | -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 686 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 687 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 688 | -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ | ||
| 689 | < $(srcdir)/stdarg.in.h; \ | ||
| 690 | } > $@-t && \ | ||
| 691 | mv $@-t $@ | ||
| 692 | else | ||
| 693 | stdarg.h: $(top_builddir)/config.status | ||
| 694 | rm -f $@ | ||
| 695 | endif | ||
| 696 | MOSTLYCLEANFILES += stdarg.h stdarg.h-t | ||
| 697 | |||
| 698 | EXTRA_DIST += stdarg.in.h | ||
| 699 | |||
| 700 | ## end gnulib module stdarg | ||
| 701 | |||
| 702 | ## begin gnulib module stdbool | ||
| 703 | |||
| 704 | BUILT_SOURCES += $(STDBOOL_H) | ||
| 705 | |||
| 706 | # We need the following in order to create <stdbool.h> when the system | ||
| 707 | # doesn't have one that works. | ||
| 708 | if GL_GENERATE_STDBOOL_H | ||
| 709 | stdbool.h: stdbool.in.h $(top_builddir)/config.status | ||
| 710 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 711 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 712 | sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ | ||
| 713 | } > $@-t && \ | ||
| 714 | mv $@-t $@ | ||
| 715 | else | ||
| 716 | stdbool.h: $(top_builddir)/config.status | ||
| 717 | rm -f $@ | ||
| 718 | endif | ||
| 719 | MOSTLYCLEANFILES += stdbool.h stdbool.h-t | ||
| 720 | |||
| 721 | EXTRA_DIST += stdbool.in.h | ||
| 722 | |||
| 723 | ## end gnulib module stdbool | ||
| 724 | |||
| 725 | ## begin gnulib module stddef | 674 | ## begin gnulib module stddef |
| 726 | 675 | ||
| 727 | BUILT_SOURCES += $(STDDEF_H) | 676 | BUILT_SOURCES += $(STDDEF_H) |
diff --git a/src/ChangeLog b/src/ChangeLog index a89d14bbe23..31fe13e074c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume C99 or later (Bug#17487). | ||
| 4 | * bytecode.c (B__dummy__): Remove. | ||
| 5 | * conf_post.h (bool_bf) [!NS_IMPL_GNUSTEP]: Use bool. | ||
| 6 | (FLEXIBLE_ARRAY_MEMBER): Now always empty. | ||
| 7 | * dbusbind.c (XD_DEBUG_MESSAGE) [!DBUS_DEBUG]: | ||
| 8 | * regex.c (DEBUG_PRINT): Assume varargs macros. | ||
| 9 | * lisp.h (DEFUN_FUNCTION_INIT): Remove. All uses now assume C99. | ||
| 10 | |||
| 1 | 2014-05-17 Fabrice Popineau <fabrice.popineau@gmail.com> | 11 | 2014-05-17 Fabrice Popineau <fabrice.popineau@gmail.com> |
| 2 | 12 | ||
| 3 | * buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Always map new | 13 | * buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Always map new |
diff --git a/src/bytecode.c b/src/bytecode.c index f1bdfd9d9c5..f489c74a144 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -292,8 +292,6 @@ enum byte_code_op | |||
| 292 | Bscan_buffer = 0153, /* No longer generated as of v18. */ | 292 | Bscan_buffer = 0153, /* No longer generated as of v18. */ |
| 293 | Bset_mark = 0163, /* this loser is no longer generated as of v18 */ | 293 | Bset_mark = 0163, /* this loser is no longer generated as of v18 */ |
| 294 | #endif | 294 | #endif |
| 295 | |||
| 296 | B__dummy__ = 0 /* Pacify C89. */ | ||
| 297 | }; | 295 | }; |
| 298 | 296 | ||
| 299 | /* Whether to maintain a `top' and `bottom' field in the stack frame. */ | 297 | /* Whether to maintain a `top' and `bottom' field in the stack frame. */ |
diff --git a/src/conf_post.h b/src/conf_post.h index 95b028a66ee..123f4803da5 100644 --- a/src/conf_post.h +++ b/src/conf_post.h | |||
| @@ -34,9 +34,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 34 | 34 | ||
| 35 | #include <stdbool.h> | 35 | #include <stdbool.h> |
| 36 | 36 | ||
| 37 | /* The pre-C99 <stdbool.h> emulation doesn't work for bool bitfields. | 37 | /* The type of bool bitfields. Needed to compile Objective-C with |
| 38 | Nor does compiling Objective-C with standard GCC. */ | 38 | standard GCC. It was also needed to port to pre-C99 compilers, |
| 39 | #if __STDC_VERSION__ < 199901 || NS_IMPL_GNUSTEP | 39 | although we don't care about that any more. */ |
| 40 | #if NS_IMPL_GNUSTEP | ||
| 40 | typedef unsigned int bool_bf; | 41 | typedef unsigned int bool_bf; |
| 41 | #else | 42 | #else |
| 42 | typedef bool bool_bf; | 43 | typedef bool bool_bf; |
| @@ -293,14 +294,11 @@ extern void _DebPrint (const char *fmt, ...); | |||
| 293 | 294 | ||
| 294 | /* To use the struct hack with N elements, declare the struct like this: | 295 | /* To use the struct hack with N elements, declare the struct like this: |
| 295 | struct s { ...; t name[FLEXIBLE_ARRAY_MEMBER]; }; | 296 | struct s { ...; t name[FLEXIBLE_ARRAY_MEMBER]; }; |
| 296 | and allocate (offsetof (struct s, name) + N * sizeof (t)) bytes. */ | 297 | and allocate (offsetof (struct s, name) + N * sizeof (t)) bytes. |
| 297 | #if 199901 <= __STDC_VERSION__ | 298 | |
| 298 | # define FLEXIBLE_ARRAY_MEMBER | 299 | This macro used to expand to something different on pre-C99 compilers. |
| 299 | #elif __GNUC__ && !defined __STRICT_ANSI__ | 300 | FIXME: Remove it, and remove all uses. */ |
| 300 | # define FLEXIBLE_ARRAY_MEMBER 0 | 301 | #define FLEXIBLE_ARRAY_MEMBER |
| 301 | #else | ||
| 302 | # define FLEXIBLE_ARRAY_MEMBER 1 | ||
| 303 | #endif | ||
| 304 | 302 | ||
| 305 | /* Use this to suppress gcc's `...may be used before initialized' warnings. */ | 303 | /* Use this to suppress gcc's `...may be used before initialized' warnings. */ |
| 306 | #ifdef lint | 304 | #ifdef lint |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 8ebc56c72c4..8997e01b068 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -142,10 +142,7 @@ static bool xd_in_read_queued_messages = 0; | |||
| 142 | } while (0) | 142 | } while (0) |
| 143 | 143 | ||
| 144 | #else /* !DBUS_DEBUG */ | 144 | #else /* !DBUS_DEBUG */ |
| 145 | # if __STDC_VERSION__ < 199901 | 145 | # define XD_DEBUG_MESSAGE(...) \ |
| 146 | # define XD_DEBUG_MESSAGE (void) /* Pre-C99 compilers cannot debug. */ | ||
| 147 | # else | ||
| 148 | # define XD_DEBUG_MESSAGE(...) \ | ||
| 149 | do { \ | 146 | do { \ |
| 150 | if (!NILP (Vdbus_debug)) \ | 147 | if (!NILP (Vdbus_debug)) \ |
| 151 | { \ | 148 | { \ |
| @@ -154,7 +151,6 @@ static bool xd_in_read_queued_messages = 0; | |||
| 154 | message ("%s: %s", __func__, s); \ | 151 | message ("%s: %s", __func__, s); \ |
| 155 | } \ | 152 | } \ |
| 156 | } while (0) | 153 | } while (0) |
| 157 | # endif | ||
| 158 | # define XD_DEBUG_VALID_LISP_OBJECT_P(object) | 154 | # define XD_DEBUG_VALID_LISP_OBJECT_P(object) |
| 159 | #endif | 155 | #endif |
| 160 | 156 | ||
diff --git a/src/emacs.c b/src/emacs.c index deebb2280c7..16d91de84a4 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -214,7 +214,7 @@ int initial_argc; | |||
| 214 | static void sort_args (int argc, char **argv); | 214 | static void sort_args (int argc, char **argv); |
| 215 | static void syms_of_emacs (void); | 215 | static void syms_of_emacs (void); |
| 216 | 216 | ||
| 217 | /* C89 needs each string be at most 509 characters, so the usage | 217 | /* C99 needs each string to be at most 4095 characters, and the usage |
| 218 | strings below are split to not overflow this limit. */ | 218 | strings below are split to not overflow this limit. */ |
| 219 | static char const *const usage_message[] = | 219 | static char const *const usage_message[] = |
| 220 | { "\ | 220 | { "\ |
diff --git a/src/lisp.h b/src/lisp.h index f47fb0c2a24..67b26ef91c7 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2654,16 +2654,11 @@ CHECK_NUMBER_CDR (Lisp_Object x) | |||
| 2654 | minargs, maxargs, lname, intspec, 0}; \ | 2654 | minargs, maxargs, lname, intspec, 0}; \ |
| 2655 | Lisp_Object fnname | 2655 | Lisp_Object fnname |
| 2656 | #else /* not _MSC_VER */ | 2656 | #else /* not _MSC_VER */ |
| 2657 | # if __STDC_VERSION__ < 199901 | ||
| 2658 | # define DEFUN_FUNCTION_INIT(fnname, maxargs) (Lisp_Object (*) (void)) fnname | ||
| 2659 | # else | ||
| 2660 | # define DEFUN_FUNCTION_INIT(fnname, maxargs) .a ## maxargs = fnname | ||
| 2661 | # endif | ||
| 2662 | #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ | 2657 | #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ |
| 2663 | Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ | 2658 | Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ |
| 2664 | static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ | 2659 | static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ |
| 2665 | { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ | 2660 | { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ |
| 2666 | { DEFUN_FUNCTION_INIT (fnname, maxargs) }, \ | 2661 | { .a ## maxargs = fnname }, \ |
| 2667 | minargs, maxargs, lname, intspec, 0}; \ | 2662 | minargs, maxargs, lname, intspec, 0}; \ |
| 2668 | Lisp_Object fnname | 2663 | Lisp_Object fnname |
| 2669 | #endif | 2664 | #endif |
diff --git a/src/regex.c b/src/regex.c index 622db708b98..ac71b797fbd 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -1190,12 +1190,7 @@ print_double_string (re_char *where, re_char *string1, ssize_t size1, | |||
| 1190 | # define assert(e) | 1190 | # define assert(e) |
| 1191 | 1191 | ||
| 1192 | # define DEBUG_STATEMENT(e) | 1192 | # define DEBUG_STATEMENT(e) |
| 1193 | # if __STDC_VERSION__ < 199901L | 1193 | # define DEBUG_PRINT(...) |
| 1194 | # define DEBUG_COMPILES_ARGUMENTS | ||
| 1195 | # define DEBUG_PRINT /* 'DEBUG_PRINT (x, y)' discards X and Y. */ (void) | ||
| 1196 | # else | ||
| 1197 | # define DEBUG_PRINT(...) | ||
| 1198 | # endif | ||
| 1199 | # define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) | 1194 | # define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) |
| 1200 | # define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) | 1195 | # define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) |
| 1201 | 1196 | ||