[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 5dcfd5f 1/2: Guard inclusion of 'boost/regex.
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 5dcfd5f 1/2: Guard inclusion of 'boost/regex.hpp' with a pragma |
Date: |
Mon, 2 Oct 2017 10:34:08 -0400 (EDT) |
branch: master
commit 5dcfd5f22b88498850f40360e7304ba0be52ce45
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Guard inclusion of 'boost/regex.hpp' with a pragma
Added new header 'boost_regex.hpp', and included it in preference to
'boost/regex.hpp' p.r.n., to ensure uniform use of a pragma to inhibit
gcc's '-Wshadow' diagnostic.
---
Makefile.am | 1 +
boost_regex.hpp | 37 +++++++++++++++++++++++++++++++++++++
regex_test.cpp | 3 +--
test_coding_rules.cpp | 2 +-
wx_test_about_version.cpp | 3 +--
5 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 340e64b..441aaa4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1086,6 +1086,7 @@ noinst_HEADERS = \
assert_lmi.hpp \
authenticity.hpp \
basic_values.hpp \
+ boost_regex.hpp \
bourn_cast.hpp \
cache_file_reads.hpp \
calendar_date.hpp \
diff --git a/boost_regex.hpp b/boost_regex.hpp
new file mode 100644
index 0000000..66204e5
--- /dev/null
+++ b/boost_regex.hpp
@@ -0,0 +1,37 @@
+// Include boost/regex.hpp, guarding it with a pragma.
+//
+// Copyright (C) 2017 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// http://savannah.nongnu.org/projects/lmi
+// email: <address@hidden>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+#ifndef boost_regex_hpp
+#define boost_regex_hpp
+
+#include "config.hpp"
+
+#if defined __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wshadow"
+#endif // defined __GNUC__
+#include <boost/regex.hpp>
+#if defined __GNUC__
+# pragma GCC diagnostic pop
+#endif // defined __GNUC__
+
+#endif // boost_regex_hpp
+
diff --git a/regex_test.cpp b/regex_test.cpp
index 85337e4..fc4a0cb 100644
--- a/regex_test.cpp
+++ b/regex_test.cpp
@@ -21,12 +21,11 @@
#include "pchfile.hpp"
+#include "boost_regex.hpp"
#include "contains.hpp"
#include "test_tools.hpp"
#include "timer.hpp"
-#include <boost/regex.hpp>
-
#include <sstream>
#include <string>
#include <vector>
diff --git a/test_coding_rules.cpp b/test_coding_rules.cpp
index 1dd049f..7b2f1b3 100644
--- a/test_coding_rules.cpp
+++ b/test_coding_rules.cpp
@@ -20,6 +20,7 @@
// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
#include "assert_lmi.hpp"
+#include "boost_regex.hpp"
#include "contains.hpp"
#include "handle_exceptions.hpp"
#include "istream_to_string.hpp"
@@ -30,7 +31,6 @@
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp> // fs::exists(), fs::is_directory()
#include <boost/filesystem/path.hpp>
-#include <boost/regex.hpp>
#include <algorithm> // is_sorted()
#include <cstddef> // size_t
diff --git a/wx_test_about_version.cpp b/wx_test_about_version.cpp
index d67cd92..6901fd9 100644
--- a/wx_test_about_version.cpp
+++ b/wx_test_about_version.cpp
@@ -22,6 +22,7 @@
#include "pchfile_wx.hpp"
#include "assert_lmi.hpp"
+#include "boost_regex.hpp"
#include "calendar_date.hpp"
#include "version.hpp"
#include "wx_test_case.hpp"
@@ -32,8 +33,6 @@
#include <wx/testing.h>
#include <wx/uiaction.h>
-#include <boost/regex.hpp>
-
#include <climits> // INT_MAX
/// Validate version string (timestamp) from "About" dialog title.