[v4,04/15] nptl_db/thread_dbP.h: fix warn unused result

Message ID 20230428122142.928135-5-fberat@redhat.com
State Superseded
Delegated to: Siddhesh Poyarekar
Headers
Series Fix warn unused result |

Commit Message

Frederic Berat April 28, 2023, 12:21 p.m. UTC
  Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.
---
 nptl_db/thread_dbP.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Siddhesh Poyarekar May 25, 2023, 12:51 a.m. UTC | #1
On 2023-04-28 08:21, Frédéric Bérat wrote:
> Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
> glibc.
> ---
>   nptl_db/thread_dbP.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

LGTM.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

> 
> diff --git a/nptl_db/thread_dbP.h b/nptl_db/thread_dbP.h
> index 8845722109..4a9333658b 100644
> --- a/nptl_db/thread_dbP.h
> +++ b/nptl_db/thread_dbP.h
> @@ -61,7 +61,7 @@ enum
>   
>   /* Comment out the following for less verbose output.  */
>   #ifndef NDEBUG
> -# define LOG(c) if (__td_debug) write (2, c "\n", strlen (c "\n"))
> +# define LOG(c) if (__td_debug) assert (write (2, c "\n", strlen (c "\n")) == strlen (c "\n"))
>   extern int __td_debug attribute_hidden;
>   #else
>   # define LOG(c)
  
Siddhesh Poyarekar May 25, 2023, 1:52 a.m. UTC | #2
On 2023-05-24 20:51, Siddhesh Poyarekar wrote:
> 
> 
> On 2023-04-28 08:21, Frédéric Bérat wrote:
>> Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
>> glibc.
>> ---
>>   nptl_db/thread_dbP.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> LGTM.
> 
> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

Actually...

>>
>> diff --git a/nptl_db/thread_dbP.h b/nptl_db/thread_dbP.h
>> index 8845722109..4a9333658b 100644
>> --- a/nptl_db/thread_dbP.h
>> +++ b/nptl_db/thread_dbP.h
>> @@ -61,7 +61,7 @@ enum
>>   /* Comment out the following for less verbose output.  */
>>   #ifndef NDEBUG
>> -# define LOG(c) if (__td_debug) write (2, c "\n", strlen (c "\n"))
>> +# define LOG(c) if (__td_debug) assert (write (2, c "\n", strlen (c 
>> "\n")) == strlen (c "\n"))

This crossed 79 chars and needs to be split.

>>   extern int __td_debug attribute_hidden;
>>   #else
>>   # define LOG(c)
>
  

Patch

diff --git a/nptl_db/thread_dbP.h b/nptl_db/thread_dbP.h
index 8845722109..4a9333658b 100644
--- a/nptl_db/thread_dbP.h
+++ b/nptl_db/thread_dbP.h
@@ -61,7 +61,7 @@  enum
 
 /* Comment out the following for less verbose output.  */
 #ifndef NDEBUG
-# define LOG(c) if (__td_debug) write (2, c "\n", strlen (c "\n"))
+# define LOG(c) if (__td_debug) assert (write (2, c "\n", strlen (c "\n")) == strlen (c "\n"))
 extern int __td_debug attribute_hidden;
 #else
 # define LOG(c)