Support nested parens in make-docfile args

* 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.
This commit is contained in:
Paul Eggert 2025-12-14 14:45:49 -08:00
parent aeab91bc55
commit 19e5d27daf

View file

@ -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)