From 50fb43468970d5a582a08f7e24e01619795089bb Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 31 Aug 2018 07:20:53 +0200 Subject: [PATCH] C++: leave 'inline' on the definition, not the declaration This is for consistency with the other uses of 'inline' in the C++ skeletons. On examples/variant.yy, this change gives: --- examples/variant.hh 2018-08-31 07:16:57.214222580 +0200 +++ examples/variant.hh 2018-08-31 07:19:52.285431997 +0200 @@ -444,15 +444,15 @@ typedef basic_symbol symbol_type; // Symbol constructors declarations. - static inline + static symbol_type make_END_OF_FILE (const location_type& l); - static inline + static symbol_type make_TEXT (const ::std::string& v, const location_type& l); - static inline + static symbol_type make_NUMBER (const int& v, const location_type& l); @@ -945,19 +945,23 @@ }; return static_cast (yytoken_number_[type]); } + // Implementation of make_symbol for each symbol type. + inline parser::symbol_type parser::make_END_OF_FILE (const location_type& l) { return symbol_type (token::END_OF_FILE, l); } + inline parser::symbol_type parser::make_TEXT (const ::std::string& v, const location_type& l) { return symbol_type (token::TEXT, v, l); } + inline parser::symbol_type parser::make_NUMBER (const int& v, const location_type& l) { @@ -967,7 +971,7 @@ } // yy -#line 971 "examples/variant.hh" // lalr1.cc:380 +#line 975 "examples/variant.hh" // lalr1.cc:380 and no changes on variant.cc. * data/c++.m4 (b4_public_types_define): Formatting changes. * data/variant.hh (b4_symbol_value_template_, b4_symbol_constructor_declare_): Move the 'inline' from declaration to implementation. --- data/c++.m4 | 1 + data/variant.hh | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/c++.m4 b/data/c++.m4 index 396d8613..be1becb2 100644 --- a/data/c++.m4 +++ b/data/c++.m4 @@ -426,6 +426,7 @@ m4_define([b4_public_types_define], return static_cast (yytoken_number_[type]); } ]])[]dnl + b4_symbol_constructor_define]) diff --git a/data/variant.hh b/data/variant.hh index 8d0f06f6..a4db750a 100644 --- a/data/variant.hh +++ b/data/variant.hh @@ -289,7 +289,7 @@ m4_define([b4_symbol_value_template], # these SYMBOL-NUMBERS. Use at class-level. m4_define([b4_symbol_constructor_declare_], [b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id], -[ static inline +[ static symbol_type make_[]b4_symbol_([$1], [id]) (dnl b4_join(b4_symbol_if([$1], [has_type], @@ -314,7 +314,8 @@ b4_symbol_foreach([b4_symbol_constructor_declare_])]) # Define symbol constructor for this SYMBOL-NUMBER. m4_define([b4_symbol_constructor_define_], [b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id], -[ b4_parser_class_name::symbol_type +[ inline + b4_parser_class_name::symbol_type b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl b4_join(b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),