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<by_type> 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<token_type> (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.
This commit is contained in:
Akim Demaille
2018-08-31 07:20:53 +02:00
parent b5d4eb8913
commit 50fb434689
2 changed files with 4 additions and 2 deletions

View File

@@ -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]),