You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pbarada (via GitHub)" <gi...@apache.org> on 2026/04/12 18:09:52 UTC

[PR] nuttx: Suppress UNUSED potential warnings [nuttx]

pbarada opened a new pull request, #18719:
URL: https://github.com/apache/nuttx/pull/18719

   ## Summary
   
   Update UNUSED(a) for GCC to cast 'a' to void to suppress potential "address of 'xxx' will always evaluate to true" warning when enabling warnings in system headers.
   
   ## Impact
   
   User experience: No adaptation required.
   Build: No impact.
   Hardware: Should not affect GCC builds.
   Documentation: No impact.
   Security: No impact.
   Compatibility: No impact.
   
   ## Testing
   
   Build Host:
   
   - OS: Ubuntu 24.04.4 LTS
   - Compiler: arm-none-eabi-gcc 13.2.1
   
   Target: None
   Built all ARM builds using modified tools/testbuild.sh script with increased warnings (-Wall -Wextra -Wsystem-headers), verified no warnings from invocations of UNUSED() macro.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] nuttx: Suppress UNUSED potential warnings [nuttx]

Posted by "raiden00pl (via GitHub)" <gi...@apache.org>.
raiden00pl commented on PR #18719:
URL: https://github.com/apache/nuttx/pull/18719#issuecomment-4234585293

   @xiaoxiang781216 what are the consequences of this change? looking at git history, changes in this macro were made by Xiaomi, so they probably had some purpose:
   
   1. change from `((void)(a))` to `((void)(1 || (a)))`:
   https://github.com/apache/nuttx/pull/3212
   
   ```
   commit 3813634dc98f3b77122bb1fcc17f818f08521225
   Author: Xiang Xiao <xi...@xiaomi.com>
   Date:   Mon Mar 29 14:08:03 2021 +0800
   
       Refine UNUSED macro to avoid any side effect
       
       Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
       Change-Id: I35d858fc6fb2e0e24b993ab7dd2203c9dd35232a
   
   ```
   
   2. change from `((void)(1 || (a)))` to `((void)(1 || &(a)))`:
   https://github.com/apache/nuttx/pull/6779
   
   ```
   commit 0083a2e4f29ac8574eeda895803f2a7447d89680
   Author: liyi <li...@xiaomi.com>
   Date:   Thu Aug 4 14:54:31 2022 +0800
   
       optimize UNUSED macro
       
       Signed-off-by: liyi <li...@xiaomi.com>
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] nuttx: Suppress UNUSED potential warnings [nuttx]

Posted by "pbarada (via GitHub)" <gi...@apache.org>.
pbarada commented on PR #18719:
URL: https://github.com/apache/nuttx/pull/18719#issuecomment-4237151675

   Its not that the expression generates code to evaluate it, more that the semantics of the expression involving the address of the variable always evaluates to true - which GCC potentially will warn about.  Note this change is only enabled for GCC(and derivatives).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] nuttx: Suppress UNUSED potential warnings [nuttx]

Posted by "pbarada (via GitHub)" <gi...@apache.org>.
pbarada closed pull request #18719: nuttx: Suppress UNUSED potential warnings
URL: https://github.com/apache/nuttx/pull/18719


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] nuttx: Suppress UNUSED potential warnings [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #18719:
URL: https://github.com/apache/nuttx/pull/18719#issuecomment-4234862348

   > @xiaoxiang781216 what are the consequences of this change? looking at git history, changes in this macro were made by Xiaomi, so they probably had some purpose:
   > 
   > 1. change from `((void)(a))` to `((void)(1 || (a)))`:
   >    [fs/lfs: Update version to 2.4.0 #3212](https://github.com/apache/nuttx/pull/3212)
   > 
   > ```
   > commit 3813634dc98f3b77122bb1fcc17f818f08521225
   > Author: Xiang Xiao <xi...@xiaomi.com>
   > Date:   Mon Mar 29 14:08:03 2021 +0800
   > 
   >     Refine UNUSED macro to avoid any side effect
   >     
   >     Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
   >     Change-Id: I35d858fc6fb2e0e24b993ab7dd2203c9dd35232a
   > ```
   > 
   
   my change try to avoid evaluating the argument to generate the side effect, but @pbarada said other OS(e.g. Linux) always evaluate the argument. so it's fine restore the change to align the behaviour.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org