From 7fa910cb68b6c5bc8a6dcc5c71425a5534a76eb2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 1 Oct 2015 12:53:07 +0100 Subject: [PATCH] Fix build on Debian unstable. --- cscript | 2 ++ src/cxml.cc | 31 +++++++++++++++++-------------- wscript | 1 + 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/cscript b/cscript index 3970427..e4b83c6 100644 --- a/cscript +++ b/cscript @@ -8,6 +8,8 @@ def build(target, options): # Centos builds using static boost, which means tests don't # build as test/tests.cc defines BOOST_TEST_DYN_LINK cmd += ' --disable-tests' + if target.distro == 'debian' and target.version == 'unstable': + target.append_with_space('CXXFLAGS', '-std=c++11') elif target.platform == 'windows': cmd += ' --target-windows' target.command(cmd) diff --git a/src/cxml.cc b/src/cxml.cc index a9ab769..fb8ca2d 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -24,8 +24,12 @@ #include #include "cxml.h" -using namespace std; -using namespace boost; +using std::string; +using std::stringstream; +using std::istream; +using std::list; +using boost::shared_ptr; +using boost::optional; cxml::Node::Node () : _node (0) @@ -55,7 +59,7 @@ cxml::Node::node_child (string name) const } else if (n.empty ()) { throw cxml::Error ("missing XML tag " + name + " in " + _node->get_name()); } - + return n.front (); } @@ -68,7 +72,7 @@ cxml::Node::optional_node_child (string name) const } else if (n.empty ()) { return shared_ptr (); } - + return n.front (); } @@ -80,14 +84,14 @@ cxml::Node::node_children (string name) const */ xmlpp::Node::NodeList c = _node->get_children (); - + list > n; for (xmlpp::Node::NodeList::iterator i = c.begin (); i != c.end(); ++i) { if ((*i)->get_name() == name) { n.push_back (shared_ptr (new Node (*i))); } } - + _taken.push_back (name); return n; } @@ -127,7 +131,7 @@ cxml::Node::optional_bool_child (string c) const if (!s) { return optional (); } - + return (s.get() == "1" || s.get() == "yes"); } @@ -144,7 +148,7 @@ cxml::Node::string_attribute (string name) const if (!e) { throw cxml::Error ("missing attribute " + name); } - + xmlpp::Attribute* a = e->get_attribute (name); if (!a) { throw cxml::Error ("missing attribute " + name); @@ -160,7 +164,7 @@ cxml::Node::optional_string_attribute (string name) const if (!e) { return optional (); } - + xmlpp::Attribute* a = e->get_attribute (name); if (!a) { return optional (); @@ -202,7 +206,7 @@ string cxml::Node::content () const { string content; - + xmlpp::Node::NodeList c = _node->get_children (); for (xmlpp::Node::NodeList::const_iterator i = c.begin(); i != c.end(); ++i) { xmlpp::ContentNode const * v = dynamic_cast (*i); @@ -250,12 +254,12 @@ cxml::Document::~Document () } void -cxml::Document::read_file (filesystem::path file) +cxml::Document::read_file (boost::filesystem::path file) { - if (!filesystem::exists (file)) { + if (!boost::filesystem::exists (file)) { throw cxml::Error ("XML file " + file.string() + " does not exist"); } - + _parser->parse_file (file.string ()); take_root_node (); } @@ -289,4 +293,3 @@ cxml::Document::take_root_node () _root_name = _node->get_name (); } } - diff --git a/wscript b/wscript index 0d91d69..f6b1210 100644 --- a/wscript +++ b/wscript @@ -11,6 +11,7 @@ def options(opt): def configure(conf): conf.load('compiler_cxx') conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-O2']) + print conf.env['CXXFLAGS'] conf.env.TARGET_WINDOWS = conf.options.target_windows conf.env.STATIC = conf.options.static -- 2.30.2