[Pacemaker] [PATCH] Dev: build: avoid GCC 4.6 warnings

Pádraig Brady P at draigBrady.com
Tue Jul 12 09:01:51 UTC 2011


On 12/07/11 02:56, Andrew Beekhof wrote:
> 2011/7/1 Pádraig Brady <P at draigbrady.com>:
>> On 01/07/11 07:34, Andrew Beekhof wrote:
>>> 2011/6/28 Pádraig Brady <P at draigbrady.com>:
>>>> # HG changeset patch
>>>> # User Pádraig Brady <P at draigBrady.com>
>>>> # Date 1309255312 -3600
>>>> # Node ID 7948a86a7e9510db13baa318fe64e9015fdbbd72
>>>> # Parent  75575ce398615dff21e2309c6b97523e99499498
>>>> Dev: build: avoid GCC 4.6 warnings
>>>>
>>>> diff -r 75575ce39861 -r 7948a86a7e95 crmd/election.c
>>>> --- a/crmd/election.c   Tue Jun 21 15:54:20 2011 +0200
>>>> +++ b/crmd/election.c   Tue Jun 28 11:01:52 2011 +0100
>>>> @@ -445,6 +445,8 @@
>>>>            }
>>>>
>>>>            last_election_win = time(NULL);
>>>> +#else
>>>> +            (void) last_election_win;
>>>>  #endif
>>>>            register_fsa_input(C_FSA_INTERNAL, I_ELECTION, NULL);
>>>>            g_hash_table_destroy(voted);
>>>
>>> Why is this necessary?  last_election_win is already used outside of
>>> the #if 0 block.
>>
>> It's only written to outside the #if 0 block,
>> never read.
> 
> Do you happen to know the flags to turn off this warning?

$ make
election.c: In function ‘do_election_count_vote’:
election.c:259:16: error: variable ‘last_election_win’ set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors

So -Wnounused-but-set-variable will disable that particular warning.

cheers,
Pádraig.




More information about the Pacemaker mailing list