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: extract build_name_call from build...
details: https://anonhg.NetBSD.org/src/rev/c12c3fd547c4
branches: trunk
changeset: 1023330:c12c3fd547c4
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Sep 03 22:27:32 2021 +0000
description:
lint: extract build_name_call from build_name
This reduces the indentation, providing enough space to write out the
full diagnostic in the code. It also prepares for supporting GCC
builtins like __builtin_add_overflow, which return _Bool instead of int.
No functional change.
diffstat:
usr.bin/xlint/lint1/tree.c | 45 +++++++++++++++++++++++++--------------------
1 files changed, 25 insertions(+), 20 deletions(-)
diffs (73 lines):
diff -r 01f296efe2f1 -r c12c3fd547c4 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Fri Sep 03 21:58:36 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Fri Sep 03 22:27:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.370 2021/09/02 20:10:17 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.371 2021/09/03 22:27:32 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.370 2021/09/02 20:10:17 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.371 2021/09/03 22:27:32 rillig Exp $");
#endif
#include <float.h>
@@ -215,6 +215,28 @@
return false;
}
+static void
+build_name_call(sym_t *sym)
+{
+
+ if (is_compiler_builtin(sym->s_name)) {
+ /*
+ * Do not warn about these, just assume that
+ * they are regular functions compatible with
+ * non-prototype calling conventions.
+ */
+ } else if (Sflag) {
+ /* function '%s' implicitly declared to return int */
+ error(215, sym->s_name);
+ } else if (sflag) {
+ /* function '%s' implicitly declared to return int */
+ warning(215, sym->s_name);
+ }
+
+ /* XXX if tflag is set, the symbol should be exported to level 0 */
+ sym->s_type = derive_type(sym->s_type, FUNC);
+}
+
/*
* Create a node for a name (symbol table entry).
* follow_token is the token which follows the name.
@@ -228,24 +250,7 @@
sym->s_scl = EXTERN;
sym->s_def = DECL;
if (follow_token == T_LPAREN) {
- if (is_compiler_builtin(sym->s_name)) {
- /*
- * Do not warn about these, just assume that
- * they are regular functions compatible with
- * non-prototype calling conventions.
- */
- } else if (Sflag) {
- /* function '%s' implicitly declared to ... */
- error(215, sym->s_name);
- } else if (sflag) {
- /* function '%s' implicitly declared to ... */
- warning(215, sym->s_name);
- }
- /*
- * XXX if tflag is set the symbol should be
- * exported to level 0
- */
- sym->s_type = derive_type(sym->s_type, FUNC);
+ build_name_call(sym);
} else {
fallback_symbol(sym);
}
Home |
Main Index |
Thread Index |
Old Index