[PATCH:makedepend 1/4] Move i_listlen in struct inclist for better packing in 64-bit builds

Alan Coopersmith alan.coopersmith at oracle.com
Sun Jan 6 13:03:58 PST 2013


Putting it with another int instead of between two pointers gets rid
of two places where 4 bytes each had to be padded into the structure
for alignment.

Reduces the size of an individual struct from 64 bytes to 56 bytes,
and of the inclist[ MAXFILES ] array from 128k to 112k.

Found by clang:
./def.h:111:18: warning: padding struct 'struct inclist' with 4 bytes to align 'i_defs' [-Wpadded]
        struct symtab   **i_defs;       /* symbol table for this file and its
                          ^
./def.h:114:12: warning: padding struct 'struct inclist' with 4 bytes to align 'i_merged' [-Wpadded]
        boolean         *i_merged;      /* whether we have merged child

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 def.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/def.h b/def.h
index 3f55a52..459bbd2 100644
--- a/def.h
+++ b/def.h
@@ -107,9 +107,9 @@ struct	inclist {
 	char		*i_incstring;	/* string from #include line */
 	char		*i_file;	/* path name of the include file */
 	struct inclist	**i_list;	/* list of files it itself includes */
-	int		i_listlen;	/* length of i_list */
 	struct symtab	**i_defs;	/* symbol table for this file and its
 					   children when merged */
+	int		i_listlen;	/* length of i_list */
 	int		i_ndefs;	/* current # defines */
 	boolean		*i_merged;      /* whether we have merged child
 					   defines */
-- 
1.7.9.2



More information about the xorg-devel mailing list