aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2025-12-14 14:45:49 -0800
committerPaul Eggert2025-12-14 14:47:21 -0800
commit1269bbdaa91b4eb9d17117bfd0718de297040271 (patch)
treeee04859018bc8a22e8b9ccf7f83de7b0f5eef40b /lib-src
parent51b8a7c7cb4132ce1fc239c86b5858fa7636b488 (diff)
downloademacs-1269bbdaa91b4eb9d17117bfd0718de297040271.tar.gz
emacs-1269bbdaa91b4eb9d17117bfd0718de297040271.zip
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.c11
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,
485 MINARGS and MAXARGS are the minimum and maximum number of arguments. */ 485 MINARGS and MAXARGS are the minimum and maximum number of arguments. */
486 486
487static void 487static void
488write_c_args (char *func, char *buf, int minargs, int maxargs) 488write_c_args (char *buf, int minargs, int maxargs)
489{ 489{
490 char *p; 490 char *p;
491 bool in_ident = false; 491 bool in_ident = false;
@@ -522,10 +522,7 @@ write_c_args (char *func, char *buf, int minargs, int maxargs)
522 if (c == ',' || c == ')') 522 if (c == ',' || c == ')')
523 { 523 {
524 if (ident_length == 0) 524 if (ident_length == 0)
525 { 525 continue;
526 error ("empty arg list for '%s' should be (void), not ()", func);
527 continue;
528 }
529 526
530 if (strncmp (ident_start, "void", ident_length) == 0) 527 if (strncmp (ident_start, "void", ident_length) == 0)
531 continue; 528 continue;
@@ -551,6 +548,8 @@ write_c_args (char *func, char *buf, int minargs, int maxargs)
551 c = '-'; 548 c = '-';
552 putchar (c); 549 putchar (c);
553 } 550 }
551
552 ident_length = 0;
554 } 553 }
555 } 554 }
556 555
@@ -1220,7 +1219,7 @@ scan_c_stream (FILE *infile)
1220 *p = '\0'; 1219 *p = '\0';
1221 /* Output them. */ 1220 /* Output them. */
1222 fputs ("\n\n", stdout); 1221 fputs ("\n\n", stdout);
1223 write_c_args (input_buffer, argbuf, minargs, maxargs); 1222 write_c_args (argbuf, minargs, maxargs);
1224 } 1223 }
1225 else if (defunflag && maxargs == -1 && !saw_usage) 1224 else if (defunflag && maxargs == -1 && !saw_usage)
1226 /* The DOC should provide the usage form. */ 1225 /* The DOC should provide the usage form. */