MIPSpro diagnostics
From NetBSD Wiki
The MIPSpro compilers assign a unique ID to every warning and error message and allows the user to treat them as errors, warnings, remarks, or to suppress them altogether.
Contents |
Some of the commonly seen MIPSpro diagnostics
| number | message |
|---|---|
| 1047 | Macro %s (declared at line %d of "%s") has an incompatible redefinition. |
| 1164 | Argument of type "%s" is incompatible with parameter of type "%s". |
| 1183 | An unsigned integer is being compared to zero. |
| 1185 | An enumerated type is mixed with another type. |
| 1552 | The variable "%s" is set but never used. |
| 3187 | A pointer is converted to a smaller integer. |
The number of the diagnostic appears at the very beginning, after the string cc-. For example:
cc-3201 cc: ERROR File = same.c, Line = 658
The parameter "entry" was never referenced.
static void delete_name_entry(struct name_entry *entry attribute_unused)
^
You can get an explanation for this diagnostic by running the following command:
$ explain cc.cat-3201 The %n was never referenced. The %n was never referenced. If you are not going to use a parmeter, you should elimiate it to save time and memory.
Obtaining the complete list of diagnostics
SGI hasn't published the complete list of diagnostics, and I suspect that they claim a copyright on it, so I won't publish it here neither. (XXX: Is that correct English?) But if you, for whatever reason, need the full list of diagnostics, you can use the following program:
#include <assert.h>
#include <nl_types.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
nl_catd d;
int i;
const char *s;
d = catopen(argv[1], 0);
assert(d != (nl_catd) -1);
for (i = 1; i < 10000; i++) {
if ((s = catgets(d, 1, i, NULL)) != NULL)
printf("%d\t%s\n", i, s);
}
return 0;
}
Run this program as ./a.out cc.cat.
Fixing the diagnostics properly
cc-1209: The controlling expression is constant.
TODO
cc-3201: The %n was never referenced.
When you put a comment of the form /* ARGSUSEDn */ in front of the function, that means the first n arguments are not necessarily used.
