From: Theophile Ranquet Date: Tue, 15 Jan 2013 12:05:21 +0000 (+0100) Subject: c++: remove useless inlines X-Git-Tag: v2.7.90~171 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/733fb7c593486846eca5a60d1e3ff6880ce358d7?ds=inline c++: remove useless inlines * data/c++.m4 (basic_symbol): Keep 'inline' in the prototypes, but don't duplicate it in the implementation. * data/variant.hh (variant): 'inline' is not needed when the implementation is provided in the class definition. --- diff --git a/data/c++.m4 b/data/c++.m4 index 506d6a75..2d45bc82 100644 --- a/data/c++.m4 +++ b/data/c++.m4 @@ -241,20 +241,17 @@ m4_define([b4_public_types_define], // basic_symbol. template - inline ]b4_parser_class_name[::basic_symbol::basic_symbol () : value () {} ]b4_locations_if([ template - inline ]b4_parser_class_name[::basic_symbol::basic_symbol (const location_type& l) : value () , location (l) {}])[ template - inline ]b4_parser_class_name[::basic_symbol& ]b4_parser_class_name[::basic_symbol::operator= (const basic_symbol&) { @@ -262,7 +259,6 @@ m4_define([b4_public_types_define], } template - inline ]b4_parser_class_name[::basic_symbol::basic_symbol (const basic_symbol& other) : Base (other) , value ()]b4_locations_if([ @@ -275,7 +271,6 @@ m4_define([b4_public_types_define], template - inline ]b4_parser_class_name[::basic_symbol::basic_symbol (]b4_join( [typename Base::value_type t], [const semantic_type& v], @@ -284,14 +279,15 @@ m4_define([b4_public_types_define], , value ()]b4_locations_if([ , location (l)])[ { - (void) v; /* FIXME: */ + // FIXME: The YYUSE macro is only available in the .cc skeleton files. It + // is not available in .hh files, where this code is when using %defines. + (void) v; ]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [copy], [v])], [value = v;])[ } template - inline ]b4_parser_class_name[::basic_symbol::basic_symbol (]b4_join( [typename Base::value_type t], b4_locations_if([const location_type& l]))[) @@ -300,7 +296,6 @@ m4_define([b4_public_types_define], {} template - inline void ]b4_parser_class_name[::basic_symbol::move (basic_symbol& s) { @@ -312,29 +307,24 @@ m4_define([b4_public_types_define], } // by_type. - inline ]b4_parser_class_name[::by_type::by_type () : type () {} - inline ]b4_parser_class_name[::by_type::by_type (const by_type& other) : type (other.type) {} - inline ]b4_parser_class_name[::by_type::by_type (token_type t) : type (yytranslate_ (t)) {} - inline int ]b4_parser_class_name[::by_type::type_get () const { return type; } ]b4_token_ctor_if([[ - inline ]b4_parser_class_name[::token_type ]b4_parser_class_name[::by_type::token () const { diff --git a/data/variant.hh b/data/variant.hh index 5ff0c54d..1b033886 100644 --- a/data/variant.hh +++ b/data/variant.hh @@ -95,7 +95,6 @@ m4_define([b4_variant_define], typedef variant self_type; /// Empty construction. - inline variant ()]b4_parse_assert_if([ : built (false) , tname (YY_NULL)])[ @@ -103,7 +102,7 @@ m4_define([b4_variant_define], /// Instantiate a \a T in here. template - inline T& + T& build () {]b4_parse_assert_if([ //YYASSERT (!built); @@ -116,7 +115,7 @@ m4_define([b4_variant_define], /// Instantiate a \a T in here from \a t. template - inline T& + T& build (const T& t) {]b4_parse_assert_if([ //YYASSERT (!built); @@ -129,7 +128,6 @@ m4_define([b4_variant_define], /// Construct and fill. template - inline variant (const T& t)]b4_parse_assert_if([ : built (true) , tname (typeid (T).name ())])[ @@ -140,7 +138,7 @@ m4_define([b4_variant_define], /// Accessor to a built \a T. template - inline T& + T& as () {]b4_parse_assert_if([ YYASSERT (built); @@ -151,7 +149,7 @@ m4_define([b4_variant_define], /// Const accessor to a built \a T (for %printer). template - inline const T& + const T& as () const {]b4_parse_assert_if([ YYASSERT (built); @@ -168,7 +166,7 @@ m4_define([b4_variant_define], /// Swapping between built and ((possibly) non-built is done with /// variant::move (). template - inline void + void swap (variant& other) {]b4_parse_assert_if([ YYASSERT (built); @@ -180,7 +178,7 @@ m4_define([b4_variant_define], /// Assign the content of \a other to this. /// Destroys \a other. template - inline void + void move (variant& other) {]b4_parse_assert_if([ YYASSERT (! built);])[ @@ -192,7 +190,7 @@ m4_define([b4_variant_define], /// Copy the content of \a other to this. /// Destroys \a other. template - inline void + void copy (const variant& other) { build (other.as ()); @@ -200,7 +198,7 @@ m4_define([b4_variant_define], /// Destroy the stored \a T. template - inline void + void destroy () { as ().~T ();]b4_parse_assert_if([