C++: remove useless calls to the base default constructor

* data/c++.m4, data/stack.hh, data/variant.hh: here.
This commit is contained in:
Akim Demaille
2018-08-12 14:46:39 +02:00
parent e76245fcd9
commit 0931d14728
3 changed files with 4 additions and 8 deletions

View File

@@ -297,13 +297,11 @@ m4_define([b4_public_types_define],
// basic_symbol. // basic_symbol.
template <typename Base> template <typename Base>
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol () ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
: value ()
{} {}
template <typename Base> template <typename Base>
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other) ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
: Base (other) : Base (other)]b4_locations_if([
, value ()]b4_locations_if([
, location (other.location)])[ , location (other.location)])[
{ {
]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy], ]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy],
@@ -331,8 +329,7 @@ m4_define([b4_public_types_define],
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join( ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t], [typename Base::kind_type t],
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)
: Base (t) : Base (t)]b4_locations_if([
, value ()]b4_locations_if([
, location (l)])[ , location (l)])[
{}]])[ {}]])[

View File

@@ -32,7 +32,6 @@ m4_define([b4_stack_define],
typedef typename S::size_type size_type; typedef typename S::size_type size_type;
stack () stack ()
: seq_ ()
{ {
seq_.reserve (200); seq_.reserve (200);
} }

View File

@@ -348,8 +348,8 @@ m4_define([b4_basic_symbol_constructor_define],
[typename Base::kind_type t], [typename Base::kind_type t],
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]), b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]),
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)
: Base (t) : Base (t)]b4_symbol_if([$1], [has_type], [
, value (]b4_symbol_if([$1], [has_type], [v])[)]b4_locations_if([ , value (v)])[]b4_locations_if([
, location (l)])[ , location (l)])[
{} {}
]]) ]])