Fri 28 Jun 2013 02:46:26 PM UTC, original submission:
Hello,
I've had to make two patches to get source-highlight to build on my system (Max OS X 10.8, clang 3.1, C++11 mode).
1. During the configure process, a check is run for stdbool.h and _Bool with the language set to C++, so the check fails. The first patch surrounds the gnulib macro call with AC_LANG_PUSH/POP to run this check, and all other gnulib checks, in C mode.
--- a/configure.ac
+++ b/configure.ac
@@ -160,7 +160,9 @@ AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
# For gnulib.
+AC_LANG_PUSH([C])
gl_INIT
+AC_LANG_POP([C])
dnl needed by readtags.c
AC_TYPE_OFF_T
2. lib/srchilite/settings.cpp compares std::ifstream objects with zero. This worked under C++98 because ifstream had an implicit converting operator to void*. This has been replaced with an explicit conversion to bool in C++11. I replaced the comparisons with a call to fail() instead, since this is compatible with both C++98 and C++11, and is what both conversions rely on internally.
--- a/lib/srchilite/settings.cpp
+++ b/lib/srchilite/settings.cpp
@@ -94,14 +94,14 @@ bool Settings::checkForTestFile() {
string file = dataDir + "/" + testFileName;
ifstream i(file.c_str());
- return (i != 0);
+ return (!i.fail());
}
bool Settings::checkForConfFile() {
string file = confDir + confFileName;
ifstream i(file.c_str());
- return (i != 0);
+ return (!i.fail());
}
bool Settings::readDataDir() {
@@ -109,7 +109,7 @@ bool Settings::readDataDir() {
ifstream i(file.c_str());
string line;
- if (i != 0) {
+ if (!i.fail()) {
while (read_line(&i, line)) {
if (line.size()) {
boost::cmatch what;
|