ppisa commented on PR #19912:
URL: https://github.com/apache/nuttx/pull/19912#issuecomment-5865680702

   > > on the other hand for system without native unaligned support the code 
would be much longer and the problem propagates even to the caller subroutine.
   > 
   > I'm not sure I follow here, proper operation for Win32 .res resource file 
interpretation necessarily requires compiler support for packed (unaligned) 
structures. For systems without native unaligned support, the winres.c routines 
will/would have to be rewritten - but I have never seen this required.
   
   May it be my wording and reply in a hurry makes in unclear.
   
   There are two different aspects, when fields are marked packed but GCC knows 
that structure starts aligned then it finds that packed fields are aligned due 
their offsets, which is the case there. So even on the architecture without 
native unaligned support the code is simple and fast. When you mark the whole 
structure as unaligned, then the code gets much more complex and slower.  
Because the MWDLGTEMPLATE is defined as starting aligned the code is fast and 
shorter even for target without native alignment support. The structure 
DLGTEMPLATE is used only to fill the data.  The extraData[1] (which is in the 
fact mandatory, because it has to be set to zero, if the rest is not filled) of 
MWDLGTEMPLATE in the fact guarantee that the real dialog resource header is 
32-bit aligned and keeping next DLGTEMPLATE on 4-byte boundary by zero padding 
is defined as mandatory for properly implemented resource compiler. So the 
whole problem is artifact of being prepared for malformed resources and t
 o ensure than  DLGTEMPLATE can be directly followed by the data at offset 18 
which define how the extra is used.
   
   So I think that the warning is right to stay there for most uses to keep it 
in mind but should not be considered error. When NuttX is in this specific 
target case so picky, then to silence it. keeping that note as a mud in the 
Microwindows source documents the situation even for future other users.  But 
on the other hand, it is ugly, so I am even for placing `#pragma GCC diagnostic 
ignored "-Waddress-of-packed-member"` in `mwconfig.nuttx` and we should keep 
eye on this that it masks only this one irrelevant case in future.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to