unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17487: Assume C99 or later in trunk
@ 2014-05-14  1:11 Paul Eggert
       [not found] ` <handler.17487.B.140002995110175.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2014-05-14  1:11 UTC (permalink / raw)
  To: 17487

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

Tags: patch

For some time I have ported Emacs to C89 whenever developers 
inadvertently change the mainline C code to use features like 
declarations-after-statements that C89 prohibits.  It's time for me to 
stop doing this job, as it's no longer useful.  As far as I know, no 
current Emacs target lacks a compiler that supports the relevant 
features.  GCC has supported the features for many years, even decades, 
and key GNU packages such as Coreutils have assumed them for quite some 
time.

To help move this along and to simplify maintenance a bit, I would like 
to install the attached patches into the trunk.  We don't need wholesale 
changes to rewrite Emacs's C code to use C99 features, but on the other 
hand we no longer need to keep porting to C89 and these minimal changes 
will help remind us of that.

The first attached patch is the main one.  The second patch is 
automatically generated by 'admin/merge-gnulib'.

[-- Attachment #2: c99.diff --]
[-- Type: text/plain, Size: 9668 bytes --]

=== modified file 'ChangeLog'
--- ChangeLog	2014-05-13 14:18:54 +0000
+++ ChangeLog	2014-05-14 00:43:38 +0000
@@ -1,3 +1,12 @@
+2014-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+	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.
+	* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
+
 2014-05-13  Dmitry Antipov  <dmantipov@yandex.ru>
 
 	* configure.ac (HAVE_XFIXES): Define if available.

=== modified file 'admin/ChangeLog'
--- admin/ChangeLog	2014-05-13 23:15:01 +0000
+++ admin/ChangeLog	2014-05-14 00:43:38 +0000
@@ -1,3 +1,9 @@
+2014-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Assume C99 or later.
+	* merge-gnulib (GNULIB_MODULES): Remove stdarg, stdbool.
+	(GNULIB_TOOL_FLAGS): Avoid stdarg, stdbool.
+
 2014-05-13  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* merge-gnulib: Defer to autogen.sh for ACLOCAL_PATH computation.

=== modified file 'admin/merge-gnulib'
--- admin/merge-gnulib	2014-05-13 23:15:01 +0000
+++ admin/merge-gnulib	2014-05-14 00:43:38 +0000
@@ -35,7 +35,7 @@
   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 @@
   --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

=== modified file 'configure.ac'
--- configure.ac	2014-05-13 14:18:54 +0000
+++ configure.ac	2014-05-14 00:43:38 +0000
@@ -670,6 +670,9 @@
 
 #### Choose a compiler.
 
+dnl Don't bother to test for C89, as Emacs needs C99 or later.
+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
@@ -1303,7 +1306,7 @@
   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])

=== modified file 'doc/lispref/ChangeLog'
--- doc/lispref/ChangeLog	2014-05-08 03:41:21 +0000
+++ doc/lispref/ChangeLog	2014-05-14 00:43:38 +0000
@@ -1,3 +1,8 @@
+2014-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Assume C99 or later.
+	* internals.texi (C Dialect): Document this.
+
 2014-05-08  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* internals.texi (C Dialect): New section.

=== modified file 'doc/lispref/internals.texi'
--- doc/lispref/internals.texi	2014-05-08 03:41:21 +0000
+++ doc/lispref/internals.texi	2014-05-14 00:43:38 +0000
@@ -580,15 +580,14 @@
 @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

=== modified file 'etc/ChangeLog'
--- etc/ChangeLog	2014-05-13 11:12:05 +0000
+++ etc/ChangeLog	2014-05-14 01:06:42 +0000
@@ -1,3 +1,7 @@
+2014-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* NEWS: Assume C99 or later.
+
 2014-05-13  Dmitry Antipov  <dmantipov@yandex.ru>
 
 	* PROBLEMS: Mention potential problems with

=== modified file 'etc/NEWS'
--- etc/NEWS	2014-05-04 23:49:33 +0000
+++ etc/NEWS	2014-05-14 01:06:42 +0000
@@ -25,6 +25,8 @@
 * 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

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2014-05-13 22:59:36 +0000
+++ src/ChangeLog	2014-05-14 00:43:38 +0000
@@ -1,3 +1,13 @@
+2014-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Assume C99 or later.
+	* 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-13  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* keyboard.c (Qdeactivate_mark): Now static.

=== modified file 'src/bytecode.c'
--- src/bytecode.c	2014-04-13 02:51:11 +0000
+++ src/bytecode.c	2014-05-14 00:43:38 +0000
@@ -292,8 +292,6 @@
     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.  */

=== modified file 'src/conf_post.h'
--- src/conf_post.h	2014-04-23 18:23:28 +0000
+++ src/conf_post.h	2014-05-14 00:43:38 +0000
@@ -34,9 +34,10 @@
 
 #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 @@
 
 /* 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

=== modified file 'src/dbusbind.c'
--- src/dbusbind.c	2014-02-27 15:36:14 +0000
+++ src/dbusbind.c	2014-05-14 00:43:38 +0000
@@ -142,10 +142,7 @@
   } 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 @@
 	message ("%s: %s", __func__, s);				\
       }									\
   } while (0)
-# endif
 # define XD_DEBUG_VALID_LISP_OBJECT_P(object)
 #endif
 

=== modified file 'src/emacs.c'
--- src/emacs.c	2014-04-18 23:36:51 +0000
+++ src/emacs.c	2014-05-14 00:43:38 +0000
@@ -214,7 +214,7 @@
 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[] =
   { "\

=== modified file 'src/lisp.h'
--- src/lisp.h	2014-04-28 16:59:41 +0000
+++ src/lisp.h	2014-05-14 00:43:38 +0000
@@ -2654,16 +2654,11 @@
        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

=== modified file 'src/regex.c'
--- src/regex.c	2014-04-28 01:29:44 +0000
+++ src/regex.c	2014-05-14 00:43:38 +0000
@@ -1190,12 +1190,7 @@
 # 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)
 


[-- Attachment #3: c99-auto.diff --]
[-- Type: text/plain, Size: 18617 bytes --]

=== modified file 'lib/gnulib.mk'
--- lib/gnulib.mk	2014-03-07 18:57:11 +0000
+++ lib/gnulib.mk	2014-05-14 00:43:38 +0000
@@ -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 @@
 
 ## 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)

=== removed file 'lib/stdarg.in.h'
--- lib/stdarg.in.h	2014-01-01 07:43:34 +0000
+++ lib/stdarg.in.h	1970-01-01 00:00:00 +0000
@@ -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 */

=== removed file 'lib/stdbool.in.h'
--- lib/stdbool.in.h	2014-01-01 07:43:34 +0000
+++ lib/stdbool.in.h	1970-01-01 00:00:00 +0000
@@ -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 */

=== modified file 'm4/gnulib-comp.m4'
--- m4/gnulib-comp.m4	2014-03-07 18:57:11 +0000
+++ m4/gnulib-comp.m4	2014-05-14 00:43:38 +0000
@@ -119,13 +119,6 @@
   # 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 @@
   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 @@
   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 @@
   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

=== removed file 'm4/stdarg.m4'
--- m4/stdarg.m4	2014-01-01 07:43:34 +0000
+++ m4/stdarg.m4	1970-01-01 00:00:00 +0000
@@ -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])
-])

=== removed file 'm4/stdbool.m4'
--- m4/stdbool.m4	2014-01-01 07:43:34 +0000
+++ m4/stdbool.m4	1970-01-01 00:00:00 +0000
@@ -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])
-])


^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#17487: Assume C99 or later in trunk
       [not found] ` <handler.17487.B.140002995110175.ack@debbugs.gnu.org>
