1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

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
This commit is contained in:
Paul Eggert 2014-05-17 01:11:31 -07:00
parent f63fc858c3
commit 8208d2bf95
23 changed files with 71 additions and 501 deletions

View File

@ -1,3 +1,13 @@
2014-05-17 Paul Eggert <eggert@cs.ucla.edu>
Assume C99 or later (Bug#17487).
* 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.
2014-05-16 Paul Eggert <eggert@cs.ucla.edu>
Don't require pkg-config when building from repository.

View File

@ -1,3 +1,9 @@
2014-05-17 Paul Eggert <eggert@cs.ucla.edu>
Assume C99 or later (Bug#17487).
* merge-gnulib (GNULIB_MODULES): Remove stdarg, stdbool.
(GNULIB_TOOL_FLAGS): Avoid stdarg, stdbool.
2014-05-16 Paul Eggert <eggert@cs.ucla.edu>
Don't require pkg-config when building from repository.

View File

@ -35,7 +35,7 @@ GNULIB_MODULES='
intprops largefile lstat
manywarnings memrchr mkostemp mktime
pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat
sig2str socklen stat-time stdalign stdarg stdbool stdio
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
@ -49,6 +49,7 @@ GNULIB_TOOL_FLAGS='
--avoid=open --avoid=openat-die --avoid=opendir
--avoid=raise
--avoid=save-cwd --avoid=select --avoid=sigprocmask
--avoid=stdarg --avoid=stdbool
--avoid=threadlib
--conditional-dependencies --import --no-changelog --no-vc-files
--makefile-name=gnulib.mk

View File

@ -670,6 +670,9 @@ fi
#### Choose a compiler.
dnl Don't bother to test for C89.
AC_DEFUN([_AC_PROG_CC_C89], [$2])
dnl Sets GCC=yes if using gcc.
AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"])
if test -n "$XCRUN"; then
@ -677,6 +680,9 @@ if test -n "$XCRUN"; then
test -n "$AR" && export AR
fi
dnl Emacs needs C99 or later.
gl_PROG_CC_C99
AM_PROG_CC_C_O
if test x$GCC = xyes; then
@ -1303,7 +1309,7 @@ else
CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
fi
# Suppress obsolescent Autoconf test for size_t; Emacs assumes C89 or better.
# Suppress obsolescent Autoconf test for size_t; Emacs assumes C99 or better.
AC_DEFUN([AC_TYPE_SIZE_T])
# Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
AC_DEFUN([AC_TYPE_UID_T])

View File

@ -1,3 +1,8 @@
2014-05-17 Paul Eggert <eggert@cs.ucla.edu>
Assume C99 or later (Bug#17487).
* internals.texi (C Dialect): Document this.
2014-05-15 Dmitry Antipov <dmantipov@yandex.ru>
* lists.texi (Building Cons Cells and Lists): Remove

View File

@ -580,15 +580,14 @@ Emacs session.
@section C Dialect
@cindex C programming language
The C part of Emacs is portable to C89: C99-specific features such as
@samp{<stdbool.h>} and @samp{inline} are not used without a check,
The C part of Emacs is portable to C99 or later: C11-specific features such
as @samp{<stdalign.h>} and @samp{_Noreturn} are not used without a check,
typically at configuration time, and the Emacs build procedure
provides a substitute implementation if necessary. Some C99 features,
such as declarations after statements, are too difficult to provide
substitutes for, so they are avoided entirely.
provides a substitute implementation if necessary. Some C11 features,
such as anonymous structures and unions, are too difficult to emulate,
so they are avoided entirely.
At some point in the not-too-distant future the base C dialect will
change from C89 to C99, and eventually it will no doubt change to C11.
At some point in the future the base C dialect will no doubt change to C11.
@node Writing Emacs Primitives
@section Writing Emacs Primitives

View File

@ -1,3 +1,7 @@
2014-05-17 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Assume C99 or later (Bug#17487).
2014-05-16 Paul Eggert <eggert@cs.ucla.edu>
Don't require pkg-config when building from repository.

View File

@ -25,6 +25,8 @@ otherwise leave it unmarked.
* Installation Changes in Emacs 24.5
+++
** Building Emacs now requires C99 or later.
** Building Emacs now requires GNU make.
** By default, Emacs no longer works on IRIX. We expect that Emacs

View File

@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# 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
# 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
MOSTLYCLEANFILES += core *.stackdump
@ -900,57 +900,6 @@ EXTRA_DIST += stdalign.in.h
## end gnulib module stdalign
## begin gnulib module stdarg
BUILT_SOURCES += $(STDARG_H)
# We need the following in order to create <stdarg.h> when the system
# doesn't have one that works with the given compiler.
if GL_GENERATE_STDARG_H
stdarg.h: stdarg.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \
< $(srcdir)/stdarg.in.h; \
} > $@-t && \
mv $@-t $@
else
stdarg.h: $(top_builddir)/config.status
rm -f $@
endif
MOSTLYCLEANFILES += stdarg.h stdarg.h-t
EXTRA_DIST += stdarg.in.h
## end gnulib module stdarg
## begin gnulib module stdbool
BUILT_SOURCES += $(STDBOOL_H)
# We need the following in order to create <stdbool.h> when the system
# doesn't have one that works.
if GL_GENERATE_STDBOOL_H
stdbool.h: stdbool.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
} > $@-t && \
mv $@-t $@
else
stdbool.h: $(top_builddir)/config.status
rm -f $@
endif
MOSTLYCLEANFILES += stdbool.h stdbool.h-t
EXTRA_DIST += stdbool.in.h
## end gnulib module stdbool
## begin gnulib module stddef
BUILT_SOURCES += $(STDDEF_H)

View File

@ -1,35 +0,0 @@
/* Substitute for and wrapper around <stdarg.h>.
Copyright (C) 2008-2014 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
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_STDARG_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDARG_H@
#ifndef _@GUARD_PREFIX@_STDARG_H
#define _@GUARD_PREFIX@_STDARG_H
#ifndef va_copy
# define va_copy(a,b) ((a) = (b))
#endif
#endif /* _@GUARD_PREFIX@_STDARG_H */
#endif /* _@GUARD_PREFIX@_STDARG_H */

View File

@ -1,132 +0,0 @@
/* Copyright (C) 2001-2003, 2006-2014 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
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
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_STDBOOL_H
#define _GL_STDBOOL_H
/* ISO C 99 <stdbool.h> for platforms that lack it. */
/* Usage suggestions:
Programs that use <stdbool.h> should be aware of some limitations
and standards compliance issues.
Standards compliance:
- <stdbool.h> must be #included before 'bool', 'false', 'true'
can be used.
- You cannot assume that sizeof (bool) == 1.
- Programs should not undefine the macros bool, true, and false,
as C99 lists that as an "obsolescent feature".
Limitations of this substitute, when used in a C89 environment:
- <stdbool.h> must be #included before the '_Bool' type can be used.
- You cannot assume that _Bool is a typedef; it might be a macro.
- Bit-fields of type 'bool' are not supported. Portable code
should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
- In C99, casts and automatic conversions to '_Bool' or 'bool' are
performed in such a way that every nonzero value gets converted
to 'true', and zero gets converted to 'false'. This doesn't work
with this substitute. With this substitute, only the values 0 and 1
give the expected result when converted to _Bool' or 'bool'.
- C99 allows the use of (_Bool)0.0 in constant expressions, but
this substitute cannot always provide this property.
Also, it is suggested that programs use 'bool' rather than '_Bool';
this isn't required, but 'bool' is more common. */
/* 7.16. Boolean type and values */
/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
definitions below, but temporarily we have to #undef them. */
#if defined __BEOS__ && !defined __HAIKU__
# include <OS.h> /* defines bool but not _Bool */
# undef false
# undef true
#endif
#ifdef __cplusplus
# define _Bool bool
# define bool bool
#else
# if defined __BEOS__ && !defined __HAIKU__
/* A compiler known to have 'bool'. */
/* If the compiler already has both 'bool' and '_Bool', we can assume they
are the same types. */
# if !@HAVE__BOOL@
typedef bool _Bool;
# endif
# else
# if !defined __GNUC__
/* If @HAVE__BOOL@:
Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
the built-in _Bool type is used. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
Similar bugs are likely with other compilers as well; this file
wouldn't be used if <stdbool.h> was working.
So we override the _Bool type.
If !@HAVE__BOOL@:
Need to define _Bool ourselves. As 'signed char' or as an enum type?
Use of a typedef, with SunPRO C, leads to a stupid
"warning: _Bool is a keyword in ISO C99".
Use of an enum type, with IRIX cc, leads to a stupid
"warning(1185): enumerated type mixed with another type".
Even the existence of an enum type, without a typedef,
"Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
The only benefit of the enum, debuggability, is not important
with these compilers. So use 'signed char' and no enum. */
# define _Bool signed char
# else
/* With this compiler, trust the _Bool type if the compiler has it. */
# if !@HAVE__BOOL@
/* For the sake of symbolic names in gdb, define true and false as
enum constants, not only as macros.
It is tempting to write
typedef enum { false = 0, true = 1 } _Bool;
so that gdb prints values of type 'bool' symbolically. But then
values of type '_Bool' might promote to 'int' or 'unsigned int'
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
(see ISO C 99 6.3.1.1.(2)). So add a negative value to the
enum; this ensures that '_Bool' promotes to 'int'. */
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# endif
# endif
# endif
# define bool _Bool
#endif
/* The other macros must be usable in preprocessor directives. */
#ifdef __cplusplus
# define false false
# define true true
#else
# define false 0
# define true 1
#endif
#define __bool_true_false_are_defined 1
#endif /* _GL_STDBOOL_H */

View File

@ -119,13 +119,6 @@ AC_DEFUN([gl_EARLY],
# Code from module stat:
# Code from module stat-time:
# Code from module stdalign:
# Code from module stdarg:
dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
dnl for the builtin va_copy to work. With Autoconf 2.60 or later,
dnl gl_PROG_CC_C99 arranges for this. With older Autoconf gl_PROG_CC_C99
dnl shouldn't hurt, though installers are on their own to set c99 mode.
gl_PROG_CC_C99
# Code from module stdbool:
# Code from module stddef:
# Code from module stdint:
# Code from module stdio:
@ -342,8 +335,6 @@ AC_DEFUN([gl_INIT],
gl_STAT_TIME
gl_STAT_BIRTHTIME
gl_STDALIGN_H
gl_STDARG_H
AM_STDBOOL_H
gl_STDDEF_H
gl_STDINT_H
gl_STDIO_H
@ -891,8 +882,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stat-time.h
lib/stat.c
lib/stdalign.in.h
lib/stdarg.in.h
lib/stdbool.in.h
lib/stddef.in.h
lib/stdint.in.h
lib/stdio.in.h
@ -998,8 +987,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/stat-time.m4
m4/stat.m4
m4/stdalign.m4
m4/stdarg.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/stdint.m4
m4/stdio_h.m4

View File

@ -1,78 +0,0 @@
# stdarg.m4 serial 6
dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl Provide a working va_copy in combination with <stdarg.h>.
AC_DEFUN([gl_STDARG_H],
[
STDARG_H=''
NEXT_STDARG_H='<stdarg.h>'
AC_MSG_CHECKING([for va_copy])
AC_CACHE_VAL([gl_cv_func_va_copy], [
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdarg.h>]],
[[
#ifndef va_copy
void (*func) (va_list, va_list) = va_copy;
#endif
]])],
[gl_cv_func_va_copy=yes],
[gl_cv_func_va_copy=no])])
AC_MSG_RESULT([$gl_cv_func_va_copy])
if test $gl_cv_func_va_copy = no; then
dnl Provide a substitute.
dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5
dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h>
dnl which does '#undef va_copy', leading to a missing va_copy symbol. For
dnl this platform, we use an <stdarg.h> substitute. But we cannot use this
dnl approach on other platforms, because <stdarg.h> often defines only
dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do
dnl not work in this situation.
AC_EGREP_CPP([vaccine],
[#if defined _AIX && !defined __GNUC__
AIX vaccine
#endif
], [gl_aixcc=yes], [gl_aixcc=no])
if test $gl_aixcc = yes; then
dnl Provide a substitute <stdarg.h> file.
STDARG_H=stdarg.h
gl_NEXT_HEADERS([stdarg.h])
dnl Fallback for the case when <stdarg.h> contains only macro definitions.
if test "$gl_cv_next_stdarg_h" = '""'; then
gl_cv_next_stdarg_h='"///usr/include/stdarg.h"'
NEXT_STDARG_H="$gl_cv_next_stdarg_h"
fi
else
dnl Provide a substitute in <config.h>, either __va_copy or as a simple
dnl assignment.
gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdarg.h>]],
[[
#ifndef __va_copy
error, bail out
#endif
]])],
[gl_cv_func___va_copy=yes],
[gl_cv_func___va_copy=no])])
if test $gl_cv_func___va_copy = yes; then
AC_DEFINE([va_copy], [__va_copy],
[Define as a macro for copying va_list variables.])
else
AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */
#define gl_va_copy(a,b) ((a) = (b))])
AC_DEFINE([va_copy], [gl_va_copy],
[Define as a macro for copying va_list variables.])
fi
fi
fi
AC_SUBST([STDARG_H])
AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"])
AC_SUBST([NEXT_STDARG_H])
])

