gbranden pushed a commit to branch master
in repository groff.

commit f49a0531d63224af4a927cdb1d4a01d8410861ab
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 23 23:39:09 2026 -0600

    src/preproc/tbl/main.cpp: Be ISO C++98-correct.
    
    * src/preproc/tbl/main.cpp (describe_character): Don't try to statically
      allocate a VLA.  Use a pointer to heap memory instead.  Fixes
      `-Wvla-cxx-extension` `-Wgnu-folding-constant` warnings from Clang 21.
---
 ChangeLog                | 7 +++++++
 src/preproc/tbl/main.cpp | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 12cf1ceeb..281f30791 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-11-23  G. Branden Robinson <[email protected]>
+
+       * src/preproc/tbl/main.cpp (describe_character): Be ISO C++98-
+       correct.  Don't try to statically allocate a VLA.  Use a pointer
+       to heap memory instead.  Fixes `-Wvla-cxx-extension`
+       `-Wgnu-folding-constant` warnings from Clang 21.
+
 2026-11-23  G. Branden Robinson <[email protected]>
 
        * src/devices/grotty/tty.cpp (tty_printer::add_char): Report
diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp
index 9712f0521..3a7e78919 100644
--- a/src/preproc/tbl/main.cpp
+++ b/src/preproc/tbl/main.cpp
@@ -805,7 +805,9 @@ static const char *describe_character(int c)
   static const char cc[] = "character code";
   const size_t descbufsize = strlen(cc) + 1 /* ' ' */ + INT_DIGITS
                             + 1 /* '\0' */;
-  static char descbuf[descbufsize];
+  // ISO C++ does not permit VLAs on the stack.
+  // C++03: new char[descbufsize]();
+  char *descbuf = new char[descbufsize];
   (void) memset(descbuf, 0, (descbufsize * sizeof(char)));
   if (csprint(c)) {
     char quote = '\'';

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

Reply via email to