From 19e5d27dafa84d93cb84469c9f21594c05204bb3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 14 Dec 2025 14:45:49 -0800 Subject: [PATCH] Support nested parens in make-docfile args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lib-src/make-docfile.c (scan_c_stream): Allow nested parens. E.g., ‘(Lisp_Object XXX (force))’ for the identifier ‘force’, where XXX is a macro. This is for future changes. --- lib-src/make-docfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 69adcb415af..f41cf8d136b 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -1205,12 +1205,13 @@ scan_c_stream (FILE *infile) c = getc (infile); } /* Copy arguments into ARGBUF. */ - while (true) + for (ptrdiff_t nested = 0; ; ) { *p++ = c; if (argbuf + sizeof argbuf <= p) fatal ("argument buffer exhausted"); - if (c == ')') + nested += (c == '(') - (c == ')'); + if (c == ')' && !nested) break; c = getc (infile); if (c < 0)