Module Name:    src
Committed By:   rillig
Date:           Wed Mar  5 22:48:59 UTC 2025

Modified Files:
        src/tests/usr.bin/xlint/lint1: decl.c
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
tests/lint: demonstrate missing warning about non-prototype


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.519 -r1.520 src/usr.bin/xlint/lint1/cgram.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.33 src/tests/usr.bin/xlint/lint1/decl.c:1.34
--- src/tests/usr.bin/xlint/lint1/decl.c:1.33	Sat Nov 30 11:27:20 2024
+++ src/tests/usr.bin/xlint/lint1/decl.c	Wed Mar  5 22:48:59 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl.c,v 1.33 2024/11/30 11:27:20 rillig Exp $	*/
+/*	$NetBSD: decl.c,v 1.34 2025/03/05 22:48:59 rillig Exp $	*/
 # 3 "decl.c"
 
 /*
@@ -320,3 +320,18 @@ typedef fprint_function (*change_logger)
 // Provoke a long type name to test reallocation in type_name.
 /* expect+1: error: redeclaration of 'static_function' with type 'function(pointer to function(pointer to function(int, pointer to const char, ...) returning void, pointer to function(int, pointer to const char, ...) returning void, pointer to function(int, pointer to const char, ...) returning void, pointer to function(int, pointer to const char, ...) returning void) returning pointer to function(int, pointer to const char, ...) returning void) returning void', expected 'function(void) returning void' [347] */
 void static_function(change_logger);
+
+
+void no_prototype_declaration();
+void prototype_declaration(void);
+
+// TODO: Warn about the missing 'void', for C99 and later.
+void
+no_prototype_definition()
+{
+}
+
+void
+prototype_definition(void)
+{
+}

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.519 src/usr.bin/xlint/lint1/cgram.y:1.520
--- src/usr.bin/xlint/lint1/cgram.y:1.519	Mon Feb 24 19:42:14 2025
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Mar  5 22:48:59 2025
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.519 2025/02/24 19:42:14 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.520 2025/03/05 22:48:59 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.519 2025/02/24 19:42:14 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.520 2025/03/05 22:48:59 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1755,6 +1755,8 @@ abstract_declaration:		/* specific to li
 abstract_decl_param_list:	/* specific to lint */
 	abstract_decl_lparen T_RPAREN type_attribute_list_opt {
 		$$ = (parameter_list){ .used = $3.used };
+		if (allow_c99)
+
 	}
 |	abstract_decl_lparen vararg_parameter_type_list T_RPAREN
 	    type_attribute_list_opt {

Reply via email to