bugGNU source-highlight - Bugs: bug #39358, configure, c++11: two patches to...

 
 

bug #39358: configure, c++11: two patches to allow building

Submitter:  Anton Bachin <antonbachin>
Submitted:  Fri 28 Jun 2013 02:46:26 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  bettini
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 27 Mar 2015 04:40:21 PM UTC, comment #1: 

sorry for the late reply.
I've applied the patch, it will be part of the next release

Lorenzo Bettini <bettini>
Group administrator
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;

Anton Bachin <antonbachin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #28442:  configure-c++11.patch added by antonbachin (1KiB - application/octet-stream - Attached the patch as a text file since the description field seems to remove whitespace.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bettini (Posted a comment)
  • -email is unavailable- added by antonbachin (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-27 bettini Open/ClosedOpen Closed
    2015-03-27 bettini StatusNone Fixed
        Assigned toNone bettini
    2013-06-28 antonbachin Attached File- Added configure-c++11.patch, #28442

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code