View File

@ -1,100 +0,0 @@
# Check for stdbool.h that conforms to C99.
dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
#serial 5
# Prepare for substituting <stdbool.h> if it is not supported.
AC_DEFUN([AM_STDBOOL_H],
[
AC_REQUIRE([AC_CHECK_HEADER_STDBOOL])
# Define two additional variables used in the Makefile substitution.
if test "$ac_cv_header_stdbool_h" = yes; then
STDBOOL_H=''
else
STDBOOL_H='stdbool.h'
fi
AC_SUBST([STDBOOL_H])
AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"])
if test "$ac_cv_type__Bool" = yes; then
HAVE__BOOL=1
else
HAVE__BOOL=0
fi
AC_SUBST([HAVE__BOOL])
])
# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
# This version of the macro is needed in autoconf <= 2.68.
AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
[ac_cv_header_stdbool_h],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <stdbool.h>
#ifndef bool
"error: bool is not defined"
#endif
#ifndef false
"error: false is not defined"
#endif
#if false
"error: false is not 0"
#endif
#ifndef true
"error: true is not defined"
#endif
#if true != 1
"error: true is not 1"
#endif
#ifndef __bool_true_false_are_defined
"error: __bool_true_false_are_defined is not defined"
#endif
struct s { _Bool s: 1; _Bool t; } s;
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
char d[(bool) 0.5 == true ? 1 : -1];
/* See body of main program for 'e'. */
char f[(_Bool) 0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
char i[sizeof s.t];
enum { j = false, k = true, l = false * true, m = true * 256 };
/* The following fails for
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
/* Catch a bug in an HP-UX C compiler. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
*/
_Bool q = true;
_Bool *pq = &q;
]],
[[
bool e = &s;
*pq |= q;
*pq |= ! q;
/* Refer to every declared value, to avoid compiler optimizations. */
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ !m + !n + !o + !p + !q + !pq);
]])],
[ac_cv_header_stdbool_h=yes],
[ac_cv_header_stdbool_h=no])])
AC_CHECK_TYPES([_Bool])
])

