[PATCH weston] simple-shm: Don't use ret variable in main() uninitialized

Ander Conselvan de Oliveira conselvan2 at gmail.com
Thu Oct 18 00:54:20 PDT 2012


On 10/17/2012 11:53 PM, Kristian Høgsberg wrote:
> On Wed, Oct 17, 2012 at 01:49:08PM +0300, Ander Conselvan de Oliveira wrote:
>
> Argh, thanks.  I don't get a warning about ret being unused, and I did
> check the -Wall was in the compiler flags...

I'm not really sure, but it looks like

   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18501

I have the same behavior with the following simpler snippet

extern int f();

int
main()
{
   int ret;

   while (ret != 0)
     ret = f();

   return ret;
}


Ander


> Kristian
>
>> ---
>>   clients/simple-shm.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/clients/simple-shm.c b/clients/simple-shm.c
>> index d03bed6..a09ec91 100644
>> --- a/clients/simple-shm.c
>> +++ b/clients/simple-shm.c
>> @@ -328,7 +328,7 @@ main(int argc, char **argv)
>>   	struct sigaction sigint;
>>   	struct display *display;
>>   	struct window *window;
>> -	int ret;
>> +	int ret = 0;
>>
>>   	display = create_display();
>>   	window = create_window(display, 250, 250);
>> --
>> 1.7.9.5
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>



More information about the wayland-devel mailing list