Module Name:    src
Committed By:   rillig
Date:           Thu Jul  8 19:08:03 UTC 2021

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

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 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/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.273 src/usr.bin/xlint/lint1/cgram.y:1.274
--- src/usr.bin/xlint/lint1/cgram.y:1.273	Thu Jul  8 18:53:57 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Jul  8 19:08:03 2021
@@ -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 @@ struct:
 		begin_declaration_level($1 == STRUCT ? MOS : MOU);
 		dcs->d_offset = 0;
 		dcs->d_sou_align_in_bits = CHAR_SIZE;
-		$$ = $1;
 	  } type_attribute_list_opt
 	;
 

Reply via email to