mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
style: don't use std::endl
* data/lalr1.cc, doc/bison.texi, etc/bench.pl.in, examples/variant.yy, * tests/actions.at, tests/atlocal.in, tests/c++.at, tests/headers.at, * tests/local.at, tests/types.at: Don't use std::endl, it flushes uselessly, and is considered bad style.
This commit is contained in:
@@ -443,7 +443,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
{ \
|
||||
*yycdebug_ << Title << ' '; \
|
||||
yy_print_ (*yycdebug_, Symbol); \
|
||||
*yycdebug_ << std::endl; \
|
||||
*yycdebug_ << '\n'; \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
@@ -736,7 +736,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
// avoid gratuitous conflicts when merging into the master branch.
|
||||
try
|
||||
{
|
||||
YYCDEBUG << "Starting parse" << std::endl;
|
||||
YYCDEBUG << "Starting parse\n";
|
||||
|
||||
]m4_ifdef([b4_initial_action], [
|
||||
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
|
||||
@@ -753,7 +753,7 @@ b4_dollar_popdef])[]dnl
|
||||
|
||||
// A new symbol was pushed on the stack.
|
||||
yynewstate:
|
||||
YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
|
||||
YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
|
||||
|
||||
// Accept?
|
||||
if (yystack_[0].state == yyfinal_)
|
||||
@@ -993,8 +993,7 @@ b4_dollar_popdef])[]dnl
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
YYCDEBUG << "Exception caught: cleaning lookahead and stack"
|
||||
<< std::endl;
|
||||
YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
|
||||
// Do not try to display the values of the reclaimed symbols,
|
||||
// as their printer might throw an exception.
|
||||
if (!yyla.empty ())
|
||||
@@ -1144,7 +1143,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
i_end = yystack_.end ();
|
||||
i != i_end; ++i)
|
||||
*yycdebug_ << ' ' << i->state;
|
||||
*yycdebug_ << std::endl;
|
||||
*yycdebug_ << '\n';
|
||||
}
|
||||
|
||||
// Report on the debug stream that the rule \a yyrule is going to be reduced.
|
||||
@@ -1155,7 +1154,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
int yynrhs = yyr2_[yyrule];
|
||||
// Print the symbols being reduced, and their result.
|
||||
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
||||
<< " (line " << yylno << "):" << std::endl;
|
||||
<< " (line " << yylno << "):\n";
|
||||
// The symbols being reduced.
|
||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
|
||||
|
||||
@@ -11174,13 +11174,13 @@ calcxx_driver::parse (const std::string &f)
|
||||
void
|
||||
calcxx_driver::error (const yy::location& l, const std::string& m)
|
||||
@{
|
||||
std::cerr << l << ": " << m << std::endl;
|
||||
std::cerr << l << ": " << m << '\n';
|
||||
@}
|
||||
|
||||
void
|
||||
calcxx_driver::error (const std::string& m)
|
||||
@{
|
||||
std::cerr << m << std::endl;
|
||||
std::cerr << m << '\n';
|
||||
@}
|
||||
@end example
|
||||
|
||||
@@ -11533,7 +11533,7 @@ main (int argc, char *argv[])
|
||||
else if (argv[i] == std::string ("-s"))
|
||||
driver.trace_scanning = true;
|
||||
else if (!driver.parse (argv[i]))
|
||||
std::cout << driver.result << std::endl;
|
||||
std::cout << driver.result << '\n';
|
||||
else
|
||||
res = 1;
|
||||
return res;
|
||||
|
||||
@@ -738,7 +738,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
||||
void
|
||||
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
|
||||
{
|
||||
std::cerr << loc << ": " << msg << std::endl;
|
||||
std::cerr << loc << ": " << msg << '\n';
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
@@ -85,7 +85,7 @@ typedef std::list<std::string> strings_type;
|
||||
%%
|
||||
|
||||
result:
|
||||
list { std::cout << $1 << std::endl; }
|
||||
list { std::cout << $1 << '\n'; }
|
||||
;
|
||||
|
||||
list:
|
||||
@@ -135,7 +135,7 @@ namespace yy
|
||||
void
|
||||
parser::error (const parser::location_type& loc, const std::string& msg)
|
||||
{
|
||||
std::cerr << loc << ": " << msg << std::endl;
|
||||
std::cerr << loc << ": " << msg << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
||||
]AT_YYLEX_DECLARE[
|
||||
}
|
||||
%%
|
||||
exp: { ]AT_SKEL_CC_IF([[std::cerr << @$ << std::endl]],
|
||||
exp: { ]AT_SKEL_CC_IF([[std::cerr << @$ << '\n']],
|
||||
[[LOCATION_PRINT(stderr, @$); fputc ('\n', stderr)]])[; }
|
||||
%%
|
||||
]AT_YYERROR_DEFINE[
|
||||
|
||||
@@ -69,7 +69,7 @@ if $BISON_CXX_WORKS; then
|
||||
|
||||
int main ()
|
||||
{
|
||||
std::cout << "Works" << std::endl;
|
||||
std::cout << "Works\n";
|
||||
}
|
||||
EOF
|
||||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS -o conftest conftest.cc
|
||||
|
||||
26
tests/c++.at
26
tests/c++.at
@@ -49,7 +49,7 @@ check (const T& in, const std::string& s)
|
||||
os << in;
|
||||
if (os.str () != s)
|
||||
{
|
||||
std::cerr << "fail: " << os.str () << ", expected: " << s << std::endl;
|
||||
std::cerr << "fail: " << os.str () << ", expected: " << s << '\n';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -140,13 +140,13 @@ int main()
|
||||
{
|
||||
{
|
||||
yy::parser::symbol_type s = yy::parser::make_INT(12);
|
||||
std::cerr << s.value.as<int>() << std::endl;
|
||||
std::cerr << s.value.as<int>() << '\n';
|
||||
}
|
||||
|
||||
{
|
||||
yy::parser::symbol_type s = yy::parser::make_INT(123);
|
||||
yy::parser::stack_symbol_type ss(1, s);
|
||||
std::cerr << ss.value.as<int>() << std::endl;
|
||||
std::cerr << ss.value.as<int>() << '\n';
|
||||
}
|
||||
|
||||
{
|
||||
@@ -268,7 +268,7 @@ typedef std::vector<std::string> strings_type;
|
||||
%%
|
||||
|
||||
result:
|
||||
list { std::cout << $][1 << std::endl; }
|
||||
list { std::cout << $][1 << '\n'; }
|
||||
;
|
||||
|
||||
list:
|
||||
@@ -504,7 +504,7 @@ void
|
||||
]$1[::parser::error (const ]$1[::parser::location_type &loc,
|
||||
const std::string &msg)
|
||||
{
|
||||
std::cerr << "At " << loc << ": " << msg << std::endl;
|
||||
std::cerr << "At " << loc << ": " << msg << '\n';
|
||||
}
|
||||
|
||||
]AT_MAIN_DEFINE[
|
||||
@@ -572,7 +572,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
||||
%nonassoc 'a' ;
|
||||
|
||||
%destructor {
|
||||
std::cerr << "Discarding 'a'." << std::endl;
|
||||
std::cerr << "Discarding 'a'.\n";
|
||||
} 'a'
|
||||
|
||||
%%
|
||||
@@ -581,7 +581,7 @@ start: error-reduce consistent-error 'a' { USE ($3); };
|
||||
|
||||
error-reduce:
|
||||
'a' 'a' consistent-error 'a' { USE (($1, $2, $4)); }
|
||||
| 'a' error { std::cerr << "Reducing 'a'." << std::endl; USE ($1); }
|
||||
| 'a' error { std::cerr << "Reducing 'a'.\n"; USE ($1); }
|
||||
;
|
||||
|
||||
consistent-error:
|
||||
@@ -605,7 +605,7 @@ yylex (yy::parser::semantic_type *)
|
||||
void
|
||||
yy::parser::error (const std::string &m)
|
||||
{
|
||||
std::cerr << m << std::endl;
|
||||
std::cerr << m << '\n';
|
||||
}
|
||||
|
||||
]AT_MAIN_DEFINE[
|
||||
@@ -651,7 +651,7 @@ start:
|
||||
;
|
||||
|
||||
thing:
|
||||
error { std::cerr << "caught error" << std::endl; }
|
||||
error { std::cerr << "caught error\n"; }
|
||||
| item
|
||||
;
|
||||
|
||||
@@ -681,7 +681,7 @@ yylex (yy::parser::semantic_type *)
|
||||
void
|
||||
yy::parser::error (const std::string &m)
|
||||
{
|
||||
std::cerr << "error: " << m << std::endl;
|
||||
std::cerr << "error: " << m << '\n';
|
||||
}
|
||||
]AT_MAIN_DEFINE[
|
||||
]])
|
||||
@@ -797,7 +797,7 @@ $1
|
||||
std::cerr << sep << *i;
|
||||
sep = ", ";
|
||||
}
|
||||
std::cerr << " }" << std::endl;
|
||||
std::cerr << " }\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -929,11 +929,11 @@ main (int argc, const char *argv[])
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << "exception caught: " << e.what () << std::endl;
|
||||
std::cerr << "exception caught: " << e.what () << '\n';
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "unknown exception caught" << std::endl;
|
||||
std::cerr << "unknown exception caught\n";
|
||||
}
|
||||
Object::log (YY_NULLPTR, "end");
|
||||
assert (Object::empty());
|
||||
|
||||
@@ -181,7 +181,7 @@ extern "C"
|
||||
do { \
|
||||
int res = S; \
|
||||
if (res) \
|
||||
std::cerr << #S": " << res << std::endl; \
|
||||
std::cerr << #S": " << res << '\n'; \
|
||||
} while (false)
|
||||
|
||||
int
|
||||
|
||||
@@ -539,7 +539,7 @@ m4_define([AT_YYERROR_DEFINE(c++)],
|
||||
void
|
||||
]AT_NAME_PREFIX[::parser::error (]AT_LOCATION_IF([[const location_type& l, ]])[const std::string& m)
|
||||
{
|
||||
std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << std::endl;
|
||||
std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << '\n';
|
||||
}]])
|
||||
|
||||
|
||||
@@ -892,7 +892,7 @@ void foo()
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "Inner caught" << std::endl;
|
||||
std::cerr << "Inner caught\n";
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -905,7 +905,7 @@ int main()
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "Outer caught" << std::endl;
|
||||
std::cerr << "Outer caught\n";
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
||||
@@ -243,7 +243,7 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc]],
|
||||
%define api.value.type variant],
|
||||
[%token <int> '1';
|
||||
%token <std::string> '2';],
|
||||
['1' '2' { std::cout << $1 << ", " << $2 << std::endl; }],
|
||||
['1' '2' { std::cout << $1 << ", " << $2 << '\n'; }],
|
||||
["12"],
|
||||
[if (res == '1')
|
||||
AT_VAL.build(10);
|
||||
|
||||
Reference in New Issue
Block a user