[34/40] sim/rx: Mark unused function

Message ID 568d957b97fadfee53f3450dfd083ca895d1f0bf.1666258361.git.research_trasio@irq.a4lg.com
State Committed
Headers
Series sim+gdb: Suppress warnings if built with Clang (big batch 1) |

Commit Message

Tsukasa OI Oct. 20, 2022, 9:32 a.m. UTC
  Clang generates a warning if there is a unused static function
("-Wunused-function").  On the default configuration, it causes a build
failure (unless "--disable-werror" is specified).

Although that this is completely unused, the author considers that this is
_happened to be_ unused and choose to keep this function for now.

Instead, this commit adds ATTRIBUTE_UNUSED.
---
 sim/rx/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Mike Frysinger Oct. 23, 2022, 3:14 p.m. UTC | #1
lgtm
-mike
  
Andrew Burgess Oct. 24, 2022, 4:30 p.m. UTC | #2
Tsukasa OI <research_trasio@irq.a4lg.com> writes:

> Clang generates a warning if there is a unused static function
> ("-Wunused-function").  On the default configuration, it causes a build
> failure (unless "--disable-werror" is specified).
>
> Although that this is completely unused, the author considers that this is
> _happened to be_ unused and choose to keep this function for now.

What does "happen to be" mean?  The function isn't used, right?

I'd like to request this patch not be merged.  I think the function
should just be deleted as unused.  If/when there's a need for it, we can
just bring it back.

Thanks,
Andrew




>
> Instead, this commit adds ATTRIBUTE_UNUSED.
> ---
>  sim/rx/rx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sim/rx/rx.c b/sim/rx/rx.c
> index 70b1b9729b7..8646c20d108 100644
> --- a/sim/rx/rx.c
> +++ b/sim/rx/rx.c
> @@ -754,7 +754,7 @@ typedef union {
>    float f;
>  } FloatInt;
>  
> -static inline int
> +static inline int ATTRIBUTE_UNUSED
>  float2int (float f)
>  {
>    FloatInt fi;
> -- 
> 2.34.1
  
Tsukasa OI Oct. 29, 2022, 11:58 a.m. UTC | #3
On 2022/10/25 1:30, Andrew Burgess wrote:
> Tsukasa OI <research_trasio@irq.a4lg.com> writes:
> 
>> Clang generates a warning if there is a unused static function
>> ("-Wunused-function").  On the default configuration, it causes a build
>> failure (unless "--disable-werror" is specified).
>>
>> Although that this is completely unused, the author considers that this is
>> _happened to be_ unused and choose to keep this function for now.
> 
> What does "happen to be" mean?  The function isn't used, right?

Why did I say that?  Perhaps I usually prefer symmetry.
But since we can easily restore it, I agree to just remove the function.

Thanks,
Tsukasa

> 
> I'd like to request this patch not be merged.  I think the function
> should just be deleted as unused.  If/when there's a need for it, we can
> just bring it back.
> 
> Thanks,
> Andrew
> 
> 
> 
> 
>>
>> Instead, this commit adds ATTRIBUTE_UNUSED.
>> ---
>>  sim/rx/rx.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sim/rx/rx.c b/sim/rx/rx.c
>> index 70b1b9729b7..8646c20d108 100644
>> --- a/sim/rx/rx.c
>> +++ b/sim/rx/rx.c
>> @@ -754,7 +754,7 @@ typedef union {
>>    float f;
>>  } FloatInt;
>>  
>> -static inline int
>> +static inline int ATTRIBUTE_UNUSED
>>  float2int (float f)
>>  {
>>    FloatInt fi;
>> -- 
>> 2.34.1
>
  

Patch

diff --git a/sim/rx/rx.c b/sim/rx/rx.c
index 70b1b9729b7..8646c20d108 100644
--- a/sim/rx/rx.c
+++ b/sim/rx/rx.c
@@ -754,7 +754,7 @@  typedef union {
   float f;
 } FloatInt;
 
-static inline int
+static inline int ATTRIBUTE_UNUSED
 float2int (float f)
 {
   FloatInt fi;