On 07/27/15 20:31, Scott Duplichan wrote:

> The gcc -Wformat messages are usually clear, but I found one misleading:
> format '%g' expects argument of type 'void *', but argument 4 has type 
> 'EFI_GUID {aka struct <anonymous>
> In this case, the entire GUID struct is being passed instead of the GUID 
> address
> (due to missing '&').

The really strange thing here is that, although the warning is correct,
the code does not print garbage; it prints the right GUID. It's as if
the structure automatically decayed to a pointer through the ellipsis.

Thanks
Laszlo


> The full lists are attached (made with GCC_EXTRA_CC_FLAGS=-Wno-error). Let me 
> know of
> anything wrong you see. I am going to try to perfect this checking and put it 
> into the
> Windows hosted gcc tool chains.

> 
> Thanks,
> Scott
> 
> 
> ]For gcc/clang this syntax enables all the printf format string vs. argument 
> warns for my_printf that exist ]with printf. 
> ]int  my_printf (void *my_object, const char *my_format, ...)   __attribute__ 
> ((format (printf, 2, 3)));
> ]
> ]It might be possible to add a format attribute to a function that could 
> check the calling conventions, but ]the optimizations may happen too late to 
> help?
> ]
> ]Thanks,
> ]
> ]Andrew Fish
> ]
> ]> -- 
> ]> dwmw2
> ]> 
> ]> -- 
> ]> David Woodhouse                            Open Source Technology Centre
> ]> david.woodho...@intel.com                              Intel Corporation
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to