[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison output file should not second-guess autoconf re 'const'

From: Paul Eggert
Subject: Re: Bison output file should not second-guess autoconf re 'const'
Date: Mon, 20 Aug 2001 13:54:41 -0700 (PDT)

> From: Akim Demaille <address@hidden>
> Date: 20 Aug 2001 20:47:30 +0200
> I agree very much with this patch, as I already had to struggle
> against it.  But I fear some people still don't use Autoconf (shame on
> them :).  So maybe something like
> #ifndef HAVE_CONFIG_H
> #endif

But it should be immaterial as to whether `const' gets defined via
DEFS or via config.h.  That is how the autoconf documentation is
currently written.  We shouldn't break this nice property merely to
work around the `const' problem.

It's simpler just to remove the `const'.  Hardly anybody uses
compilers that don't support `const' any more.  The few people who
need to support K&R compilers can use autoconf; the extremely few
(no?) people who need to support K&R compilers and don't use autoconf
can easily put `-Dconst=' into their CFLAGS.

How about the following revised patch instead?  It documents things
a bit better.

2001-08-20  Paul Eggert  <address@hidden>

        * NEWS, src/output.c (output): Do not output a '#define const'
        line; that is the job for DEFS, or config.h, or whatever.

RCS file: NEWS,v
retrieving revision
retrieving revision
diff -pu -r1.28.3.0 -r1.28.3.2
--- NEWS        2001/08/15 07:56:19
+++ NEWS        2001/08/20 20:48:55
@@ -3,6 +3,11 @@ Bison News
 Changes in version 1.28c:
+* The output file does not redefine const, as this caused problems when used
+  with common autoconfiguration schemes.  If you still use ancient compilers
+  that lack const, compile with the equivalent of the C compiler option
+  `-Dconst='.  autoconf's AC_C_CONST macro provides one way to do this.
 * The Bison manual is now distributed under the terms of the GNU FDL.
 * The input and the output files has automatically a similar extension.
RCS file: src/output.c,v
retrieving revision
retrieving revision
diff -pu -r1.28.3.0 -r1.28.3.1
--- src/output.c        2001/08/13 14:20:01
+++ src/output.c        2001/08/17 23:28:50
@@ -1340,15 +1340,6 @@ output (void)
   if (!no_parser_flag)
     obstack_sgrow (&table_obstack, "#include <stdio.h>\n\n");
-  /* Make "const" do nothing if not in ANSI C.  */
-  obstack_sgrow (&table_obstack, "\
-#ifndef __cplusplus\n\
-# ifndef __STDC__\n\
-#  define const\n\
-# endif\n\
   free_itemsets ();
   output_defines ();
   output_token_translations ();

reply via email to

[Prev in Thread] Current Thread [Next in Thread]