mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Use 'short int' rather than 'short', and similarly for 'long', 'unsigned', etc.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
m4_divert(-1) -*- Autoconf -*-
|
||||
|
||||
# C M4 Macros for Bison.
|
||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004 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
|
||||
@@ -114,8 +114,8 @@ m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
||||
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short int],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||
|
||||
|
||||
38
data/glr.c
38
data/glr.c
@@ -137,7 +137,7 @@ m4_define([b4_rhs_location],
|
||||
m4_changecom()
|
||||
m4_divert(0)dnl
|
||||
@output @output_parser_name@
|
||||
b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003])
|
||||
b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003, 2004])
|
||||
[
|
||||
/* This is the parser code for GLR (Generalized LR) parser. */
|
||||
|
||||
@@ -282,7 +282,7 @@ b4_syncline([@oline@], [@ofile@])
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((YYX <= 0) ? YYEOF : \
|
||||
(unsigned)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
(unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
|
||||
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||||
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
||||
@@ -394,9 +394,9 @@ static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
|
||||
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
|
||||
0, pointed into by YYCONFLP. */
|
||||
]dnl Do not use b4_int_type_for here, since there are places where
|
||||
dnl pointers onto yyconfl are taken, which type is "short *".
|
||||
dnl pointers onto yyconfl are taken, which type is "short int *".
|
||||
dnl We probably ought to introduce a type for confl.
|
||||
[static const short yyconfl[] =
|
||||
[static const short int yyconfl[] =
|
||||
{
|
||||
]b4_conflicting_rules[
|
||||
};
|
||||
@@ -552,10 +552,10 @@ typedef int yyStateNum;
|
||||
typedef int yyRuleNum;
|
||||
|
||||
/** Grammar symbol */
|
||||
typedef short yySymbol;
|
||||
typedef short int yySymbol;
|
||||
|
||||
/** Item references, as in LALR(1) machine */
|
||||
typedef short yyItemNum;
|
||||
typedef short int yyItemNum;
|
||||
|
||||
typedef struct yyGLRState yyGLRState;
|
||||
typedef struct yySemanticOption yySemanticOption;
|
||||
@@ -809,7 +809,7 @@ yydefaultAction (yyStateNum yystate)
|
||||
*/
|
||||
static inline void
|
||||
yygetLRActions (yyStateNum yystate, int yytoken,
|
||||
int* yyaction, const short** yyconflicts)
|
||||
int* yyaction, const short int** yyconflicts)
|
||||
{
|
||||
int yyindex = yypact[yystate] + yytoken;
|
||||
if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
||||
@@ -1539,7 +1539,7 @@ yyprocessOneStack (yyGLRStack* yystack, int yyk,
|
||||
]b4_user_formals[)
|
||||
{
|
||||
int yyaction;
|
||||
const short* yyconflicts;
|
||||
const short int* yyconflicts;
|
||||
yyRuleNum yyrule;
|
||||
yySymbol* const yytokenp = yystack->yytokenp;
|
||||
|
||||
@@ -1840,7 +1840,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
|
||||
{
|
||||
yyRuleNum yyrule;
|
||||
int yyaction;
|
||||
const short* yyconflicts;
|
||||
const short int* yyconflicts;
|
||||
|
||||
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
|
||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||
@@ -1942,7 +1942,7 @@ yy_yypstack (yyGLRState* yys)
|
||||
yy_yypstack (yys->yypred);
|
||||
fprintf (stderr, " -> ");
|
||||
}
|
||||
fprintf (stderr, "%d@@%lu", yys->yylrState, (unsigned long) yys->yyposn);
|
||||
fprintf (stderr, "%d@@%lu", yys->yylrState, (unsigned long int) yys->yyposn);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1972,30 +1972,30 @@ yypdumpstack (yyGLRStack* yystack)
|
||||
size_t yyi;
|
||||
for (yyp = yystack->yyitems; yyp < yystack->yynextFree; yyp += 1)
|
||||
{
|
||||
fprintf (stderr, "%3lu. ", (unsigned long) (yyp - yystack->yyitems));
|
||||
fprintf (stderr, "%3lu. ", (unsigned long int) (yyp - yystack->yyitems));
|
||||
if (*(yybool *) yyp)
|
||||
{
|
||||
fprintf (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
|
||||
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
||||
(unsigned long) yyp->yystate.yyposn,
|
||||
(long) YYINDEX (yyp->yystate.yypred));
|
||||
(unsigned long int) yyp->yystate.yyposn,
|
||||
(long int) YYINDEX (yyp->yystate.yypred));
|
||||
if (! yyp->yystate.yyresolved)
|
||||
fprintf (stderr, ", firstVal: %ld",
|
||||
(long) YYINDEX (yyp->yystate.yysemantics.yyfirstVal));
|
||||
(long int) YYINDEX (yyp->yystate.yysemantics.yyfirstVal));
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Option. rule: %d, state: %ld, next: %ld",
|
||||
yyp->yyoption.yyrule,
|
||||
(long) YYINDEX (yyp->yyoption.yystate),
|
||||
(long) YYINDEX (yyp->yyoption.yynext));
|
||||
(long int) YYINDEX (yyp->yyoption.yystate),
|
||||
(long int) YYINDEX (yyp->yyoption.yynext));
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
fprintf (stderr, "Tops:");
|
||||
for (yyi = 0; yyi < yystack->yytops.yysize; yyi += 1)
|
||||
fprintf (stderr, "%lu: %ld; ", (unsigned long) yyi,
|
||||
(long) YYINDEX (yystack->yytops.yystates[yyi]));
|
||||
fprintf (stderr, "%lu: %ld; ", (unsigned long int) yyi,
|
||||
(long int) YYINDEX (yystack->yytops.yystates[yyi]));
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
]
|
||||
@@ -2003,7 +2003,7 @@ yypdumpstack (yyGLRStack* yystack)
|
||||
b4_epilogue
|
||||
m4_if(b4_defines_flag, 0, [],
|
||||
[@output @output_header_name@
|
||||
b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003])
|
||||
b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003, 2004])
|
||||
|
||||
b4_token_defines(b4_tokens)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
m4_divert(-1)
|
||||
# C++ skeleton for Bison
|
||||
# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2003, 2004 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
|
||||
@@ -128,7 +128,7 @@ m4_divert(0)dnl
|
||||
m4_if(b4_defines_flag, 0, [],
|
||||
[@output @output_header_name@
|
||||
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
|
||||
[2002, 2003])[
|
||||
[2002, 2003, 2004])[
|
||||
/* FIXME: This is wrong, we want computed header guards.
|
||||
I don't know why the macros are missing now. :( */
|
||||
#ifndef PARSER_HEADER_H
|
||||
@@ -291,7 +291,7 @@ namespace yy
|
||||
static const int terror_;
|
||||
static const int errcode_;
|
||||
static const int ntokens_;
|
||||
static const unsigned user_token_number_max_;
|
||||
static const unsigned int user_token_number_max_;
|
||||
static const TokenNumberType undef_token_;
|
||||
|
||||
/* State. */
|
||||
@@ -334,7 +334,7 @@ namespace yy
|
||||
])dnl
|
||||
@output @output_parser_name@
|
||||
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
|
||||
[2002, 2003])
|
||||
[2002, 2003, 2004])
|
||||
|
||||
m4_if(b4_defines_flag, 0, [], [#include @output_header_name@])[
|
||||
|
||||
@@ -885,7 +885,7 @@ yy::]b4_parser_class_name[::translate_ (int token)
|
||||
{
|
||||
]b4_translate[
|
||||
};
|
||||
if ((unsigned) token <= user_token_number_max_)
|
||||
if ((unsigned int) token <= user_token_number_max_)
|
||||
return translate_table[token];
|
||||
else
|
||||
return undef_token_;
|
||||
@@ -900,13 +900,13 @@ const int yy::]b4_parser_class_name[::terror_ = 1;
|
||||
const int yy::]b4_parser_class_name[::errcode_ = 256;
|
||||
const int yy::]b4_parser_class_name[::ntokens_ = ]b4_tokens_number[;
|
||||
|
||||
const unsigned yy::]b4_parser_class_name[::user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const unsigned int yy::]b4_parser_class_name[::user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const yy::]b4_parser_class_name[::TokenNumberType yy::]b4_parser_class_name[::undef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
]b4_epilogue
|
||||
dnl
|
||||
@output stack.hh
|
||||
b4_copyright([Stack handling for Bison C++ parsers], [2002, 2003])[
|
||||
b4_copyright([Stack handling for Bison C++ parsers], [2002, 2003, 2004])[
|
||||
|
||||
#ifndef BISON_STACK_HH
|
||||
# define BISON_STACK_HH
|
||||
@@ -927,20 +927,20 @@ namespace yy
|
||||
{
|
||||
}
|
||||
|
||||
Stack (unsigned n) : seq_ (n)
|
||||
Stack (unsigned int n) : seq_ (n)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
T&
|
||||
operator [] (unsigned i)
|
||||
operator [] (unsigned int i)
|
||||
{
|
||||
return seq_[i];
|
||||
}
|
||||
|
||||
inline
|
||||
const T&
|
||||
operator [] (unsigned i) const
|
||||
operator [] (unsigned int i) const
|
||||
{
|
||||
return seq_[i];
|
||||
}
|
||||
@@ -954,14 +954,14 @@ namespace yy
|
||||
|
||||
inline
|
||||
void
|
||||
pop (unsigned n = 1)
|
||||
pop (unsigned int n = 1)
|
||||
{
|
||||
for (; n; --n)
|
||||
seq_.pop_front ();
|
||||
}
|
||||
|
||||
inline
|
||||
unsigned
|
||||
unsigned int
|
||||
height () const
|
||||
{
|
||||
return seq_.size ();
|
||||
@@ -981,14 +981,14 @@ namespace yy
|
||||
public:
|
||||
|
||||
Slice (const S& stack,
|
||||
unsigned range) : stack_ (stack),
|
||||
range_ (range)
|
||||
unsigned int range) : stack_ (stack),
|
||||
range_ (range)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
const T&
|
||||
operator [] (unsigned i) const
|
||||
operator [] (unsigned int i) const
|
||||
{
|
||||
return stack_[range_ - i];
|
||||
}
|
||||
@@ -996,14 +996,14 @@ namespace yy
|
||||
private:
|
||||
|
||||
const S& stack_;
|
||||
unsigned range_;
|
||||
unsigned int range_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // not BISON_STACK_HH]
|
||||
dnl
|
||||
@output position.hh
|
||||
b4_copyright([Position class for Bison C++ parsers], [2002, 2003])[
|
||||
b4_copyright([Position class for Bison C++ parsers], [2002, 2003, 2004])[
|
||||
|
||||
/**
|
||||
** \file position.hh
|
||||
@@ -1116,7 +1116,7 @@ namespace yy
|
||||
}
|
||||
#endif // not BISON_POSITION_HH]
|
||||
@output location.hh
|
||||
b4_copyright([Location class for Bison C++ parsers], [2002, 2003])[
|
||||
b4_copyright([Location class for Bison C++ parsers], [2002, 2003, 2004])[
|
||||
|
||||
/**
|
||||
** \file location.hh
|
||||
@@ -1187,7 +1187,7 @@ namespace yy
|
||||
}
|
||||
|
||||
/** \brief Add two Location objects */
|
||||
inline const Location operator+ (const Location& begin, unsigned width)
|
||||
inline const Location operator+ (const Location& begin, unsigned int width)
|
||||
{
|
||||
Location res = begin;
|
||||
res.columns (width);
|
||||
@@ -1195,7 +1195,7 @@ namespace yy
|
||||
}
|
||||
|
||||
/** \brief Add and assign a Location */
|
||||
inline Location &operator+= (Location& res, unsigned width)
|
||||
inline Location &operator+= (Location& res, unsigned int width)
|
||||
{
|
||||
res.columns (width);
|
||||
return res;
|
||||
|
||||
32
data/yacc.c
32
data/yacc.c
@@ -1,7 +1,7 @@
|
||||
m4_divert(-1) -*- C -*-
|
||||
|
||||
# Yacc compatible skeleton for Bison
|
||||
# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003
|
||||
# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -76,8 +76,8 @@ m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||
b4_ints_in($@, [-128], [127]), [1], [yysigned_char],
|
||||
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short int],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||
|
||||
@@ -134,7 +134,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])[
|
||||
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])[
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
@@ -261,7 +261,7 @@ b4_syncline([@oline@], [@ofile@])[
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
{
|
||||
short yyss;
|
||||
short int yyss;
|
||||
YYSTYPE yyvs;
|
||||
]b4_location_if([ YYLTYPE yyls;
|
||||
])dnl
|
||||
@@ -274,10 +274,10 @@ union yyalloc
|
||||
N elements. */
|
||||
]b4_location_if(
|
||||
[# define YYSTACK_BYTES(N) \
|
||||
((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
|
||||
((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
|
||||
+ 2 * YYSTACK_GAP_MAXIMUM)],
|
||||
[# define YYSTACK_BYTES(N) \
|
||||
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
|
||||
((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
|
||||
+ YYSTACK_GAP_MAXIMUM)])[
|
||||
|
||||
/* Copy COUNT objects from FROM to TO. The source and destination do
|
||||
@@ -319,7 +319,7 @@ union yyalloc
|
||||
#if defined (__STDC__) || defined (__cplusplus)
|
||||
typedef signed char yysigned_char;
|
||||
#else
|
||||
typedef short yysigned_char;
|
||||
typedef short int yysigned_char;
|
||||
#endif
|
||||
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
@@ -560,8 +560,8 @@ do { \
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
]b4_c_function_def([yy_stack_print], [static void],
|
||||
[[short *bottom], [bottom]],
|
||||
[[short *top], [top]])[
|
||||
[[short int *bottom], [bottom]],
|
||||
[[short int *top], [top]])[
|
||||
{
|
||||
YYFPRINTF (stderr, "Stack now");
|
||||
for (/* Nothing. */; bottom <= top; ++bottom)
|
||||
@@ -763,9 +763,9 @@ b4_c_function_def([yyparse], [int], b4_parse_param)
|
||||
to reallocate them elsewhere. */
|
||||
|
||||
/* The state stack. */
|
||||
short yyssa[YYINITDEPTH];
|
||||
short *yyss = yyssa;
|
||||
register short *yyssp;
|
||||
short int yyssa[YYINITDEPTH];
|
||||
short int *yyss = yyssa;
|
||||
register short int *yyssp;
|
||||
|
||||
/* The semantic value stack. */
|
||||
YYSTYPE yyvsa[YYINITDEPTH];
|
||||
@@ -842,7 +842,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
|
||||
these so that the &'s don't force the real ones into
|
||||
memory. */
|
||||
YYSTYPE *yyvs1 = yyvs;
|
||||
short *yyss1 = yyss;
|
||||
short int *yyss1 = yyss;
|
||||
]b4_location_if([ YYLTYPE *yyls1 = yyls;])[
|
||||
|
||||
/* Each stack pointer address is followed by the size of the
|
||||
@@ -870,7 +870,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
|
||||
yystacksize = YYMAXDEPTH;
|
||||
|
||||
{
|
||||
short *yyss1 = yyss;
|
||||
short int *yyss1 = yyss;
|
||||
union yyalloc *yyptr =
|
||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||
if (! yyptr)
|
||||
@@ -1241,7 +1241,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])
|
||||
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
|
||||
Reference in New Issue
Block a user