bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++: leave 'inline' on the definition, not the declaration


From: Akim Demaille
Subject: C++: leave 'inline' on the definition, not the declaration
Date: Fri, 31 Aug 2018 07:41:06 +0200

Purely stylistic.

commit 50fb43468970d5a582a08f7e24e01619795089bb
Author: Akim Demaille <address@hidden>
Date:   Fri Aug 31 07:20:53 2018 +0200

    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.

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<token_type> (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]),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]