Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: fix assignment to midrule in gramm...



details:   https://anonhg.NetBSD.org/src/rev/27543ff5609b
branches:  trunk
changeset: 1022198:27543ff5609b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 08 19:08:03 2021 +0000

description:
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.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 859b8479511a -r 27543ff5609b usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Thu Jul 08 18:53:57 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Thu Jul 08 19:08:03 2021 +0000
@@ -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
        ;
 



Home | Main Index | Thread Index | Old Index