www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Issue 3882

reply =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
I believe I found a good solution to Issue 3882:
https://d.puremagic.com/issues/show_bug.cgi?id=3882

It works as expected and I found two bugs in my code with it.

My current solution is to add the following at line 147 in
dmd/src/sideeffect.c:

       case TOKcall:
             /* Issue 3882: Don't complain about calling functions
with no effect,
              * because purity and nothrow are inferred, and
because some of the
              * runtime library depends on it. Needs more
investigation.
              */
             if (global.params.warnings && !global.gag)
             {
                 if (e->type->ty == Tvoid)
                 {
                     /* TODO: Restrict this message to call
hierarchies that
                      * never call assert (and or not called from
inside
                      * unittest blocks) */
                     /* e->warning("Call %s with void return has
no effect", e->toChars()); */
                 }
                 else
                 {
                     e->warning("Call %s with no effect discards
return value", e->toChars());
                 }
             }
             return;

Does it suffice to just do a pull request referring to Issue 3882.

/Per
Feb 28 2014
parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Friday, 28 February 2014 at 10:38:39 UTC, Nordlöw wrote:
 I believe I found a good solution to Issue 3882:
 https://d.puremagic.com/issues/show_bug.cgi?id=3882

 It works as expected and I found two bugs in my code with it.

 My current solution is to add the following at line 147 in
 dmd/src/sideeffect.c:

       case TOKcall:
             /* Issue 3882: Don't complain about calling 
 functions
 with no effect,
              * because purity and nothrow are inferred, and
 because some of the
              * runtime library depends on it. Needs more
 investigation.
              */
             if (global.params.warnings && !global.gag)
             {
                 if (e->type->ty == Tvoid)
                 {
                     /* TODO: Restrict this message to call
 hierarchies that
                      * never call assert (and or not called from
 inside
                      * unittest blocks) */
                     /* e->warning("Call %s with void return has
 no effect", e->toChars()); */
                 }
                 else
                 {
                     e->warning("Call %s with no effect discards
 return value", e->toChars());
                 }
             }
             return;

 Does it suffice to just do a pull request referring to Issue 
 3882.

 /Per

I can't comment on the validity of your solution, but yes: the procedure is to just create a pull request referencing the bugzilla report.
Feb 28 2014