[Spice-devel] [PATCH 06/17] Replace inefficient C-style initialization with C++-style

Christophe de Dinechin christophe.de.dinechin at gmail.com
Fri Feb 16 16:51:53 UTC 2018



> On 16 Feb 2018, at 17:43, Frediano Ziglio <fziglio at redhat.com> wrote:
> 
>> 
>> From: Christophe de Dinechin <dinechin at redhat.com>
>> 
>> Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
>> ---
>> src/spice-streaming-agent.cpp | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>> 
>> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
>> index 9b8fd45..69c27a3 100644
>> --- a/src/spice-streaming-agent.cpp
>> +++ b/src/spice-streaming-agent.cpp
>> @@ -251,9 +251,7 @@ static void handle_interrupt(int intr)
>> 
>> static void register_interrupts(void)
>> {
>> -    struct sigaction sa;
>> -
>> -    memset(&sa, 0, sizeof(sa));
>> +    struct sigaction sa = { };
>>     sa.sa_handler = handle_interrupt;
>>     if ((sigaction(SIGINT, &sa, NULL) != 0) &&
>>         (sigaction(SIGTERM, &sa, NULL) != 0)) {
> 
> Not your fault but I think the RHEL 7 compiler is not that smart/correct :-(
> 
> 
> spice-streaming-agent.cpp: In function 'void register_interrupts()':
> spice-streaming-agent.cpp:423:29: warning: missing initializer for member 'sigaction::__sigaction_handler' [-Wmissing-field-initializers]
>     struct sigaction sa = { };
>                             ^
> spice-streaming-agent.cpp:423:29: warning: missing initializer for member 'sigaction::sa_mask' [-Wmissing-field-initializers]
> spice-streaming-agent.cpp:423:29: warning: missing initializer for member 'sigaction::sa_flags' [-Wmissing-field-initializers]
> spice-streaming-agent.cpp:423:29: warning: missing initializer for member 'sigaction::sa_restorer' [-Wmissing-field-initializers]
> 
Ach. Pity. I had tried on Fed25, not RHEL7 :-(

On Fed25, you get that for { 0 }, but not with { }…



> 
> Frediano
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



More information about the Spice-devel mailing list