lint: move scl_name from print.c to decl.c

It is only needed there.
This commit is contained in:
rillig 2021-07-25 22:14:36 +00:00
parent a3535e9c45
commit 45912390fd
4 changed files with 19 additions and 65 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.79 2021/07/10 09:14:38 rillig Exp $
# $NetBSD: Makefile,v 1.80 2021/07/25 22:14:36 rillig Exp $
.include <bsd.own.mk>
@ -6,7 +6,7 @@ PROG= lint1
SRCS= cgram.y \
ckbool.c ckctype.c ckgetopt.c \
decl.c emit.c emit1.c err.c func.c init.c inittyp.c lex.c \
main1.c mem.c mem1.c oper.c print.c scan.l tree.c tyname.c
main1.c mem.c mem1.c oper.c scan.l tree.c tyname.c
MAN= lint.7
YHEADER=

View File

@ -1,4 +1,4 @@
/* $NetBSD: decl.c,v 1.209 2021/07/23 16:48:48 rillig Exp $ */
/* $NetBSD: decl.c,v 1.210 2021/07/25 22:14:36 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.209 2021/07/23 16:48:48 rillig Exp $");
__RCSID("$NetBSD: decl.c,v 1.210 2021/07/25 22:14:36 rillig Exp $");
#endif
#include <sys/param.h>
@ -133,6 +133,20 @@ initdecl(void)
typetab[UNSIGN].t_tspec = UNSIGN;
}
/* Return the name of the "storage class" in the wider sense. */
static const char *
scl_name(scl_t scl)
{
static const char *const names[] = {
"none", "extern", "static", "auto", "register", "typedef",
"struct", "union", "enum", "member of struct", "member of union",
"compile-time constant", "abstract", "argument",
"prototype argument", "inline"
};
return names[scl];
}
/*
* Returns a shared type structure for arithmetic types and void.
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: externs1.h,v 1.120 2021/07/20 19:44:36 rillig Exp $ */
/* $NetBSD: externs1.h,v 1.121 2021/07/25 22:14:36 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -339,11 +339,6 @@ extern void lex_slash_slash_comment(void);
extern void lex_unknown_character(int);
extern int lex_input(void);
/*
* print.c
*/
const char *scl_name(scl_t);
/*
* ckbool.c
*/

View File

@ -1,55 +0,0 @@
/* $NetBSD: print.c,v 1.15 2021/06/20 20:59:08 rillig Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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.
*/
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: print.c,v 1.15 2021/06/20 20:59:08 rillig Exp $");
#endif
#include "lint1.h"
/* Return the name of the "storage class" in the wider sense. */
const char *
scl_name(scl_t scl)
{
static const char *const names[] = {
"none", "extern", "static", "auto", "register", "typedef",
"struct", "union", "enum", "member of struct", "member of union",
"compile-time constant", "abstract", "argument",
"prototype argument", "inline"
};
return names[scl];
}