Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint lint: replace INTERNAL_ERROR with plain assert



details:   https://anonhg.NetBSD.org/src/rev/d1216c79495b
branches:  trunk
changeset: 373578:d1216c79495b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Feb 18 15:14:11 2023 +0000

description:
lint: replace INTERNAL_ERROR with plain assert

diffstat:

 usr.bin/xlint/common/tyname.c |  17 ++++-------------
 usr.bin/xlint/lint1/lint1.h   |   5 +----
 2 files changed, 5 insertions(+), 17 deletions(-)

diffs (69 lines):

diff -r 7b66a23b7c0b -r d1216c79495b usr.bin/xlint/common/tyname.c
--- a/usr.bin/xlint/common/tyname.c     Sat Feb 18 15:09:10 2023 +0000
+++ b/usr.bin/xlint/common/tyname.c     Sat Feb 18 15:14:11 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tyname.c,v 1.53 2022/07/03 14:35:54 rillig Exp $       */
+/*     $NetBSD: tyname.c,v 1.54 2023/02/18 15:14:11 rillig Exp $       */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,13 +35,13 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tyname.c,v 1.53 2022/07/03 14:35:54 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.54 2023/02/18 15:14:11 rillig Exp $");
 #endif
 
+#include <assert.h>
 #include <limits.h>
 #include <string.h>
 #include <stdlib.h>
-#include <err.h>
 
 #if defined(IS_LINT1)
 #include "lint1.h"
@@ -49,14 +49,6 @@
 #include "lint2.h"
 #endif
 
-#ifndef INTERNAL_ERROR
-#define INTERNAL_ERROR(fmt, args...) \
-       do { \
-               (void)warnx("%s, %d: " fmt, __FILE__, __LINE__, ##args); \
-               abort(); \
-       } while (false)
-#endif
-
 /* A tree of strings. */
 typedef struct name_tree_node {
        const char *ntn_name;
@@ -151,8 +143,7 @@
 tspec_name(tspec_t t)
 {
        const char *name = ttab[t].tt_name;
-       if (name == NULL)
-               INTERNAL_ERROR("tspec_name(%d)", t);
+       assert(name != NULL);
        return name;
 }
 
diff -r 7b66a23b7c0b -r d1216c79495b usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sat Feb 18 15:09:10 2023 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sat Feb 18 15:14:11 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.161 2023/01/21 13:07:22 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.162 2023/02/18 15:14:11 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -458,9 +458,6 @@
 
 #include "externs1.h"
 
-#define INTERNAL_ERROR(fmt, args...) \
-       internal_error(__FILE__, __LINE__, fmt, ##args)
-
 #define lint_assert(cond)                                              \
        do {                                                            \
                if (!(cond))                                            \



Home | Main Index | Thread Index | Old Index