View File

@ -1,3 +1,8 @@
2014-05-17 Paul Eggert <eggert@cs.ucla.edu>
Assume C99 or later (Bug#17487).
* gnulib.mk: Remove stdarg and stdbool modules.
2014-05-16 Paul Eggert <eggert@cs.ucla.edu>
Don't require pkg-config when building from repository.

View File

@ -671,57 +671,6 @@ EXTRA_DIST += stdalign.in.h
## end gnulib module stdalign
## begin gnulib module stdarg
BUILT_SOURCES += $(STDARG_H)
# We need the following in order to create <stdarg.h> when the system
# doesn't have one that works with the given compiler.
if GL_GENERATE_STDARG_H
stdarg.h: stdarg.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \
< $(srcdir)/stdarg.in.h; \
} > $@-t && \
mv $@-t $@
else
stdarg.h: $(top_builddir)/config.status
rm -f $@
endif
MOSTLYCLEANFILES += stdarg.h stdarg.h-t
EXTRA_DIST += stdarg.in.h
## end gnulib module stdarg
## begin gnulib module stdbool
BUILT_SOURCES += $(STDBOOL_H)
# We need the following in order to create <stdbool.h> when the system
# doesn't have one that works.
if GL_GENERATE_STDBOOL_H
stdbool.h: stdbool.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
} > $@-t && \
mv $@-t $@
else
stdbool.h: $(top_builddir)/config.status
rm -f $@
endif
MOSTLYCLEANFILES += stdbool.h stdbool.h-t
EXTRA_DIST += stdbool.in.h
## end gnulib module stdbool
## begin gnulib module stddef
BUILT_SOURCES += $(STDDEF_H)

