[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] c++: formatting and comment changes
From: |
Akim Demaille |
Subject: |
[PATCH 1/6] c++: formatting and comment changes |
Date: |
Mon, 28 Jan 2013 16:34:12 +0100 |
* data/c++.m4, data/lalr1.cc, data/stack.hh, data/variant.hh:
Fix indentation.
Fix some comments.
---
data/c++.m4 | 15 +++++++--------
data/lalr1.cc | 14 ++++++--------
data/stack.hh | 4 ++--
data/variant.hh | 10 ++++++----
4 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/data/c++.m4 b/data/c++.m4
index 2d45bc8..f9fcb9d 100644
--- a/data/c++.m4
+++ b/data/c++.m4
@@ -176,20 +176,18 @@ m4_define([b4_public_types_declare],
inline basic_symbol (const basic_symbol& other);
/// Constructor for valueless symbols.
- inline basic_symbol (]b4_join(
- [typename Base::value_type t],
- b4_locations_if([const location_type& l]))[);
+ inline basic_symbol (typename Base::value_type t]b4_locations_if([,
+ const location_type& l])[);
/// Constructor for symbols with semantic value.
- inline basic_symbol (]b4_join(
- [typename Base::value_type t],
- [const semantic_type& v],
- b4_locations_if([const location_type& l]))[);
+ inline basic_symbol (typename Base::value_type t,
+ const semantic_type& v]b4_locations_if([,
+ const location_type& l])[);
/// Assignment operator.
inline basic_symbol& operator= (const basic_symbol& other);
- /// Destructive move, \a s is emptied.
+ /// Destructive move, \a s is emptied into this.
inline void move (basic_symbol& s);
/// The semantic value.
@@ -220,6 +218,7 @@ m4_define([b4_public_types_declare],
/// The token.
inline token_type token () const;
+ /// The type used to store the symbol type.
typedef token_type value_type;
};
diff --git a/data/lalr1.cc b/data/lalr1.cc
index 2b1949e..a195602 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -287,6 +287,7 @@ b4_location_define])])[
/// The type (corresponding to \a state).
inline int type_get () const;
+ /// The type used to store the symbol type.
typedef state_type value_type;
};
@@ -497,12 +498,10 @@ m4_if(b4_prefix, [yy], [],
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
#endif]b4_parse_param_cons[
- {
- }
+ {}
]b4_parser_class_name::~b4_parser_class_name[ ()
- {
- }
+ {}
/*---------------.
@@ -530,10 +529,10 @@ m4_if(b4_prefix, [yy], [],
return yystos_[state];
}
+
template <typename Base>
void
- ]b4_parser_class_name[::yy_destroy_ (const char* yymsg,
- basic_symbol<Base>& yysym) const
+ ]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>&
yysym) const
{
if (yymsg)
YY_SYMBOL_PRINT (yymsg, yysym);
@@ -574,8 +573,7 @@ m4_if(b4_prefix, [yy], [],
#endif
void
- ]b4_parser_class_name[::yypush_ (const char* m, state_type s,
- symbol_type& sym)
+ ]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type&
sym)
{
if (m)
YY_SYMBOL_PRINT (m, sym);
diff --git a/data/stack.hh b/data/stack.hh
index 61fbde2..7ed5560 100644
--- a/data/stack.hh
+++ b/data/stack.hh
@@ -41,14 +41,14 @@ m4_define([b4_stack_define],
inline
T&
- operator [] (unsigned int i)
+ operator[] (unsigned int i)
{
return seq_[seq_.size () - 1 - i];
}
inline
const T&
- operator [] (unsigned int i) const
+ operator[] (unsigned int i) const
{
return seq_[seq_.size () - 1 - i];
}
diff --git a/data/variant.hh b/data/variant.hh
index 1b03388..c96cfeb 100644
--- a/data/variant.hh
+++ b/data/variant.hh
@@ -159,11 +159,12 @@ m4_define([b4_variant_define],
}
/// Swap the content with \a other, of same type.
+ ///
/// Both variants must be built beforehand, because swapping the actual
/// data requires reading it (with as()), and this is not possible on
/// unconstructed variants: it would require some dynamic testing, which
/// should not be the variant's responsability.
- /// Swapping between built and ((possibly) non-built is done with
+ /// Swapping between built and (possibly) non-built is done with
/// variant::move ().
template <typename T>
void
@@ -175,7 +176,8 @@ m4_define([b4_variant_define],
std::swap (as<T>(), other.as<T>());
}
- /// Assign the content of \a other to this.
+ /// Move the content of \a other to this.
+ ///
/// Destroys \a other.
template <typename T>
void
@@ -188,7 +190,6 @@ m4_define([b4_variant_define],
}
/// Copy the content of \a other to this.
- /// Destroys \a other.
template <typename T>
void
copy (const variant<S>& other)
@@ -227,7 +228,8 @@ m4_define([b4_variant_define],
long double align_me;
char raw[S];
} buffer;]b4_parse_assert_if([
- /// Whether something is contained.
+
+ /// Whether the content is built.
bool built;
/// If defined, the name of the stored type.
const char* tname;])[
--
1.8.1.1
- [PATCH 0/6] {master} c++: variant overhaul, Akim Demaille, 2013/01/28
- [PATCH 3/6] tests: enable support for --debug, Akim Demaille, 2013/01/28
- [PATCH 2/6] c++: revamp the support for variants, Akim Demaille, 2013/01/28
- [PATCH 4/6] c++: remove now-useless operators, Akim Demaille, 2013/01/28
- [PATCH 5/6] tests: remove useless %defines, Akim Demaille, 2013/01/28
- [PATCH 6/6] tests: check that using variants is exception safe, Akim Demaille, 2013/01/28
- [PATCH 1/6] c++: formatting and comment changes,
Akim Demaille <=