On Mon, Feb 13, 2012 at 10:39:17AM -0500, Lennart Sorensen wrote: > Well that doesn't really seem to be helping. I just checked out the > latest tree from bzr and applied this one patch, and I am still getting > close to 5000 warnings.
Doing this instead does seem to reduce it from 5000 to 1500 warnings: --- ../grub/include/grub/list.h 2012-02-09 13:54:20.181305000 -0500 +++ include/grub/list.h 2012-02-15 11:40:27.513949443 -0500 @@ -28,7 +28,7 @@ { struct grub_list *next; struct grub_list **prev; -}; +} __attribute__ ((may_alias)); typedef struct grub_list *grub_list_t; static inline void @@ -84,7 +84,7 @@ struct grub_named_list *next; struct grub_named_list **prev; char *name; -}; +} __attribute__ ((may_alias)); typedef struct grub_named_list *grub_named_list_t; void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head, @@ -111,7 +111,7 @@ struct grub_prio_list **prev; char *name; int prio; -}; +} __attribute__ ((may_alias)); typedef struct grub_prio_list *grub_prio_list_t; void EXPORT_FUNC(grub_prio_list_insert) (grub_prio_list_t *head, Doing this drops it to 1100 warnings: --- ../grub/include/grub/list.h 2012-02-09 13:54:20.181305000 -0500 +++ include/grub/list.h 2012-02-15 11:52:30.729949590 -0500 @@ -28,8 +28,8 @@ { struct grub_list *next; struct grub_list **prev; -}; -typedef struct grub_list *grub_list_t; +} __attribute__ ((may_alias)); +typedef struct grub_list __attribute__ ((may_alias)) *grub_list_t; static inline void grub_list_push (grub_list_t *head, grub_list_t item) @@ -84,8 +84,8 @@ struct grub_named_list *next; struct grub_named_list **prev; char *name; -}; -typedef struct grub_named_list *grub_named_list_t; +} __attribute__ ((may_alias)); +typedef struct grub_named_list __attribute__ ((may_alias)) *grub_named_list_t; void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head, const char *name); @@ -111,8 +111,8 @@ struct grub_prio_list **prev; char *name; int prio; -}; -typedef struct grub_prio_list *grub_prio_list_t; +} __attribute__ ((may_alias)); +typedef struct grub_prio_list __attribute__ ((may_alias)) *grub_prio_list_t; void EXPORT_FUNC(grub_prio_list_insert) (grub_prio_list_t *head, grub_prio_list_t item); At that point there doesn't appear to be any more strict aliasing compliants about list.h. There are 'imcompatible pointer type warnings though, as well as a with alising issues in other files. For example: gcc-4.4 -DHAVE_CONFIG_H -I. -I../.. -Wall -W -I./include -DGRUB_UTIL=1 -DGRUB_LIBDIR=\"/usr/lib/grub\" -DLOCALEDIR=\"/usr/share/locale\" -DGRUB_MACHINE_EMU=1 -DGRUB_MACHINE=POWERPC_EMU -DGRUB_TARGET_CPU_POWERPC=1 -DGRUB_FILE=\"util/misc.c\" -I. -I../.. -I. -I../.. -I.. /../include -I./include -I./grub-core/gnulib -I../../grub-core/gnulib -g -Wall -O2 -Wall -W -Wshadow -Wold-style-declaration -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Warray-bounds -Wattributes -Wbuiltin-macro-redefined -Wcast-alig n -Wchar-subscripts -Wclobbered -Wcomment -Wcoverage-mismatch -Wdeprecated -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-y2k -Wignored-qualifi ers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wunsafe-loop-optimizations -Wlogical-op -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmudflap -Wmultichar -Wnonnull -Woverflow -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wswitch -Wsync-nand -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized -Wunknown -pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wne sted-externs -Wstrict-prototypes -Wpointer-sign -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition -c -o util/libgrubkern_a-misc.o `test -f 'util/misc.c' || e cho '../../'`util/misc.c In file included from ../../include/grub/term.h:68, from ../../util/misc.c:41: ../../include/grub/list.h: In function 'grub_list_push': ../../include/grub/list.h:37: warning: assignment from incompatible pointer type happens very frequently. -- Len Sorensen _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel