Use inline for small operations.

* data/lalr1.cc (symbol_base_type, symbol_type)
	(stack_symbol_type): Declare constructor and other operations as
	inline.
	(yy_destroy_): Inline.
This commit is contained in:
Akim Demaille
2008-08-02 22:04:05 +02:00
parent 1f7d007bf6
commit d3be4f6d42
2 changed files with 19 additions and 11 deletions

View File

@@ -1,3 +1,11 @@
2008-11-09 Akim Demaille <demaille@gostai.com>
Use inline for small operations.
* data/lalr1.cc (symbol_base_type, symbol_type)
(stack_symbol_type): Declare constructor and other operations as
inline.
(yy_destroy_): Inline.
2008-11-09 Akim Demaille <demaille@gostai.com> 2008-11-09 Akim Demaille <demaille@gostai.com>
Introduce a hierarchy for symbols. Introduce a hierarchy for symbols.

View File

@@ -462,10 +462,10 @@ m4_ifdef([b4_stype],
struct symbol_base_type struct symbol_base_type
{ {
/// Default constructor. /// Default constructor.
symbol_base_type (); inline symbol_base_type ();
/// Constructor. /// Constructor.
symbol_base_type (const semantic_type& v, const location_type& l); inline symbol_base_type (const semantic_type& v, const location_type& l);
/// Return the type of this symbol. /// Return the type of this symbol.
virtual int type_get () const = 0; virtual int type_get () const = 0;
@@ -488,40 +488,40 @@ m4_ifdef([b4_stype],
/// \param yymsg Why this token is reclaimed. /// \param yymsg Why this token is reclaimed.
/// If null, print nothing. /// If null, print nothing.
/// \param s The symbol. /// \param s The symbol.
void yy_destroy_ (const char* yymsg, symbol_base_type& yysym) const; inline void yy_destroy_ (const char* yymsg, symbol_base_type& yysym) const;
/// Element of the stack: a state and its attributes. /// Element of the stack: a state and its attributes.
struct symbol_type : symbol_base_type struct symbol_type : symbol_base_type
{ {
/// Default constructor. /// Default constructor.
symbol_type (); inline symbol_type ();
/// Constructor. /// Constructor.
symbol_type (state_type s, inline symbol_type (int t,
const semantic_type& v, const location_type& l); const semantic_type& v, const location_type& l);
/// The symbol type. /// The symbol type.
int type; int type;
/// Return the type corresponding to this state. /// Return the type corresponding to this state.
virtual int type_get () const; virtual inline int type_get () const;
}; };
/// Element of the stack: a state and its attributes. /// Element of the stack: a state and its attributes.
struct stack_symbol_type : symbol_base_type struct stack_symbol_type : symbol_base_type
{ {
/// Default constructor. /// Default constructor.
stack_symbol_type (); inline stack_symbol_type ();
/// Constructor. /// Constructor.
stack_symbol_type (state_type s, inline stack_symbol_type (state_type s,
const semantic_type& v, const location_type& l); const semantic_type& v, const location_type& l);
/// The state. /// The state.
state_type state; state_type state;
/// Return the type corresponding to this state. /// Return the type corresponding to this state.
virtual int type_get () const; virtual inline int type_get () const;
}; };
/// Stack type. /// Stack type.