D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5413 - (diagnostic): No notification that warnings are treated as errors
Summary: (diagnostic): No notification that warnings are treated as errors
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords: bootcamp, diagnostic, trivial
Depends on:
Blocks:
 
Reported: 2011-01-05 07:27 UTC by Iain Buclaw
Modified: 2023-08-07 13:47 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2011-01-05 07:27:20 UTC
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 Nick Treleaven 2023-08-07 13:47:19 UTC
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.