diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2025-12-14 14:45:49 -0800 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2025-12-14 14:47:21 -0800 |
| commit | 1269bbdaa91b4eb9d17117bfd0718de297040271 (patch) | |
| tree | ee04859018bc8a22e8b9ccf7f83de7b0f5eef40b /lib-src | |
| parent | 51b8a7c7cb4132ce1fc239c86b5858fa7636b488 (diff) | |
Improve make-docfile.c for C23
* lib-src/make-docfile.c (write_c_args): Don’t diagnose “()”.
In C23 it’s equivalent to (void), and it works fine (albeit with
less type-checking) in older C. Omit first arg, which is no
longer needed. Caller changed.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/make-docfile.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 068b36f1b74..f59ce7def35 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -485,7 +485,7 @@ read_c_string_or_comment (FILE *infile, int printflag, bool comment, MINARGS and MAXARGS are the minimum and maximum number of arguments. */ static void -write_c_args (char *func, char *buf, int minargs, int maxargs) +write_c_args (char *buf, int minargs, int maxargs) { char *p; bool in_ident = false; @@ -522,10 +522,7 @@ write_c_args (char *func, char *buf, int minargs, int maxargs) if (c == ',' || c == ')') { if (ident_length == 0) - { - error ("empty arg list for '%s' should be (void), not ()", func); - continue; - } + continue; if (strncmp (ident_start, "void", ident_length) == 0) continue; @@ -551,6 +548,8 @@ write_c_args (char *func, char *buf, int minargs, int maxargs) c = '-'; putchar (c); } + + ident_length = 0; } } @@ -1220,7 +1219,7 @@ scan_c_stream (FILE *infile) *p = '\0'; /* Output them. */ fputs ("\n\n", stdout); - write_c_args (input_buffer, argbuf, minargs, maxargs); + write_c_args (argbuf, minargs, maxargs); } else if (defunflag && maxargs == -1 && !saw_usage) /* The DOC should provide the usage form. */ |
