Module Name: src
Committed By: rillig
Date: Sat Jan 20 10:25:57 UTC 2024
Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h mem.c tyname.c
Log Message:
lint: unclutter conditional compilation
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/common/tyname.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/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.32 src/usr.bin/xlint/common/externs.h:1.33
--- src/usr.bin/xlint/common/externs.h:1.32 Sat Jan 20 10:21:35 2024
+++ src/usr.bin/xlint/common/externs.h Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: externs.h,v 1.32 2024/01/20 10:21:35 rillig Exp $ */
+/* $NetBSD: externs.h,v 1.33 2024/01/20 10:25:57 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -34,7 +34,7 @@
/*
* tyname.c
*/
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
const char *type_name(const type_t *);
const char *tspec_name(tspec_t);
#endif
@@ -43,7 +43,7 @@ const char *tspec_name(tspec_t);
* mem.c
*/
void *xmalloc(size_t);
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
void *xcalloc(size_t, size_t);
#endif
void *xrealloc(void *, size_t);
@@ -53,7 +53,7 @@ char *xasprintf(const char *, ...) __pri
/*
* emit.c
*/
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
void outopen(const char *);
void outclose(void);
void outchar(char);
Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.41 src/usr.bin/xlint/common/inittyp.c:1.42
--- src/usr.bin/xlint/common/inittyp.c:1.41 Sun Dec 3 18:17:41 2023
+++ src/usr.bin/xlint/common/inittyp.c Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: inittyp.c,v 1.41 2023/12/03 18:17:41 rillig Exp $ */
+/* $NetBSD: inittyp.c,v 1.42 2024/01/20 10:25:57 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,10 +37,10 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: inittyp.c,v 1.41 2023/12/03 18:17:41 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.42 2024/01/20 10:25:57 rillig Exp $");
#endif
-#if defined(IS_LINT1)
+#if IS_LINT1
#include "lint1.h"
#else
#include "lint2.h"
@@ -48,7 +48,7 @@ __RCSID("$NetBSD: inittyp.c,v 1.41 2023/
#define INT_RANK (/*CONSTCOND*/INTPTR_TSPEC == LONG ? 4 : 5)
-#ifdef IS_LINT1
+#if IS_LINT1
#define typeinfo(name, signed_type, unsigned_type, size_in_bits, rv, c) \
{ /*CONSTCOND*/ \
size_in_bits, \
Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.46 src/usr.bin/xlint/common/lint.h:1.47
--- src/usr.bin/xlint/common/lint.h:1.46 Sun Dec 3 18:17:41 2023
+++ src/usr.bin/xlint/common/lint.h Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lint.h,v 1.46 2023/12/03 18:17:41 rillig Exp $ */
+/* $NetBSD: lint.h,v 1.47 2024/01/20 10:25:57 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -47,7 +47,7 @@
#include "param.h"
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
/*
* Type specifiers, used in type structures (type_t) and elsewhere.
*/
@@ -93,7 +93,7 @@ typedef enum {
* size of types, name and classification
*/
typedef struct {
-#ifdef IS_LINT1
+#if IS_LINT1
unsigned int tt_size_in_bits;
enum rank_kind {
RK_NONE,
@@ -107,7 +107,7 @@ typedef struct {
tspec_t tt_signed_counterpart;
tspec_t tt_unsigned_counterpart;
bool tt_is_integer:1; /* integer type */
-#ifdef IS_LINT1
+#if IS_LINT1
bool tt_is_uinteger:1; /* unsigned integer type */
bool tt_is_floating:1; /* floating point type */
bool tt_is_arithmetic:1; /* arithmetic type */
@@ -145,7 +145,7 @@ typedef enum {
DEF /* defined */
} def_t;
-#if defined(IS_LINT1)
+#if IS_LINT1
typedef struct lint1_type type_t;
#else
typedef struct lint2_type type_t;
Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.23 src/usr.bin/xlint/common/mem.c:1.24
--- src/usr.bin/xlint/common/mem.c:1.23 Sat Jan 20 10:21:35 2024
+++ src/usr.bin/xlint/common/mem.c Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $ */
+/* $NetBSD: mem.c,v 1.24 2024/01/20 10:25:57 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.24 2024/01/20 10:25:57 rillig Exp $");
#endif
#include <stdarg.h>
@@ -62,7 +62,7 @@ xmalloc(size_t s)
return not_null(malloc(s));
}
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
void *
xcalloc(size_t n, size_t s)
{
Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.57 src/usr.bin/xlint/common/tyname.c:1.58
--- src/usr.bin/xlint/common/tyname.c:1.57 Wed Aug 2 18:51:25 2023
+++ src/usr.bin/xlint/common/tyname.c Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: tyname.c,v 1.57 2023/08/02 18:51:25 rillig Exp $ */
+/* $NetBSD: tyname.c,v 1.58 2024/01/20 10:25:57 rillig Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: tyname.c,v 1.57 2023/08/02 18:51:25 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.58 2024/01/20 10:25:57 rillig Exp $");
#endif
#include <assert.h>
@@ -43,7 +43,7 @@ __RCSID("$NetBSD: tyname.c,v 1.57 2023/0
#include <string.h>
#include <stdlib.h>
-#if defined(IS_LINT1)
+#if IS_LINT1
#include "lint1.h"
#else
#include "lint2.h"
@@ -154,7 +154,7 @@ type_name_of_function(buffer *buf, const
buf_add(buf, "(");
if (tp->t_proto) {
-#ifdef IS_LINT1
+#if IS_LINT1
const sym_t *param = tp->t_params;
if (param == NULL)
buf_add(buf, "void");
@@ -186,7 +186,7 @@ static void
type_name_of_struct_or_union(buffer *buf, const type_t *tp)
{
buf_add(buf, " ");
-#ifdef IS_LINT1
+#if IS_LINT1
if (tp->t_sou->sou_tag->s_name == unnamed &&
tp->t_sou->sou_first_typedef != NULL) {
buf_add(buf, "typedef ");
@@ -203,7 +203,7 @@ static void
type_name_of_enum(buffer *buf, const type_t *tp)
{
buf_add(buf, " ");
-#ifdef IS_LINT1
+#if IS_LINT1
if (tp->t_enum->en_tag->s_name == unnamed &&
tp->t_enum->en_first_typedef != NULL) {
buf_add(buf, "typedef ");
@@ -220,7 +220,7 @@ static void
type_name_of_array(buffer *buf, const type_t *tp)
{
buf_add(buf, "[");
-#ifdef IS_LINT1
+#if IS_LINT1
if (tp->t_incomplete_array)
buf_add(buf, "unknown_size");
else
@@ -252,13 +252,13 @@ type_name(const type_t *tp)
if (tp->t_volatile)
buf_add(&buf, "volatile ");
-#ifdef IS_LINT1
+#if IS_LINT1
if (is_struct_or_union(t) && tp->t_sou->sou_incomplete)
buf_add(&buf, "incomplete ");
#endif
buf_add(&buf, tspec_name(t));
-#ifdef IS_LINT1
+#if IS_LINT1
if (tp->t_bitfield) {
buf_add(&buf, ":");
buf_add_int(&buf, (int)tp->t_bit_field_width);