Thu Jul 8 19:08:03 2021 UTC ()
lint: fix assignment to midrule in grammar (since today)

When compiling the grammar with Bison, it complains:

	error: $$ for the midrule at $2 of 'struct' has no declared type

Yacc does not complain, instead it assumes that a midrule has the same
type as the rule itself.

The assignment '$$ = $1' in the midrule action does not influence the $$
of the whole rule, it only assigns to $2.  The assignment to $$ was done
via the default action, therefore everything worked as expected.  Any
missing assignment in this rule would have been caught quickly by the
strict assertion in mktag.

No functional change.


(rillig)
diff -r1.273 -r1.274 src/usr.bin/xlint/lint1/cgram.y

cvs diff -r1.273 -r1.274 src/usr.bin/xlint/lint1/cgram.y (expand / switch to context diff)
--- src/usr.bin/xlint/lint1/cgram.y 2021/07/08 18:53:57 1.273
+++ src/usr.bin/xlint/lint1/cgram.y 2021/07/08 19:08:03 1.274
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.273 2021/07/08 18:53:57 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.274 2021/07/08 19:08:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.273 2021/07/08 18:53:57 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.274 2021/07/08 19:08:03 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -649,7 +649,6 @@
 		begin_declaration_level($1 == STRUCT ? MOS : MOU);
 		dcs->d_offset = 0;
 		dcs->d_sou_align_in_bits = CHAR_SIZE;
-		$$ = $1;
 	  } type_attribute_list_opt
 	;