examples: remove useless includes

* examples/c++/variant-11.yy, examples/c++/variant.yy: here.
Fix warning when storing a long into an int.
This commit is contained in:
Akim Demaille
2018-11-13 06:43:50 +01:00
parent 868ea55b7c
commit 8ff6ff3ab0
2 changed files with 5 additions and 5 deletions

View File

@@ -37,9 +37,8 @@
%code // *.cc
{
#include <algorithm>
#include <climits> // INT_MIN, INT_MAX
#include <iostream>
#include <iterator>
#include <sstream>
namespace yy
@@ -141,7 +140,10 @@ int
main (int argc, const char *argv[])
{
if (2 <= argc && isdigit (*argv[1]))
max = strtol (argv[1], nullptr, 10);
{
auto maxl = strtol (argv[1], nullptr, 10);
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
}
auto&& p = yy::parser{};
p.set_debug_level (!!getenv ("YYDEBUG"));
return p.parse ();