gbranden pushed a commit to branch master
in repository groff.

commit a8da07c16f646a446227699252550e3b4ef2a9a4
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Apr 22 22:02:49 2025 -0500

    [libgroff]: Dump ancient compiler bug workaround.
    
    * src/include/stringclass.h (operator+): Dump workaround for ancient
      (~1995) compiler bug affecting ternary operator.  Sun C++ 4.0 is no
      longer relevant.
    
    Reverts the following groff 1.10 ChangeLog entry:
    
    Tue May 10 13:02:31 1994  James Clark  ([email protected])
    
           * include/stringclass.h (operator +): Use ?: instead of `if' to
           work around Sun C++ 4.0 bug.
---
 ChangeLog                 |  6 ++++++
 src/include/stringclass.h | 14 --------------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f7ef44dd9..fdcec18fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-04-22  G. Branden Robinson <[email protected]>
+
+       * src/include/stringclass.h (operator+): Dump workaround for
+       ancient (~1995) compiler bug affecting ternary operator.  Sun
+       C++ 4.0 is no longer relevant.
+
 2025-04-22  G. Branden Robinson <[email protected]>
 
        [troff]: Fix code style nits.
diff --git a/src/include/stringclass.h b/src/include/stringclass.h
index 11cc56d7b..13e7514c8 100644
--- a/src/include/stringclass.h
+++ b/src/include/stringclass.h
@@ -138,26 +138,12 @@ inline string operator+(const string &s1, const string 
&s2)
 
 inline string operator+(const string &s1, const char *s2)
 {
-#ifdef __GNUG__
-  if (s2 == 0)
-    return s1;
-  else
-    return string(s1.ptr, s1.len, s2, strlen(s2));
-#else
   return s2 == 0 ? s1 : string(s1.ptr, s1.len, s2, strlen(s2));
-#endif
 }
 
 inline string operator+(const char *s1, const string &s2)
 {
-#ifdef __GNUG__
-  if (s1 == 0)
-    return s2;
-  else
-    return string(s1, strlen(s1), s2.ptr, s2.len);
-#else
   return s1 == 0 ? s2 : string(s1, strlen(s1), s2.ptr, s2.len);
-#endif
 }
 
 inline string operator+(const string &s, char c)

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to