[PATCH] Fix build warnings in nptl/tst-eintr1.c

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Fix build warnings in nptl/tst-eintr1.c

Stefan Liebler-2
Hi,

this patch fixes the gcc warnings seen with gcc 9.1 -O3 on s390x:
tst-eintr1.c: In function ‘tf1’:
tst-eintr1.c:46:1: error: no return statement in function returning
non-void [-Werror=return-type]
     46 | }
        | ^
tst-eintr1.c: In function ‘do_test’:
tst-eintr1.c:57:17: error: unused variable ‘th’ [-Werror=unused-variable]
     57 |       pthread_t th = xpthread_create (NULL, tf1, NULL);
        |                 ^~

Bye
Stefan

ChangeLog:

        * nptl/tst-eintr1.c (tf1): Add return statement.
        (do_test): Remove unused th variable.


20190624_warnings_nptl_tst-eintr1.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix build warnings in nptl/tst-eintr1.c

Florian Weimer-5
* Stefan Liebler:

> diff --git a/nptl/tst-eintr1.c b/nptl/tst-eintr1.c
> index b60b796d61..256f5e94f8 100644
> --- a/nptl/tst-eintr1.c
> +++ b/nptl/tst-eintr1.c
> @@ -43,6 +43,7 @@ tf1 (void *arg)
>        pthread_t th = xpthread_create (NULL, tf2, NULL);
>        xpthread_join (th);
>      }
> +  return NULL;
>  }
>  
>  
> @@ -54,7 +55,7 @@ do_test (void)
>    int i;
>    for (i = 0; i < 10; ++i)
>      {
> -      pthread_t th = xpthread_create (NULL, tf1, NULL);
> +      xpthread_create (NULL, tf1, NULL);
>      }

Looks good.  But you could remove the braces from the for loop, too.

Thanks,
Florian
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix build warnings in nptl/tst-eintr1.c

Stefan Liebler-2
On 6/25/19 3:19 PM, Florian Weimer wrote:

> * Stefan Liebler:
>
>> diff --git a/nptl/tst-eintr1.c b/nptl/tst-eintr1.c
>> index b60b796d61..256f5e94f8 100644
>> --- a/nptl/tst-eintr1.c
>> +++ b/nptl/tst-eintr1.c
>> @@ -43,6 +43,7 @@ tf1 (void *arg)
>>         pthread_t th = xpthread_create (NULL, tf2, NULL);
>>         xpthread_join (th);
>>       }
>> +  return NULL;
>>   }
>>  
>>  
>> @@ -54,7 +55,7 @@ do_test (void)
>>     int i;
>>     for (i = 0; i < 10; ++i)
>>       {
>> -      pthread_t th = xpthread_create (NULL, tf1, NULL);
>> +      xpthread_create (NULL, tf1, NULL);
>>       }
>
> Looks good.  But you could remove the braces from the for loop, too.
Okay. That's no problem. If no one opposes, I'll commit the patch
tomorrow without the braces.
>
> Thanks,
> Florian
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix build warnings in nptl/tst-eintr1.c

Stefan Liebler-2
On 6/25/19 3:33 PM, Stefan Liebler wrote:

> On 6/25/19 3:19 PM, Florian Weimer wrote:
>> * Stefan Liebler:
>>
>>> diff --git a/nptl/tst-eintr1.c b/nptl/tst-eintr1.c
>>> index b60b796d61..256f5e94f8 100644
>>> --- a/nptl/tst-eintr1.c
>>> +++ b/nptl/tst-eintr1.c
>>> @@ -43,6 +43,7 @@ tf1 (void *arg)
>>>         pthread_t th = xpthread_create (NULL, tf2, NULL);
>>>         xpthread_join (th);
>>>       }
>>> +  return NULL;
>>>   }
>>> @@ -54,7 +55,7 @@ do_test (void)
>>>     int i;
>>>     for (i = 0; i < 10; ++i)
>>>       {
>>> -      pthread_t th = xpthread_create (NULL, tf1, NULL);
>>> +      xpthread_create (NULL, tf1, NULL);
>>>       }
>>
>> Looks good.  But you could remove the braces from the for loop, too.
> Okay. That's no problem. If no one opposes, I'll commit the patch
> tomorrow without the braces.
>>
>> Thanks,
>> Florian
>>
>
Committed.

Thanks.