On 30/06/11 20:33, Lars Ellenberg wrote:
> On Wed, Jun 29, 2011 at 12:55:08PM +0100, Pádraig Brady wrote:
>> On 29/06/11 11:56, Lars Ellenberg wrote:
>>> On Tue, Jun 28, 2011 at 01:44:23AM +0100, Pádraig Brady wrote:
>>>> The attached patch fixes compilation -Werrors with GCC 4.6
>>>>
>>>> cheers,
>>>> Pádraig.
>>>>
>>>
>>>> Fix compilation with GCC 4.6
>>>>
>>>> avoid -Werror=unused-but-set-variable issues
>>>> remove -Wcast-qual which caused issues with copyHostList()
>>>
>>> Care to explain or show those "issues"?
>>
>> All uses of copyHostList error like:
>>
>> apcsmart.c: In function 'apcsmart_hostlist':
>> apcsmart.c:722:34: error: to be safe all intermediate pointers in cast from 
>> 'char **' to 'const char **' must be 'const' qualified [-Werror=cast-qual]
> 
> From the gcc 4.5 documentation:
> -Wcast-qual
>       Warn whenever a pointer is cast so as to remove a type qualifier from 
> the target
>       type. For example, warn if a const char * is cast to an ordinary char *.
>       Also warn when making a cast which introduces a type qualifier in an 
> unsafe
>       way. For example, casting char ** to const char ** is unsafe, as in 
> this ex-
>       ample:
>               /* p is char ** value. */
>               const char **q = (const char **) p;
>               /* Assignment of readonly string to const char * is OK.
>               *q = "string";
>               /* Now char** pointer points to read-only memory. */
>               **p = ’b’;
> 
> So apparently it needs to be
> 
> include/stonith/stonith_plugin.h:
>  struct StonithImports_s {
>  ...
> -     char **(*CopyHostList)(const char ** hlstring);
> +     char **(*CopyHostList)(const char * const * hlstring);
> 
> And the callers have to be adjusted accordingly?
> Could you check if that works?

Sure, that would work but would involve a lot of changes I think.
I was unsure how changing this interface might affect users
outside this project, but if that's OK I'll go ahead
and change that (tomorrow when I'm more awake).

Oh and originally I forgot to mention that
these changes are required to get this project to
compile on Fedora 15.

cheers,
Pádraig.
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to