add interface-check warning option. defaults off

This commit is contained in:
Bill Currie 2003-07-29 18:31:12 +00:00
parent d05f17cdae
commit 5e6b25c917
4 changed files with 15 additions and 4 deletions

View file

@ -159,6 +159,10 @@ Emit a warning when the source assigns a value to a named constant. See the
description of the \fBcow\fP code option above for a description of what this
means.
.TP
.B interface\-check
Emit a warning when a method is declared in an implementation but not in the
interface for a class.
.TP
.B undef\-function
Emit a warning when a function is called, but has not yet been defined.
.TP

View file

@ -47,6 +47,7 @@ typedef struct {
qboolean uninited_variable; // Warn on use of uninitialized vars
qboolean vararg_integer; // Warn on passing an integer to vararg func
qboolean integer_divide; // Warn on integer constant division
qboolean interface_check; // Warn for methods not in interface
} warn_options_t;
typedef struct {

View file

@ -411,10 +411,12 @@ class_find_method (class_type_t *class_type, method_t *method)
}
sel = dstring_newstr ();
selector_name (sel, (keywordarg_t *)method->selector);
warning (0, "%s method %s not in %s%s",
method->instance ? "instance" : "class",
sel->str, class_name,
category_name ? va (" (%s)", category_name) : "");
if (options.warnings.interface_check) {
warning (0, "%s method %s not in %s%s",
method->instance ? "instance" : "class",
sel->str, class_name,
category_name ? va (" (%s)", category_name) : "");
}
dstring_delete (sel);
return method;
}

View file

@ -307,6 +307,10 @@ DecodeArgs (int argc, char **argv)
options.warnings.integer_divide = true;
} else if (!(strcasecmp (temp, "no-integer-divide"))) {
options.warnings.integer_divide = false;
} else if (!(strcasecmp (temp, "interface-check"))) {
options.warnings.interface_check = true;
} else if (!(strcasecmp (temp, "no-interface-check"))) {
options.warnings.interface_check = false;
}
temp = strtok (NULL, ",");
}