projects/guix·blob python-team · refs

74 lines · 2.6 KiB

1Fix various compatibility problems with newer GCC.
2
3This is an amalgamation of these upstream commits:
4
5 https://git.savannah.gnu.org/cgit/src-highlite.git/commit/?id=904949c9026cb772dc93fbe0947a252ef47127f4
6 https://git.savannah.gnu.org/cgit/src-highlite.git/commit/?id=ab9fe5cb9b85c5afab94f2a7f4b6d7d473c14ee9
7
8diff --git a/lib/srchilite/fileutil.cc b/lib/srchilite/fileutil.cc
9index 59a6d64..963178c 100644
10--- a/lib/srchilite/fileutil.cc
11+++ b/lib/srchilite/fileutil.cc
12@@ -48,7 +48,7 @@ void set_file_util_verbose(bool b) {
13 // FIXME avoid using a global variable
14 std::string start_path;
15
16-string readFile(const string &fileName) throw (IOException) {
17+string readFile(const string &fileName) {
18 ifstream file(fileName.c_str());
19
20 if (!file.is_open()) {
21diff --git a/lib/srchilite/fileutil.h b/lib/srchilite/fileutil.h
22index 7335a9b..042eb56 100644
23--- a/lib/srchilite/fileutil.h
24+++ b/lib/srchilite/fileutil.h
25@@ -27,7 +27,7 @@ extern std::string start_path;
26 * @return the contents of the file
27 * @throw IOException
28 */
29-string readFile(const string &fileName) throw (IOException);
30+string readFile(const string &fileName);
31
32 //char *read_file(const string &fileName);
33
34diff --git a/lib/tests/stdboosterror.h b/lib/tests/stdboosterror.h
35index 568545b..d59bfa6 100644
36--- a/lib/tests/stdboosterror.h
37+++ b/lib/tests/stdboosterror.h
38@@ -4,7 +4,7 @@
39 #include <boost/regex/pattern_except.hpp>
40
41 static boost::regex_error
42- std_boost_exception(boost::regex_error(boost::regex_constants::error_bad_pattern));
43+ std_boost_exception = boost::regex_error(boost::regex_constants::error_bad_pattern);
44
45 /**
46 * returns the string representing a standard exception (which
47diff --git a/lib/tests/test_wordtokenizer_main.cpp b/lib/tests/test_wordtokenizer_main.cpp
48index 40e23b1..11ba389 100644
49--- a/lib/tests/test_wordtokenizer_main.cpp
50+++ b/lib/tests/test_wordtokenizer_main.cpp
51@@ -11,6 +11,14 @@
52 using namespace std;
53 using namespace srchilite;
54
55+/*
56+ * We have to use 'std' namespaces because 'WordTokenizer::WordTokenizerResults::value_type'
57+ * is an std::pair<std::string, std::string> in disguise. We have to place 'operator<<()'
58+ * into the same namespace for ADL to work. Otherwise gcc-12 or clang-13 can't find the
59+ * overload.
60+ */
61+namespace std {
62+
63 static ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::value_type &);
64
65 ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::value_type &token) {
66@@ -23,6 +31,8 @@ ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::val
67 return os;
68 }
69
70+}
71+
72 int main() {
73 WordTokenizer::WordTokenizerResults tokens;
74