]> git.saurik.com Git - bison.git/blobdiff - data/yacc.c
Be a bit more systematic about using 'abort'.
[bison.git] / data / yacc.c
index 3a9314dbf86f612d0d317ec3a5a6863533a8b571..ecdcda996c18971434cc329549233ec2bdd2dfec 100644 (file)
@@ -2,7 +2,7 @@ m4_divert(-1)                                                -*- C -*-
 
 # Yacc compatible skeleton for Bison
 
-# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -20,7 +20,7 @@ m4_divert(-1)                                                -*- C -*-
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301  USA
 
-
+m4_include(b4_pkgdatadir/[c.m4])
 
 ## ---------------- ##
 ## Default values.  ##
@@ -135,7 +135,7 @@ m4_changecom()
 m4_divert(0)dnl
 @output @output_parser_name@
 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
-             [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])[
+  [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[
 
 /* As a special exception, when this file is copied by Bison into a
    Bison output file, you may use that output file without restriction.
@@ -189,10 +189,11 @@ b4_location_if([#define yylloc b4_prefix[]lloc])])[
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 ]m4_ifdef([b4_stype],
-[b4_syncline([b4_stype_line], [b4_file_name])
-typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
+[typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])
+b4_stype
 /* Line __line__ of yacc.c.  */
-b4_syncline([@oline@], [@ofile@])],
+b4_syncline([@oline@], [@ofile@])
+       YYSTYPE;],
 [typedef int YYSTYPE;])[
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -219,25 +220,12 @@ typedef struct YYLTYPE
 /* Line __line__ of yacc.c.  */
 b4_syncline([@oline@], [@ofile@])[
 
-/* Define YYMODERN_C if this compiler supports C89 or better.  If
-   __STDC__ is defined, the compiler is modern.  IBM xlc 7.0 when run
-   as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
-   reasons, but it defines __C99__FUNC__ so check that as well.
-   Consider a C++ compiler to be modern if it defines __cplusplus.  */
-#ifndef YYMODERN_C
-# if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
-#  define YYMODERN_C 1
-# else
-#  define YYMODERN_C 0
-# endif
-#endif
-
 #ifndef YYSIZE_T
 # if defined (__SIZE_TYPE__)
 #  define YYSIZE_T __SIZE_TYPE__
 # elif defined (size_t)
 #  define YYSIZE_T size_t
-# elif ! defined (YYSIZE_T) && YYMODERN_C
+# elif ! defined (YYSIZE_T) && ]b4_c_modern[
 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
@@ -260,7 +248,7 @@ b4_syncline([@oline@], [@ofile@])[
 #endif
 
 /* Suppress unused-variable warnings by "using" E.  */
-#ifndef lint
+#if !defined (lint) || defined (__GNUC__)
 # define YYUSE(e) ((void) (e))
 #else
 # define YYUSE(e) /* empty */
@@ -293,7 +281,7 @@ b4_syncline([@oline@], [@ofile@])[
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined (_ALLOCA_H) && ! defined (_STDLIB_H) && YYMODERN_C
+#    if ! defined (_ALLOCA_H) && ! defined (_STDLIB_H) && ]b4_c_modern[
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 #     ifndef _STDLIB_H
 #      define _STDLIB_H 1
@@ -311,7 +299,7 @@ b4_syncline([@oline@], [@ofile@])[
        and a page size can be as small as 4096 bytes.  So we cannot safely
        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
        to allow for a few compiler-allocated temporary stack slots.  */
-#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
 #  endif
 # else
 #  define YYSTACK_ALLOC YYMALLOC
@@ -324,13 +312,13 @@ extern "C" {
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined (malloc) && ! defined (_STDLIB_H) && YYMODERN_C
+#   if ! defined (malloc) && ! defined (_STDLIB_H) && ]b4_c_modern[
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined (free) && ! defined (_STDLIB_H)  && YYMODERN_C
+#   if ! defined (free) && ! defined (_STDLIB_H) && ]b4_c_modern[
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
@@ -404,7 +392,7 @@ union yyalloc
 
 #endif
 
-#if YYMODERN_C
+#if ]b4_c_modern[
    typedef signed char yysigned_char;
 #else
    typedef short int yysigned_char;
@@ -746,13 +734,8 @@ int yydebug;
 #   define yystrlen strlen
 #  else
 /* Return the length of YYSTR.  */
-static YYSIZE_T
-#   if YYMODERN_C
-yystrlen (const char *yystr)
-#   else
-yystrlen (yystr)
-     const char *yystr;
-#   endif
+]b4_c_function_def([yystrlen], [static YYSIZE_T],
+   [[const char *yystr], [yystr]])[
 {
   YYSIZE_T yylen;
   for (yylen = 0; yystr[yylen]; yylen++)
@@ -768,14 +751,8 @@ yystrlen (yystr)
 #  else
 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
    YYDEST.  */
-static char *
-#   if YYMODERN_C
-yystpcpy (char *yydest, const char *yysrc)
-#   else
-yystpcpy (yydest, yysrc)
-     char *yydest;
-     const char *yysrc;
-#   endif
+]b4_c_function_def([yystpcpy], [static char *],
+   [[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[
 {
   char *yyd = yydest;
   const char *yys = yysrc;
@@ -952,11 +929,8 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
 /* Prevent warnings from -Wmissing-prototypes.  */
 
 #ifdef YYPARSE_PARAM
-# if YYMODERN_C
-int yyparse (void *YYPARSE_PARAM);
-# else
-int yyparse ();
-# endif
+]b4_c_function_decl([yyparse], [int],
+   [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
 #else /* ! YYPARSE_PARAM */
 ]b4_c_function_decl([yyparse], [int], b4_parse_param)[
 #endif /* ! YYPARSE_PARAM */
@@ -990,12 +964,7 @@ b4_pure_if([],
 `----------*/
 
 #ifdef YYPARSE_PARAM
-# if YYMODERN_C
-int yyparse (void *YYPARSE_PARAM)
-# else
-int yyparse (YYPARSE_PARAM)
-  void *YYPARSE_PARAM;
-# endif
+b4_c_function_def([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])
 #else /* ! YYPARSE_PARAM */
 b4_c_function_def([yyparse], [int], b4_parse_param)
 #endif
@@ -1497,7 +1466,7 @@ b4_epilogue
 m4_if(b4_defines_flag, 0, [],
 [@output @output_header_name@
 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
-             [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])
+  [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])
 
 /* As a special exception, when this file is copied by Bison into a
    Bison output file, you may use that output file without restriction.
@@ -1508,10 +1477,11 @@ b4_token_enums_defines(b4_tokens)
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 m4_ifdef([b4_stype],
-[b4_syncline([b4_stype_line], [b4_file_name])
-typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
+[typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])
+b4_stype
 /* Line __line__ of yacc.c.  */
-b4_syncline([@oline@], [@ofile@])],
+b4_syncline([@oline@], [@ofile@])
+       YYSTYPE;],
 [typedef int YYSTYPE;])
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1