[LLVMbugs] [Bug 22442] New: -Wpadded may be split in two options
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Tue Feb  3 01:14:04 PST 2015
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=22442
            Bug ID: 22442
           Summary: -Wpadded may be split in two options
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: guillaum.bouchard at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified
Hello.
-Wpadded warns about two issues, padding a struct field and padding at the end
(i.e: the whole struct). See the example:
-------------------
struct Bidule
{
    char b;
    int a;
    char c;
};
--->
test.cpp:4:6: warning: padding struct 'Bidule' with 3 bytes to align 'a'
[-Wpadded]
        int a;
            ^
test.cpp:1:8: warning: padding size of 'Bidule' with 3 bytes to alignment
boundary [-Wpadded]
struct Bidule
--------------------------
Usually padding in the middle is a bad thing because the struct can be "easily"
organized differently to reduce the memory footprint. On the other hand,
padding at the end of a structure is common and there is usually no trivial
fix.
As an example, I ran -Wpadded on a large code base, I found 3 padding of field
which I fixed, and more than one thousand warning messages about padding of
struct for which I cannot do something without complex code refactoring.
It may be possible to split -Wpadding in two options, one which warns about
padding fields (which I found really useful 100% of the time) and the other
which warns about padding the whole struct, which IMHO only need to be
activated when needed.
Thank you.
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150203/e41ea84d/attachment.html>
    
    
More information about the llvm-bugs
mailing list