Module Name:    src
Committed By:   rillig
Date:           Sat Jan  9 21:37:44 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: Makefile
Added Files:
        src/usr.bin/xlint/lint1: oper.c
Removed Files:
        src/usr.bin/xlint/lint1: ops.c

Log Message:
lint: rename ops.c to oper.c

The file ops.c had previously been autogenerated.  This meant that in a
NetBSD build, it was generated in OBJDIR, and a build that had just
updated src/usr.bin would fail.  For a build that last ran on
2020-12-01, and again today, it looks like this:

        #      link  lint1/lint1
        cc ... -o lint1 cgram.lo ... ops.lo ... tyname.lo
        /usr/bin/ld: ops.lo: in function `initmtab':
        ops.c:(.text+0x63): undefined reference to `STRUCT_ASSIGN'

This is caused by ops.c existing in OBJDIR, so the new version in
NETBSDSRCDIR is not looked at.  To prevent this, use oper.c instead as
the filename, which has not been used before.

https://mail-index.netbsd.org/source-changes-d/2021/01/09/msg013096.html


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/xlint/lint1/oper.c
cvs rdiff -u -r1.1 -r0 src/usr.bin/xlint/lint1/ops.c

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/Makefile
diff -u src/usr.bin/xlint/lint1/Makefile:1.56 src/usr.bin/xlint/lint1/Makefile:1.57
--- src/usr.bin/xlint/lint1/Makefile:1.56	Tue Jan  5 23:50:29 2021
+++ src/usr.bin/xlint/lint1/Makefile	Sat Jan  9 21:37:44 2021
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.56 2021/01/05 23:50:29 rillig Exp $
+#	$NetBSD: Makefile,v 1.57 2021/01/09 21:37:44 rillig Exp $
 
 .include <bsd.own.mk>
 
 PROG=		lint1
 SRCS=		cgram.y decl.c emit.c emit1.c err.c func.c init.c inittyp.c \
-		main1.c mem.c mem1.c ops.c print.c scan.l tree.c tyname.c
+		main1.c mem.c mem1.c oper.c print.c scan.l tree.c tyname.c
 
 MAN=		lint.7
 YHEADER=
@@ -38,7 +38,7 @@ LDADD+=		-ll
 DPADD+=		${LIBL}
 .endif
 
-ops.o: ops.def
+oper.o: ops.def
 
 .include "Makefile.err-msgs-h"
 ${SRCS:Nerr.c}: err-msgs.h

Added files:

Index: src/usr.bin/xlint/lint1/oper.c
diff -u /dev/null src/usr.bin/xlint/lint1/oper.c:1.1
--- /dev/null	Sat Jan  9 21:37:44 2021
+++ src/usr.bin/xlint/lint1/oper.c	Sat Jan  9 21:37:44 2021
@@ -0,0 +1,64 @@
+/*	$NetBSD: oper.c,v 1.1 2021/01/09 21:37:44 rillig Exp $	*/
+
+/*-
+ * Copyright (c) 2021 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Roland Illig.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include "op.h"
+#include "param.h"
+
+mod_t modtab[NOPS];
+
+static const struct {
+	mod_t	m;
+	unsigned char	ok;
+} imods[] =
+#define begin_ops() {
+#define op(name, repr, \
+		bi, lo, in, sc, ar, fo, va, ts, ba, se, \
+		lu, ru, pc, cm, ve, de, ew, ic, active) \
+	{ { bi, lo, in, sc, ar, fo, va, ts, ba, se, \
+	    lu, ru, pc, cm, ve, de, ew, ic, repr }, active },
+#define end_ops(n) };
+#include "ops.def"
+
+const char *
+getopname(op_t op) {
+	return imods[op].m.m_name;
+}
+
+void
+initmtab(void)
+{
+	size_t i;
+
+	for (i = 0; i < sizeof imods / sizeof imods[0]; i++)
+		if (imods[i].ok)
+			modtab[i] = imods[i].m;
+}

Reply via email to