View File

@ -1,3 +1,13 @@
2014-05-17 Paul Eggert <eggert@cs.ucla.edu>
Assume C99 or later (Bug#17487).
* bytecode.c (B__dummy__): Remove.
* conf_post.h (bool_bf) [!NS_IMPL_GNUSTEP]: Use bool.
(FLEXIBLE_ARRAY_MEMBER): Now always empty.
* dbusbind.c (XD_DEBUG_MESSAGE) [!DBUS_DEBUG]:
* regex.c (DEBUG_PRINT): Assume varargs macros.
* lisp.h (DEFUN_FUNCTION_INIT): Remove. All uses now assume C99.
2014-05-17 Fabrice Popineau <fabrice.popineau@gmail.com>
* buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Always map new

View File

@ -292,8 +292,6 @@ enum byte_code_op
Bscan_buffer = 0153, /* No longer generated as of v18. */
Bset_mark = 0163, /* this loser is no longer generated as of v18 */
#endif
B__dummy__ = 0 /* Pacify C89. */
};
/* Whether to maintain a `top' and `bottom' field in the stack frame. */

View File

@ -34,9 +34,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <stdbool.h>
/* The pre-C99 <stdbool.h> emulation doesn't work for bool bitfields.
Nor does compiling Objective-C with standard GCC. */
#if __STDC_VERSION__ < 199901 || NS_IMPL_GNUSTEP
/* The type of bool bitfields. Needed to compile Objective-C with
standard GCC. It was also needed to port to pre-C99 compilers,
although we don't care about that any more. */
#if NS_IMPL_GNUSTEP
typedef unsigned int bool_bf;
#else
typedef bool bool_bf;
@ -293,14 +294,11 @@ extern void _DebPrint (const char *fmt, ...);
/* To use the struct hack with N elements, declare the struct like this:
struct s { ...; t name[FLEXIBLE_ARRAY_MEMBER]; };
and allocate (offsetof (struct s, name) + N * sizeof (t)) bytes. */
#if 199901 <= __STDC_VERSION__
# define FLEXIBLE_ARRAY_MEMBER
#elif __GNUC__ && !defined __STRICT_ANSI__
# define FLEXIBLE_ARRAY_MEMBER 0
#else
# define FLEXIBLE_ARRAY_MEMBER 1
#endif
and allocate (offsetof (struct s, name) + N * sizeof (t)) bytes.
This macro used to expand to something different on pre-C99 compilers.
FIXME: Remove it, and remove all uses. */
#define FLEXIBLE_ARRAY_MEMBER
/* Use this to suppress gcc's `...may be used before initialized' warnings. */
#ifdef lint

