xiaoxiang781216 commented on PR #8121:
URL: https://github.com/apache/nuttx/pull/8121#issuecomment-1396564883

   > @xiaoxiang781216 Could you please share the motivation for disabling this 
warning? In which scenario does it manifest?
   
   @gustavonihei here is the warning generated by Candance's clang:
   ```
   [2023-01-19T07:31:49.594Z] media_proxy.c:498:9: error: large atomic 
operation may incur significant performance penalty [-Werror,-Watomic-alignment]
   [2023-01-19T07:31:49.594Z]     if (atomic_load(&priv->refs) == 1 && 
priv->socket) {
   [2023-01-19T07:31:49.594Z]         ^
   ```
   
   Here is the related struct definition:
   ```
   typedef struct MediaProxyPriv {
       void                  *proxy;
       char                  *cpu;
       uint64_t              handle;
       atomic_int            refs;
       int                   socket;
       void                  *cookie;
       media_event_callback  event;
   } MediaProxyPriv;
   ```
   The warning looks wrong since refs should be naturally alignment.
   
   > 
   > From this Clang patchset, this warning seems useful: 
https://reviews.llvm.org/D45319
   > 
   > > If an atomic variable is misaligned Clang will emit accesses to it as a 
libcall. These calls are likely to be slow and involve locks; they are almost 
certainly not what the developer intended.
   


-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to