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: rename merge_type_specifiers to me...
details: https://anonhg.NetBSD.org/src/rev/1699c560f66c
branches: trunk
changeset: 984677:1699c560f66c
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Jul 15 23:47:00 2021 +0000
description:
lint: rename merge_type_specifiers to merge_signedness
No functional change.
diffstat:
usr.bin/xlint/lint1/decl.c | 53 +++++++++++++++++++++------------------------
1 files changed, 25 insertions(+), 28 deletions(-)
diffs (102 lines):
diff -r 5d1e00e7fb9c -r 1699c560f66c usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Thu Jul 15 23:42:49 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Thu Jul 15 23:47:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.205 2021/07/15 23:42:49 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.206 2021/07/15 23:47:00 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.205 2021/07/15 23:42:49 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.206 2021/07/15 23:47:00 rillig Exp $");
#endif
#include <sys/param.h>
@@ -64,7 +64,6 @@
static type_t *tdeferr(type_t *, tspec_t);
static void settdsym(type_t *, sym_t *);
-static tspec_t merge_type_specifiers(tspec_t, tspec_t);
static void align(int, int);
static sym_t *newtag(sym_t *, scl_t, bool, bool);
static bool eqargs(const type_t *, const type_t *, bool *);
@@ -382,6 +381,27 @@
}
}
+/* Merge the signedness into the abstract type. */
+static tspec_t
+merge_signedness(tspec_t t, tspec_t s)
+{
+
+ if (s != SIGNED && s != UNSIGN)
+ return t;
+
+ if (t == CHAR)
+ return s == SIGNED ? SCHAR : UCHAR;
+ if (t == SHORT)
+ return s == SIGNED ? SHORT : USHORT;
+ if (t == INT)
+ return s == SIGNED ? INT : UINT;
+ if (t == LONG)
+ return s == SIGNED ? LONG : ULONG;
+ if (t == QUAD)
+ return s == SIGNED ? QUAD : UQUAD;
+ return t;
+}
+
/*
* called if a list of declaration specifiers contains a typedef name
* and other specifiers (except struct, union, enum, typedef name)
@@ -401,7 +421,7 @@
if (!tflag)
/* modifying typedef with '%s'; only ... */
warning(5, ttab[t].tt_name);
- td = dup_type(gettyp(merge_type_specifiers(t2, t)));
+ td = dup_type(gettyp(merge_signedness(t2, t)));
td->t_typedef = true;
return td;
}
@@ -814,7 +834,7 @@
}
if (l != NOTSPEC)
t = l;
- dcs->d_type = gettyp(merge_type_specifiers(t, s));
+ dcs->d_type = gettyp(merge_signedness(t, s));
}
/*
@@ -859,29 +879,6 @@
}
/*
- * Merge type specifiers (char, ..., long long, signed, unsigned).
- */
-static tspec_t
-merge_type_specifiers(tspec_t t, tspec_t s)
-{
-
- if (s != SIGNED && s != UNSIGN)
- return t;
-
- if (t == CHAR)
- return s == SIGNED ? SCHAR : UCHAR;
- if (t == SHORT)
- return s == SIGNED ? SHORT : USHORT;
- if (t == INT)
- return s == SIGNED ? INT : UINT;
- if (t == LONG)
- return s == SIGNED ? LONG : ULONG;
- if (t == QUAD)
- return s == SIGNED ? QUAD : UQUAD;
- return t;
-}
-
-/*
* Return the length of a type in bits.
*
* Printing a message if the outermost dimension of an array is 0 must
Home |
Main Index |
Thread Index |
Old Index