@ 2014-05-14 15:17   ` Paul Eggert
  2014-05-14 15:36     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2014-05-14 15:17 UTC (permalink / raw)
  To: 17487

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

In further testing I found that Automake complains unless the 
corresponding change is also made to nt/gnulib.mk, so I'll also throw in 
the attached simplification to fix that problem.



[-- Attachment #2: nt.diff --]
[-- Type: text/plain, Size: 2119 bytes --]

=== modified file 'nt/ChangeLog'
--- nt/ChangeLog	2014-05-05 10:06:04 +0000
+++ nt/ChangeLog	2014-05-14 15:13:25 +0000
@@ -1,3 +1,8 @@
+2014-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Assume C99 or later (Bug#17487).
+	* gnulib.mk: Remove stdarg and stdbool modules.
+
 2014-05-05  Eli Zaretskii  <eliz@gnu.org>
 
 	* INSTALL: Update to the effect that pkg-config is now required

=== modified file 'nt/gnulib.mk'
--- nt/gnulib.mk	2014-01-01 07:43:34 +0000
+++ nt/gnulib.mk	2014-05-14 15:08:34 +0000
@@ -671,57 +671,6 @@
 
 ## 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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#17487: Assume C99 or later in trunk
  2014-05-14 15:17   ` Paul Eggert
@ 2014-05-14 15:36     ` Eli Zaretskii
  2014-05-17  8:14       ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2014-05-14 15:36 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 17487

> Date: Wed, 14 May 2014 08:17:35 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> 
> In further testing I found that Automake complains unless the 
> corresponding change is also made to nt/gnulib.mk, so I'll also throw in 
> the attached simplification to fix that problem.

Thanks, it looks good to me.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#17487: Assume C99 or later in trunk
  2014-05-14 15:36     ` Eli Zaretskii
@ 2014-05-17  8:14       ` Paul Eggert
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2014-05-17  8:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 17487-done

Eli Zaretskii wrote:
> Thanks, it looks good to me.

Thanks, I tested it and tweaked it a bit more and installed it as trunk 
bzr 117119.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-17  8:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14  1:11 bug#17487: Assume C99 or later in trunk Paul Eggert
     [not found] ` <handler.17487.B.140002995110175.ack@debbugs.gnu.org>
2014-05-14 15:17   ` Paul Eggert
2014-05-14 15:36     ` Eli Zaretskii
2014-05-17  8:14       ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).