1988-09-02 12:00:25 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
|
|
|
/* $Header$ */
|
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
#include <alloc.h>
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
#include "private.h"
|
1991-09-30 16:53:21 +00:00
|
|
|
#include "l_lint.h"
|
|
|
|
#include "l_class.h"
|
1988-08-07 22:55:20 +00:00
|
|
|
#include "class.h"
|
1988-07-08 22:24:06 +00:00
|
|
|
#include "inpdef.h"
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
extern char *strcpy();
|
|
|
|
|
1988-07-08 22:24:06 +00:00
|
|
|
#define streq(s1,s2) (strcmp(s1, s2) == 0)
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE char cur_name[NAMESIZE];
|
1991-03-08 15:54:05 +00:00
|
|
|
PRIVATE struct inpdef *dot, *lib, *proto, *ext, *sta;
|
1988-09-02 12:00:25 +00:00
|
|
|
|
1991-03-08 15:54:05 +00:00
|
|
|
PRIVATE one_name();
|
1988-10-12 15:49:11 +00:00
|
|
|
PRIVATE chk_def();
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE ext_decls();
|
1991-03-08 15:54:05 +00:00
|
|
|
PRIVATE proto_defs();
|
|
|
|
PRIVATE chk_proto();
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE ext_def();
|
|
|
|
PRIVATE get_dot();
|
|
|
|
PRIVATE init();
|
|
|
|
PRIVATE lib_def();
|
|
|
|
PRIVATE one_ext_decl();
|
|
|
|
PRIVATE one_func_call();
|
|
|
|
PRIVATE one_var_usage();
|
|
|
|
PRIVATE stat_def();
|
|
|
|
PRIVATE statics();
|
|
|
|
PRIVATE usage();
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
#define same_name() (dot && streq(cur_name, dot->id_name))
|
|
|
|
#define same_obj(stnr) (same_name() && dot->id_statnr == stnr)
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1991-03-08 15:54:05 +00:00
|
|
|
#define def_or_dec(id) (is_class(id, CL_DEF) ? "defined" : "declared")
|
|
|
|
#define fun_or_var(id) (is_class(id, CL_FUNC) ? "function" : "variable")
|
1988-08-07 22:55:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
/******** M A I N ********/
|
1988-05-30 17:17:16 +00:00
|
|
|
|
|
|
|
main(argc, argv)
|
|
|
|
char *argv[];
|
|
|
|
{
|
|
|
|
init(argc, argv);
|
1988-07-08 22:24:06 +00:00
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
dot = new_inpdef();
|
|
|
|
get_dot();
|
|
|
|
while (dot) {
|
|
|
|
if (lib) {
|
|
|
|
free_inpdef(lib);
|
|
|
|
lib = 0;
|
|
|
|
}
|
1991-03-08 15:54:05 +00:00
|
|
|
if (proto) {
|
|
|
|
free_inpdef(proto);
|
|
|
|
proto = 0;
|
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
if (ext) {
|
|
|
|
free_inpdef(ext);
|
|
|
|
ext = 0;
|
|
|
|
}
|
1991-03-08 15:54:05 +00:00
|
|
|
one_name();
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
char loptions[128];
|
1988-05-30 17:17:16 +00:00
|
|
|
static char *table[] = {0};
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE init(argc, argv)
|
1988-05-30 17:17:16 +00:00
|
|
|
char *argv[];
|
|
|
|
{
|
1988-08-07 22:55:20 +00:00
|
|
|
/*
|
1991-03-08 15:54:05 +00:00
|
|
|
* Get command line options
|
1988-08-07 22:55:20 +00:00
|
|
|
* Prepare standard input for reading using the input-package
|
1988-05-30 17:17:16 +00:00
|
|
|
*/
|
|
|
|
char *result;
|
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
init_class();
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
while (argc > 1 && argv[1][0] == '-') {
|
|
|
|
register char *arg = &argv[1][1];
|
|
|
|
register char ch;
|
|
|
|
|
|
|
|
while (ch = *arg++) {
|
|
|
|
switch (ch) {
|
|
|
|
case 'u':
|
|
|
|
/* don't report situations like
|
1989-10-04 15:36:56 +00:00
|
|
|
"not used anywhere"
|
1988-09-02 12:00:25 +00:00
|
|
|
*/
|
|
|
|
case 'X': /* ??? prints incoming inpdefs */
|
|
|
|
default: /* and any other */
|
|
|
|
loptions[ch] = 1;
|
|
|
|
break;
|
|
|
|
}
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1988-07-08 22:24:06 +00:00
|
|
|
argc--, argv++;
|
|
|
|
}
|
|
|
|
|
1991-03-08 15:54:05 +00:00
|
|
|
if (!InsertFile((char *)0, table, &result)) {
|
1988-07-08 22:24:06 +00:00
|
|
|
panic("InsertFile() fails");
|
1991-03-08 15:54:05 +00:00
|
|
|
}
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE get_dot()
|
1988-05-30 17:17:16 +00:00
|
|
|
{
|
1988-08-07 22:55:20 +00:00
|
|
|
if (!get_id(dot)) {
|
|
|
|
free_inpdef(dot);
|
|
|
|
dot = 0;
|
|
|
|
cur_name[0] = '\0';
|
|
|
|
}
|
1991-03-08 15:54:05 +00:00
|
|
|
if (loptions['X']) {
|
|
|
|
print_id("get_dot", dot);
|
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
}
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1991-03-08 15:54:05 +00:00
|
|
|
PRIVATE one_name()
|
|
|
|
{
|
|
|
|
strcpy(cur_name, dot->id_name);
|
|
|
|
lib_def();
|
|
|
|
proto_defs();
|
|
|
|
ext_def();
|
|
|
|
ext_decls();
|
|
|
|
usage(0);
|
|
|
|
if (proto) {
|
|
|
|
chk_def(proto);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (ext) {
|
|
|
|
chk_def(ext);
|
|
|
|
}
|
|
|
|
statics();
|
|
|
|
if (same_name()) {
|
|
|
|
/* there are lines for this name that have not been absorbed */
|
|
|
|
panic("sequence error in intermediate file");
|
|
|
|
}
|
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
|
|
|
|
/******** L I B R A R Y ********/
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE lib_def()
|
1988-08-07 22:55:20 +00:00
|
|
|
{
|
|
|
|
if (same_obj(0) && is_class(dot, CL_LIB)) {
|
|
|
|
lib = dot;
|
|
|
|
dot = new_inpdef();
|
|
|
|
get_dot();
|
1991-03-08 15:54:05 +00:00
|
|
|
while (same_obj(0) && is_class(dot, CL_LIB)) {
|
|
|
|
report(">%L: multiple definition of %s in library",
|
|
|
|
dot, dot->id_name);
|
|
|
|
get_dot();
|
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
}
|
1991-03-08 15:54:05 +00:00
|
|
|
}
|
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
|
1991-03-08 15:54:05 +00:00
|
|
|
/******** P R O T O T Y P E S ********/
|
|
|
|
PRIVATE proto_defs()
|
|
|
|
{
|
|
|
|
if (same_obj(0) && dot->id_class == PFDF) {
|
|
|
|
if (lib) {
|
|
|
|
report("%L: function %s also defined in %L",
|
|
|
|
dot, dot->id_name, lib);
|
|
|
|
}
|
|
|
|
proto = dot;
|
|
|
|
dot = new_inpdef();
|
1988-08-07 22:55:20 +00:00
|
|
|
get_dot();
|
1991-03-08 15:54:05 +00:00
|
|
|
while (same_obj(0) && dot->id_class == PFDF) {
|
|
|
|
chk_proto(dot);
|
|
|
|
get_dot();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRIVATE chk_proto(def)
|
|
|
|
struct inpdef *def;
|
|
|
|
{
|
|
|
|
if (proto->id_args) {
|
|
|
|
chk_args(def, proto);
|
|
|
|
}
|
|
|
|
if (!type_equal(def->id_type, proto->id_type)) {
|
|
|
|
report("%L: return type of function %s declared differently at %L",
|
|
|
|
def, def->id_name, proto);
|
1988-08-07 22:55:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******** E X T E R N ********/
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE ext_def()
|
1988-08-07 22:55:20 +00:00
|
|
|
{
|
|
|
|
if (same_obj(0) && is_class(dot, CL_EXT|CL_DEF)) {
|
1991-03-08 15:54:05 +00:00
|
|
|
if (lib && !proto) {
|
1989-10-04 15:36:56 +00:00
|
|
|
report("%L: %s %s also defined in %L",
|
1991-03-08 15:54:05 +00:00
|
|
|
dot, fun_or_var(dot), dot->id_name, lib);
|
|
|
|
}
|
|
|
|
if (proto) {
|
|
|
|
chk_proto(dot);
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
ext = dot;
|
|
|
|
dot = new_inpdef();
|
|
|
|
get_dot();
|
1991-03-08 15:54:05 +00:00
|
|
|
while (same_obj(0) && is_class(dot, CL_EXT|CL_DEF)) {
|
|
|
|
report("%L: %s %s also defined at %L",
|
|
|
|
dot, fun_or_var(dot), dot->id_name, ext);
|
|
|
|
get_dot();
|
|
|
|
}
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE ext_decls()
|
1988-05-30 17:17:16 +00:00
|
|
|
{
|
1988-08-07 22:55:20 +00:00
|
|
|
while (same_obj(0) && dot->id_class == EFDC) {
|
|
|
|
one_ext_decl("function", "variable", CL_VAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (same_obj(0) && dot->id_class == EVDC) {
|
|
|
|
one_ext_decl("variable", "function", CL_FUNC);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (same_obj(0) && dot->id_class == IFDC) {
|
|
|
|
one_ext_decl("function", "variable", CL_VAR);
|
|
|
|
}
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE one_ext_decl(kind, other_kind, other_class)
|
1988-08-07 22:55:20 +00:00
|
|
|
char *kind;
|
|
|
|
char *other_kind;
|
|
|
|
int other_class;
|
1988-05-30 17:17:16 +00:00
|
|
|
{
|
1991-03-08 15:54:05 +00:00
|
|
|
struct inpdef *def = (proto ? proto : ext ? ext : lib ? lib : 0);
|
1988-08-07 22:55:20 +00:00
|
|
|
|
|
|
|
if (!def) {
|
|
|
|
/* the declaration will have to serve */
|
|
|
|
ext = dot;
|
|
|
|
dot = new_inpdef();
|
|
|
|
get_dot();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_class(def, other_class)) {
|
|
|
|
/* e.g.: function FFF declared as variable at ... */
|
|
|
|
report("%L: %s %s %s as %s at %L",
|
1991-03-08 15:54:05 +00:00
|
|
|
dot, kind, dot->id_name,
|
|
|
|
def_or_dec(def), other_kind, def
|
|
|
|
);
|
1988-08-07 22:55:20 +00:00
|
|
|
/* no further testing possible */
|
1988-10-12 15:49:11 +00:00
|
|
|
get_dot();
|
1988-08-07 22:55:20 +00:00
|
|
|
return;
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
|
|
|
|
if (!type_equal(dot->id_type, def->id_type)) {
|
|
|
|
/* e.g.: type of variable VVV defined differently at ... */
|
|
|
|
report("%L: type of %s %s %s differently at %L",
|
1991-03-08 15:54:05 +00:00
|
|
|
dot, kind, dot->id_name, def_or_dec(def), def);
|
|
|
|
|
|
|
|
/* no further testing needed */
|
|
|
|
get_dot();
|
|
|
|
return;
|
1988-08-07 22:55:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get_dot();
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
/******** U S A G E ********/
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE usage(stnr)
|
1988-08-07 22:55:20 +00:00
|
|
|
int stnr;
|
1988-05-30 17:17:16 +00:00
|
|
|
{
|
1991-03-08 15:54:05 +00:00
|
|
|
register struct inpdef *def =
|
|
|
|
(stnr ? sta : proto ? proto : ext ? ext : lib ? lib : 0);
|
1988-09-02 12:00:25 +00:00
|
|
|
register int VU_count = 0;
|
|
|
|
register int VU_samefile = 0;
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
while (same_obj(stnr) && dot->id_class == FC) {
|
|
|
|
one_func_call(def);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (same_obj(stnr) && dot->id_class == VU) {
|
1988-09-02 12:00:25 +00:00
|
|
|
VU_count++;
|
|
|
|
if (def && streq(def->id_file, dot->id_file)) {
|
|
|
|
VU_samefile++;
|
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
one_var_usage(def);
|
|
|
|
}
|
1988-09-02 12:00:25 +00:00
|
|
|
|
|
|
|
if (def && loptions['h']) {
|
|
|
|
register char *fn = def->id_file;
|
|
|
|
|
|
|
|
if ( stnr == 0
|
|
|
|
&& VU_count == 1
|
|
|
|
&& VU_samefile == 1
|
1991-03-08 15:54:05 +00:00
|
|
|
&& ( def == proto
|
|
|
|
|| (def == ext && !is_class(ext, CL_IMPL))
|
|
|
|
)
|
1988-09-02 12:00:25 +00:00
|
|
|
&& streq(&fn[strlen(fn)-2], ".c")
|
|
|
|
) {
|
|
|
|
report("%L: extern %s could be declared static",
|
|
|
|
def, def->id_name);
|
|
|
|
}
|
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
}
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE one_func_call(def)
|
1988-08-07 22:55:20 +00:00
|
|
|
struct inpdef *def;
|
|
|
|
{
|
|
|
|
if (!def) {
|
1988-09-02 12:00:25 +00:00
|
|
|
if (!loptions['u']) {
|
1988-08-07 22:55:20 +00:00
|
|
|
report("%L: function %s used but not defined",
|
|
|
|
dot, dot->id_name);
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
get_dot();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
def->id_called = 1;
|
|
|
|
|
|
|
|
if (def->id_args) {
|
1988-10-12 15:49:11 +00:00
|
|
|
chk_args(dot, def);
|
1988-09-02 12:00:25 +00:00
|
|
|
if ( dot->id_valused == USED
|
|
|
|
&& def->id_valreturned == NOVALRETURNED
|
|
|
|
) {
|
1988-08-07 22:55:20 +00:00
|
|
|
report("%L: value of %s is used, but none is returned at %L",
|
|
|
|
dot, dot->id_name, def);
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (dot->id_valused) {
|
|
|
|
case USED:
|
|
|
|
def->id_used = 1;
|
1988-05-30 17:17:16 +00:00
|
|
|
break;
|
1988-08-07 22:55:20 +00:00
|
|
|
case IGNORED:
|
|
|
|
def->id_ignored = 1;
|
1988-05-30 17:17:16 +00:00
|
|
|
break;
|
1988-08-07 22:55:20 +00:00
|
|
|
case VOIDED:
|
|
|
|
def->id_voided = 1;
|
1988-05-30 17:17:16 +00:00
|
|
|
break;
|
1988-08-07 22:55:20 +00:00
|
|
|
default:
|
1988-10-12 15:49:11 +00:00
|
|
|
panic("invalid dot->id_valused in one_func_call()");
|
1988-08-07 22:55:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
get_dot();
|
|
|
|
}
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE one_var_usage(def)
|
1988-08-07 22:55:20 +00:00
|
|
|
struct inpdef *def;
|
|
|
|
{
|
|
|
|
if (!def) {
|
1988-09-02 12:00:25 +00:00
|
|
|
if (!loptions['u']) {
|
1988-08-07 22:55:20 +00:00
|
|
|
report("%L: variable %s used but not defined",
|
|
|
|
dot, dot->id_name);
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
get_dot();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
def->id_called = 1;
|
|
|
|
|
|
|
|
get_dot();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******** S T A T I C ********/
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE statics()
|
1988-08-07 22:55:20 +00:00
|
|
|
{
|
1988-09-02 12:00:25 +00:00
|
|
|
while (same_name()) {
|
|
|
|
int stnr = dot->id_statnr;
|
|
|
|
|
1991-03-08 15:54:05 +00:00
|
|
|
if (stnr == 0) {
|
|
|
|
panic("sequence error in intermediate file: externals after statics");
|
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
|
|
|
|
if (sta) {
|
|
|
|
free_inpdef(sta);
|
|
|
|
sta = 0;
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1991-03-08 15:54:05 +00:00
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
stat_def(stnr);
|
|
|
|
usage(stnr);
|
1991-03-08 15:54:05 +00:00
|
|
|
|
|
|
|
if (sta) {
|
1988-10-12 15:49:11 +00:00
|
|
|
chk_def(sta);
|
1991-03-08 15:54:05 +00:00
|
|
|
}
|
1988-09-02 12:00:25 +00:00
|
|
|
|
1991-03-08 15:54:05 +00:00
|
|
|
if (same_obj(stnr)) {
|
|
|
|
panic("sequence error in intermediate file: statics out of order");
|
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
PRIVATE stat_def(stnr)
|
1988-08-07 22:55:20 +00:00
|
|
|
int stnr;
|
|
|
|
{
|
|
|
|
if (same_obj(stnr) && is_class(dot, CL_STAT|CL_DEF)) {
|
|
|
|
if (lib) {
|
1989-10-04 15:36:56 +00:00
|
|
|
report("%L: %s %s also defined in %L",
|
1991-03-08 15:54:05 +00:00
|
|
|
dot, fun_or_var(dot), dot->id_name, lib);
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1991-03-08 15:54:05 +00:00
|
|
|
if (proto || ext) {
|
|
|
|
struct inpdef *def = (proto ? proto : ext);
|
|
|
|
|
|
|
|
if (!streq(dot->id_file, def->id_file)) {
|
1988-09-30 15:20:24 +00:00
|
|
|
report("%L: %s %s also %s at %L",
|
1991-03-08 15:54:05 +00:00
|
|
|
dot, fun_or_var(dot), dot->id_name,
|
|
|
|
def_or_dec(def), def
|
|
|
|
);
|
1988-09-30 15:20:24 +00:00
|
|
|
}
|
1988-07-08 22:24:06 +00:00
|
|
|
}
|
1988-08-07 22:55:20 +00:00
|
|
|
sta = dot;
|
|
|
|
dot = new_inpdef();
|
|
|
|
get_dot();
|
1991-03-08 15:54:05 +00:00
|
|
|
while (same_obj(stnr) && is_class(dot, CL_STAT|CL_DEF)) {
|
|
|
|
report("%L: %s %s also defined at %L",
|
|
|
|
dot, fun_or_var(dot), dot->id_name, sta);
|
|
|
|
get_dot();
|
|
|
|
}
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1988-10-12 15:49:11 +00:00
|
|
|
PRIVATE chk_def(def)
|
1988-08-07 22:55:20 +00:00
|
|
|
struct inpdef *def;
|
1988-05-30 17:17:16 +00:00
|
|
|
{
|
1988-08-07 22:55:20 +00:00
|
|
|
if (!def)
|
|
|
|
return;
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
if (!def->id_called) {
|
|
|
|
if (streq(def->id_name, "main")) {
|
|
|
|
/* silent */
|
|
|
|
}
|
|
|
|
else if (ext && is_class(ext, CL_LIB)) {
|
|
|
|
/* silent */
|
|
|
|
}
|
|
|
|
else {
|
1988-09-02 12:00:25 +00:00
|
|
|
if (!loptions['u']) {
|
1989-10-04 15:36:56 +00:00
|
|
|
report("%L: %s %s not used anywhere",
|
1991-03-08 15:54:05 +00:00
|
|
|
def, fun_or_var(def), def->id_name);
|
1988-08-07 22:55:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
if (is_class(def, CL_DEF|CL_FUNC)) {
|
1988-09-02 12:00:25 +00:00
|
|
|
if ( def->id_valreturned == VALRETURNED
|
|
|
|
&& def->id_called
|
|
|
|
&& def->id_ignored
|
|
|
|
) {
|
1988-08-07 22:55:20 +00:00
|
|
|
report("%L: %s returns value which is %s ignored",
|
|
|
|
def, def->id_name,
|
|
|
|
(def->id_used || def->id_voided) ?
|
|
|
|
"sometimes" : "always");
|
|
|
|
}
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1988-08-07 22:55:20 +00:00
|
|
|
|
|
|
|
/******** D E B U G G I N G ********/
|
1988-05-30 17:17:16 +00:00
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
print_id(name, id)
|
|
|
|
char *name;
|
1988-05-30 17:17:16 +00:00
|
|
|
struct inpdef *id;
|
|
|
|
{
|
1991-03-08 15:54:05 +00:00
|
|
|
if (!id) {
|
|
|
|
print("%s: <NO_INPDEF>\n", name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1988-09-02 12:00:25 +00:00
|
|
|
print("%s: %s, %s, %04d, \"%s\", %d, %s", name,
|
1988-07-08 22:24:06 +00:00
|
|
|
id->id_class == LFDF ? "LFDF" :
|
|
|
|
id->id_class == LVDF ? "LVDF" :
|
1991-03-08 15:54:05 +00:00
|
|
|
id->id_class == PFDF ? "PFDF" :
|
1988-08-07 22:55:20 +00:00
|
|
|
id->id_class == EFDF ? "EFDF" :
|
|
|
|
id->id_class == EVDF ? "EVDF" :
|
1988-07-08 22:24:06 +00:00
|
|
|
id->id_class == EFDC ? "EFDC" :
|
|
|
|
id->id_class == EVDC ? "EVDC" :
|
|
|
|
id->id_class == IFDC ? "IFDC" :
|
1988-08-07 22:55:20 +00:00
|
|
|
id->id_class == SFDF ? "SFDF" :
|
|
|
|
id->id_class == SVDF ? "SVDF" :
|
1988-07-08 22:24:06 +00:00
|
|
|
id->id_class == FC ? "FC" :
|
1988-09-02 12:00:25 +00:00
|
|
|
id->id_class == VU ? "VU" : "<BADCLASS>",
|
1988-05-30 17:17:16 +00:00
|
|
|
id->id_name,
|
1988-07-08 22:24:06 +00:00
|
|
|
id->id_statnr,
|
1988-05-30 17:17:16 +00:00
|
|
|
id->id_file,
|
|
|
|
id->id_line,
|
1988-08-07 22:55:20 +00:00
|
|
|
id->id_type
|
|
|
|
);
|
|
|
|
if (is_class(id, CL_FUNC|CL_DEF) || is_class(id, CL_FUNC|CL_USAGE)) {
|
|
|
|
print(", %d, %s, %s",
|
|
|
|
id->id_nrargs,
|
1991-03-08 15:54:05 +00:00
|
|
|
(id->id_nrargs == 0 ? "" : id->id_argtps),
|
|
|
|
( id->id_class == FC
|
|
|
|
? ( id->id_valused == USED ? "USED" :
|
|
|
|
id->id_valused == IGNORED ? "IGNORED" :
|
|
|
|
id->id_valused == VOIDED ? "VOIDED" :
|
|
|
|
"<BAD VALUSED>"
|
|
|
|
)
|
|
|
|
: ( id->id_valreturned == NOVALRETURNED
|
|
|
|
? "NOVALRETURNED"
|
|
|
|
: id->id_valreturned == VALRETURNED
|
|
|
|
? "VALRETURNED"
|
|
|
|
: id->id_valreturned == NORETURN
|
|
|
|
? "NORETURN"
|
|
|
|
: "<BAD VALRETURNED>"
|
1988-09-02 12:00:25 +00:00
|
|
|
)
|
1991-03-08 15:54:05 +00:00
|
|
|
)
|
1988-08-07 22:55:20 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
print("\n");
|
1988-05-30 17:17:16 +00:00
|
|
|
}
|
1988-07-08 22:24:06 +00:00
|
|
|
|