Hi, this is the second portability issue that killed the build for me. Again, i'm looking for an OK to push the fix.
Since i have little experience with C++, please check that the fix is correct and matches your intent. I don't think a Changelog entry is needed here, either. This mini-issue never made it into a release and no user-visible change is intended. Yours, Ingo ----- Forwarded message from Ingo Schwarze ----- URL: <https://savannah.gnu.org/bugs/?59270> Summary: [PATCH] node.h: avoid C++11 feature (non-const init in class) Project: GNU troff Submitted by: schwarze Submitted on: Wed 14 Oct 2020 01:34:45 PM UTC Category: Core Severity: 3 - Normal Item Group: Build/Installation Status: None Privacy: Public Assigned to: schwarze Open/Closed: Open Discussion Lock: Any Planned Release: None _______________________________________________________ Details: Compilation fails with GCC 4.2.1, which is the latest GNU compiler available under GPLv2: In file included from ../src/roff/troff/div.cpp:29: ../src/roff/troff/node.h:629: error: ISO C++ forbids initialization of member 'is_dying' ../src/roff/troff/node.h:629: error: making 'is_dying' static ../src/roff/troff/node.h:629: error: ISO C++ forbids in-class initialization of non-const static member 'is_dying' *** Error 1 in . (Makefile:6860 'src/roff/troff/div.o': @echo " CXX " src/roff/troff/div.o;depbase=`echo src/roff/troff/div.o | sed 's|...) *** Error 2 in /co/groff/build (Makefile:5317 'all') While requiring C++11 is likely to make sense for many newer projects, i don't think there is any benefit in groff requiring it, at least not as long as it is trivial to avoid. Compatibility with C++03 was broken in this commit: commit c788cf8c6bbe939fa11f7ec032e525a7e33f41b6 Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Tue Sep 29 07:02:25 2020 +1000 The attached patch fixes the build with gcc 4.2.1. _______________________________________________________ commit 138c2a21c8cfe7108473d4da2bdf3ac5fb9736f2 Author: Ingo Schwarze <schwa...@openbsd.org> Date: Wed Oct 14 15:19:04 2020 +0200 node.h: do not rely on C++11 features, fixes build with gcc 4.2.1 diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index 4a4e7e1b..72fff1ce 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -1613,6 +1613,7 @@ output_file *the_output = 0; output_file::output_file() { + is_dying = false; } output_file::~output_file() diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index e1c1960f..1fba4603 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -626,7 +626,7 @@ class output_file { char make_g_plus_plus_shut_up; public: output_file(); - bool is_dying = false; + bool is_dying; virtual ~output_file(); virtual void trailer(vunits); virtual void flush() = 0;