[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison'd files don't compile under Microsoft VC++
From: |
Paul Eggert |
Subject: |
Re: bison'd files don't compile under Microsoft VC++ |
Date: |
Wed, 13 Feb 2002 15:42:05 -0800 (PST) |
> Date: Wed, 13 Feb 2002 23:42:05 +0100
> From: Hans Aberg <address@hidden>
>
> It is not so difficult to fix:
That may well be, but given the latest hassle with Microsoft compilers
I now tend to agree with Akim that it is not worth the aggravation.
We've spent too much time worrying about C++ namespace cleanliness in
what is basically a C parser, and it's causing more problems than it's
curing. We should defer worring about C++ namespace issues until we
have a proper C++ parser.
You were right all along, Akim. :-)
Here is a proposed patch to implement this; basically, it reverts the
C++ stuff to the situation as of 2001-12-12, except that it removes an
inconsistency with YYPARSE_PARAM_ARG and YYPARSE_PARAM_DECL (C++
should be treated the same as __STDC__ there, just as it is
elsewhere).
2002-02-13 Paul Eggert <address@hidden>
Remove the support for C++ namespace cleanliness; it was
causing more problems than it was curing, since it didn't work
properly on some older, nonstandard C++ compilers. This can wait
for a proper C++ parser.
* doc/bison.texinfo (Bison Parser, Debugging): Remove special mention
of C++, as it's treated like C now.
* src/bison.simple (YYSTD): Remove.
(YYSIZE_T, YYFPRINTF, YYPARSE_PARAM_ARG, YYPARSE_PARAM_DECL):
Treat C++ just like Standard C instead of trying to support
namespace cleanliness.
diff -pru bison-1_29-branch/doc/bison.texinfo
bison-1_29-branch-no-cpp/doc/bison.texinfo
--- bison-1_29-branch/doc/bison.texinfo Wed Feb 13 15:08:06 2002
+++ bison-1_29-branch-no-cpp/doc/bison.texinfo Wed Feb 13 15:21:17 2002
@@ -708,8 +708,7 @@ In some cases the Bison parser file incl
those cases your code should respect the identifiers reserved by those
headers. On some address@hidden hosts, @code{<alloca.h>},
@code{<stddef.h>}, and @code{<stdlib.h>} are included as needed to
-declare memory allocators and related types. In the same situation,
-C++ parsers may include @code{<cstddef>} and @code{<cstdlib>} instead.
+declare memory allocators and related types.
Other system headers may be included if you define @code{YYDEBUG} to a
nonzero value (@pxref{Debugging, ,Debugging Your Parser}).
@@ -4941,9 +4940,7 @@ The trace facility outputs messages with
@var{format} and @var{args} are the usual @code{printf} format and
arguments. If you define @code{YYDEBUG} to a nonzero value but do not
define @code{YYFPRINTF}, @code{<stdio.h>} is automatically included
-and @code{YYPRINTF} is defined to @code{fprintf}. In the same
-situation, C++ parsers include @code{<cstdio>} and use
address@hidden::fprintf} instead.
+and @code{YYPRINTF} is defined to @code{fprintf}.
Once you have compiled the program with trace facilities, the way to
request a trace is to store a nonzero value in the variable @code{yydebug}.
diff -pru bison-1_29-branch/src/bison.simple
bison-1_29-branch-no-cpp/src/bison.simple
--- bison-1_29-branch/src/bison.simple Tue Jan 29 05:48:14 2002
+++ bison-1_29-branch-no-cpp/src/bison.simple Wed Feb 13 15:19:07 2002
@@ -37,12 +37,6 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
-#ifdef __cplusplus
-# define YYSTD(x) std::x
-#else
-# define YYSTD(x) x
-#endif
-
#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -65,17 +59,12 @@
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
-# ifdef __cplusplus
-# include <cstdlib> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T std::size_t
-# else
-# ifdef __STDC__
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
# endif
-# define YYSTACK_ALLOC YYSTD (malloc)
-# define YYSTACK_FREE YYSTD (free)
+# define YYSTACK_ALLOC malloc
+# define YYSTACK_FREE free
# endif
/* A type that is properly aligned for any stack member. */
@@ -130,14 +119,9 @@ union yyalloc
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
-# ifdef __cplusplus
-# include <cstddef> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T std::size_t
-# else
-# ifdef __STDC__
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
@@ -216,12 +200,8 @@ while (0)
#if YYDEBUG
# ifndef YYFPRINTF
-# ifdef __cplusplus
-# include <cstdio> /* INFRINGES ON USER NAME SPACE */
-# else
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# endif
-# define YYFPRINTF YYSTD (fprintf)
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
@@ -346,13 +326,13 @@ yystpcpy (yydest, yysrc)
to the proper pointer type. */
#ifdef YYPARSE_PARAM
-# ifdef __cplusplus
+# if defined (__STDC__) || defined (__cplusplus)
# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
# define YYPARSE_PARAM_DECL
-# else /* !__cplusplus */
+# else
# define YYPARSE_PARAM_ARG YYPARSE_PARAM
# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-# endif /* !__cplusplus */
+# endif
#else /* !YYPARSE_PARAM */
# define YYPARSE_PARAM_ARG
# define YYPARSE_PARAM_DECL
- Re: bison'd files don't compile under Microsoft VC++, (continued)
- Re: bison'd files don't compile under Microsoft VC++, Paul Eggert, 2002/02/14
- Re: bison'd files don't compile under Microsoft VC++, Hans Aberg, 2002/02/14
- Message not available
- Re: bison'd files don't compile under Microsoft VC++, Hans Aberg, 2002/02/14
- Re: bison'd files don't compile under Microsoft VC++, Hans Aberg, 2002/02/14
- Re: bison'd files don't compile under Microsoft VC++, Paul Eggert, 2002/02/14
- Re: bison'd files don't compile under Microsoft VC++, Hans Aberg, 2002/02/14
Re: bison'd files don't compile under Microsoft VC++, Pascal Bart, 2002/02/13
Re: bison'd files don't compile under Microsoft VC++, Hans Aberg, 2002/02/13
Re: bison'd files don't compile under Microsoft VC++, Akim Demaille, 2002/02/14
Re: bison'd files don't compile under Microsoft VC++, David Gluss, 2002/02/13
Re: bison'd files don't compile under Microsoft VC++, Paul Eggert, 2002/02/13
Re: bison'd files don't compile under Microsoft VC++, David Gluss, 2002/02/13
Re: bison'd files don't compile under Microsoft VC++, Akim Demaille, 2002/02/14
Re: bison'd files don't compile under Microsoft VC++, David Gluss, 2002/02/14
Re: bison'd files don't compile under Microsoft VC++, Hans Aberg, 2002/02/14
Re: bison'd files don't compile under Microsoft VC++, David Gluss, 2002/02/14