Tue Jan 5 07:37:41 2021 UTC ()
lint: add missing strings for operators

It's difficult to keep these lists in sync when they are spread over
several files.  The lists had been inconsistent since 2008-04-26.  The
inconsistency didn't lead to undefined behavior though since the
operator names are only used in 2 places:

1. check_integer_conversion in message 324 only calls that function with
a few selected operators, all of which are above the missing ones.

2. mkinit prints the node including its operator, but only in debug
mode.  Furthermore I'm not sure whether any of the broken operator names
could ever be accessed at this place since mkinit is only called for
expressions, and the node types are INIT, CASE, FARG, which are all
special.


(rillig)
diff -r1.8 -r1.9 src/usr.bin/xlint/lint1/print.c

cvs diff -r1.8 -r1.9 src/usr.bin/xlint/lint1/Attic/print.c (expand / switch to unified diff)

--- src/usr.bin/xlint/lint1/Attic/print.c 2021/01/03 18:35:51 1.8
+++ src/usr.bin/xlint/lint1/Attic/print.c 2021/01/05 07:37:41 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: print.c,v 1.8 2021/01/03 18:35:51 rillig Exp $ */ 1/* $NetBSD: print.c,v 1.9 2021/01/05 07:37:41 rillig Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas. 8 * by Christos Zoulas.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#if HAVE_NBTOOL_CONFIG_H 32#if HAVE_NBTOOL_CONFIG_H
33#include "nbtool_config.h" 33#include "nbtool_config.h"
34#endif 34#endif
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37#ifndef lint 37#ifndef lint
38__RCSID("$NetBSD: print.c,v 1.8 2021/01/03 18:35:51 rillig Exp $"); 38__RCSID("$NetBSD: print.c,v 1.9 2021/01/05 07:37:41 rillig Exp $");
39#endif 39#endif
40 40
41#include <stdio.h> 41#include <stdio.h>
42 42
43#include "lint1.h" 43#include "lint1.h"
44 44
45static const char *str_op_t[] = 45static const char *str_op_t[] =
46{ 46{
47 "*noop*", 47 "*noop*",
48 "->", 48 "->",
49 ".", 49 ".",
50 "!", 50 "!",
51 "~", 51 "~",
@@ -91,26 +91,28 @@ static const char *str_op_t[] = @@ -91,26 +91,28 @@ static const char *str_op_t[] =
91 "^=", 91 "^=",
92 "|=", 92 "|=",
93 "*name*", 93 "*name*",
94 "*constant*", 94 "*constant*",
95 "*string*", 95 "*string*",
96 "*field select*", 96 "*field select*",
97 "*call*", 97 "*call*",
98 ",", 98 ",",
99 "*(cast)*", 99 "*(cast)*",
100 "*icall*", 100 "*icall*",
101 "*load*", 101 "*load*",
102 "*push*", 102 "*push*",
103 "return", 103 "return",
 104 "real",
 105 "imag",
104 "*init*", 106 "*init*",
105 "*case*", 107 "*case*",
106 "*farg*", 108 "*farg*",
107}; 109};
108 110
109char * 111char *
110print_tnode(char *buf, size_t bufsiz, const tnode_t *tn) 112print_tnode(char *buf, size_t bufsiz, const tnode_t *tn)
111{ 113{
112 strg_t *st; 114 strg_t *st;
113 val_t *v; 115 val_t *v;
114 sym_t *s; 116 sym_t *s;
115 switch (tn->tn_op) { 117 switch (tn->tn_op) {
116 case NAME: 118 case NAME: