develooper Front page | perl.perl6.internals | Postings from April 2008

Re: [perl #53352] Build warnings in STRUCT_COPY

Thread Previous | Thread Next
From:
NotFound
Date:
April 26, 2008 09:03
Subject:
Re: [perl #53352] Build warnings in STRUCT_COPY
Hello

>  The following lines that use the STRUCT_COPY macro are generating
>  build warnings.
>
>  src/charset/ascii.c:792: warning: the address of 'base_set' will
>  always evaluate as 'true'
(snip)
>  For example, the last line here is:
>
>  STRUCT_COPY(return_encoding, &base_encoding);
>
>  but base_encoding is declared just before that: static const ENCODING
>  base_encoding = {...}
>
>  The PARROT_ASSERT in the macro against base_encoding is then
>  apparently superfluous.

I'v taken a look a those warnings some days ago. The macro STRUCT_COPY
is generic and asserts his two parameter as non null, but is used in
several places with arguments that the compiler knows is not, making
the assertion redundant. But dropping the assertion will leave
unchecked other usages.

A possible solution is to add another macro taking as second argument
the struct instead of a pointer.

-- 
Salu2

Thread Previous | Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About