View File

@ -142,10 +142,7 @@ static bool xd_in_read_queued_messages = 0;
} while (0)
#else /* !DBUS_DEBUG */
# if __STDC_VERSION__ < 199901
# define XD_DEBUG_MESSAGE (void) /* Pre-C99 compilers cannot debug. */
# else
# define XD_DEBUG_MESSAGE(...) \
# define XD_DEBUG_MESSAGE(...) \
do { \
if (!NILP (Vdbus_debug)) \
{ \
@ -154,7 +151,6 @@ static bool xd_in_read_queued_messages = 0;
message ("%s: %s", __func__, s); \
} \
} while (0)
# endif
# define XD_DEBUG_VALID_LISP_OBJECT_P(object)
#endif

View File

@ -214,7 +214,7 @@ int initial_argc;
static void sort_args (int argc, char **argv);
static void syms_of_emacs (void);
/* C89 needs each string be at most 509 characters, so the usage
/* C99 needs each string to be at most 4095 characters, and the usage
strings below are split to not overflow this limit. */
static char const *const usage_message[] =
{ "\

View File

@ -2654,16 +2654,11 @@ CHECK_NUMBER_CDR (Lisp_Object x)
minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
#else /* not _MSC_VER */
# if __STDC_VERSION__ < 199901
# define DEFUN_FUNCTION_INIT(fnname, maxargs) (Lisp_Object (*) (void)) fnname
# else
# define DEFUN_FUNCTION_INIT(fnname, maxargs) .a ## maxargs = fnname
# endif
#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
static struct Lisp_Subr alignas (GCALIGNMENT) sname = \
{ { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
{ DEFUN_FUNCTION_INIT (fnname, maxargs) }, \
{ .a ## maxargs = fnname }, \
minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
#endif

View File

@ -1190,12 +1190,7 @@ print_double_string (re_char *where, re_char *string1, ssize_t size1,
# define assert(e)
# define DEBUG_STATEMENT(e)
# if __STDC_VERSION__ < 199901L
# define DEBUG_COMPILES_ARGUMENTS
# define DEBUG_PRINT /* 'DEBUG_PRINT (x, y)' discards X and Y. */ (void)
# else
# define DEBUG_PRINT(...)
# endif
# define DEBUG_PRINT(...)
# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)