Bug 5413 – (diagnostic): No notification that warnings are treated as errors
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-01-05T07:27:20Z
Last change time
2023-08-07T13:47:19Z
Keywords
bootcamp, diagnostic, trivial
Assigned to
No Owner
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2011-01-05T07:27:20Z
Not a bug, just a diagnostic suggestion.
When compiling with warnings turned on, there is no visual output suggesting whether or not that warning is ignored or enforced as an error:
ie:
int main()
{
return 0;
return 1;
}
$ dmd test.d -w
test.d(4): Warning: statement is not reachable
$ dmd test.d -wi
test.d(4): Warning: statement is not reachable
Would be handy if confronted with a notification that warnings are being treated as errors by the compiler.
This small addition to vwarning has a nice effect:
{
char *p = loc.toChars();
+ if (global.params.warnings == 1)
+ fprintf(stdmsg, "%s: warnings being treated as errors\n", global.params.argv0);
+
if (*p)
fprintf(stdmsg, "%s: ", p);
mem.free(p);
$ dmd test.d -w
dmd: warnings being treated as errors
test.d(4): Warning: statement is not reachable
$ dmd test.d -wi
test.d(4): Warning: statement is not reachable
Regards
Comment #1 by nick — 2023-08-07T13:47:19Z
Has since been implemented in 2.097.2:
spellrecurse.d(6): Warning: statement is not reachable
Error: warnings are treated as errors
Use -wi if you wish to treat warnings only as informational.
Compilation failed.