On Fri, Jan 3, 2014 at 6:42 PM, Jeffrey Kegler <
[email protected]> wrote:
> Thanks. This was actually extremely helpful. Because of the RETVAL
> errors, I'd turned off "unused variable" warnings, with the result that
> quite a number of unused variables crept in over time. I've gone back,
> turned the warning back on, and eliminated them all. The final obstacle
> were the "class" arguments to the "new" constructors, for which I found
> PERL_UNUSED_ARG.
>
Well, unused RETVALs can be fixed by changing return type to void, e.g.
diff --git a/cpan/xs/R2.xs b/cpan/xs/R2.xs
index 34ef32c..8566ffd 100644
-Marpa_Rule_ID
+ # Actually returns Marpa_Rule_ID, void is here to eliminate RETVAL
+ # that remains unused with PPCODE
+void
rule_new( g_wrapper, lhs, rhs_av )
G_Wrapper *g_wrapper;
Marpa_Symbol_ID lhs;
@@ -2535,7 +2537,8 @@ PPCODE:
# the hash args. This seems to be the way things are
With patches like above, I was able to do *make releng* under cygwin and
then build, test and install the resulting dist under windows.
I can file a pull request if that's ok with you.
> All fixed as of commit af173bf
>
Great to hear that, confirmed.
-- jeffrey
>
ruslan
P.S. On a related note, this pull
request<https://github.com/jeffreykegler/Marpa--R2/pull/65> silences
66 irrelevant 'unnamed type definition in parentheses' warnings with MS C
compiler under Windows.
>
> On 01/03/2014 06:45 AM, Ruslan Shvedov wrote:
>
> That's probably premature, so I put it here for memory until the
> suitable time comes.
>
> *warning C4101: unreferenced local variable* (7 times)
> as in
> lib\Marpa\R2.xs(610) : warning C4101: 'input_length' : unreferenced
> local variable
> lib\Marpa\R2.xs(1205) : warning C4101: 'dummy' : unreferenced local
> variable
> lib\Marpa\R2.xs(1457) : warning C4101: 'dummy' : unreferenced local
> variable
> lib\Marpa\R2.xs(1567) : warning C4101: 'is_expected' : unreferenced local
> variable
> lib\Marpa\R2.xs(1884) : warning C4101: 'symbol_r_properties' :
> unreferenced local variable
> lib\Marpa\R2.xs(4828) : warning C4101: 'new_sv' : unreferenced local
> variable
> lib\Marpa\R2.xs(5493) : warning C4101: 'length' : unreferenced local
> variable
>
> This can be deleted (the tests pass and the dist is built ok without
> them), but they can be there for a reason, e.g. for readability or as
> placeholder/boilerplate so I'd better ask.
>
> *warning C4101: 'RETVAL' : unreferenced local variable *(a couple dozen
> times)
> as in lib\Marpa\R2.c(2720) : warning C4101: 'RETVAL' : unreferenced
> local variable
>
> This is caused by not using void with PPCODE [1]. The warnings can be
> silenced by changing e.g. Marpa_Rule_ID to void in R2.xs line 2500 and
> (perhaps) putting Marpa_Rule_ID in a comment and the code compiles and
> builds and tests, but again, typed C functions can be more
> readable/boilerplate for future, so asking is in order.
>
> [1] In most scenarios the void return type should be used with the
> PPCODE: directive.
> — http://perldoc.perl.org/perlxs.html#The-PPCODE%3a-Keyword
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.