[edk2] Mde header change question?

Subject: [edk2] Mde header change question?

From: Andrew Fish <afish@apple.com>

To: edk2-devel@lists.sourceforge.net

Date: 2011-08-11 00:53:45

  • 2011-08-11 00:53:45  Andrew Fish   [edk2] Mde header change question?
I'd like to be able to do the following in some of the MdePkg Library include files:

AsciiSPrintUnicodeFormat (
  OUT CHAR8                *StartOfBuffer,
  IN  UINTN                     BufferSize,
  IN  CONST CHAR16  *FormatString,

#if defined (__clang__) && (__clang_major__ > 4)
#define EFI_ASCII_PRINT_TYPE_CHECK(string_index, first_to_check)  __attribute__ ((format (EfiAsciiPrint, string_index, first_to_check))) ;
#define EFI_ASCII_PRINT_TYPE_CHECK(string_index, first_to_check) 

My thought is we could add EfiAsciiPrint and EfiPrint to clang so they could be typed checked like printf/sprintf is in gcc/clang today. Given the differences between printf and Print this can be a real cause of confusion for folks. It would be nice if compiler warnings could be generated for incorrect use cases. 

Since this would require some one adding a feature to the open source clang project I wanted to check and make sure it would be OK with folks to update the MdePkg Library include files if we got this feature working? As I'd hate to do all the work and not be able to use the feature. 

Andrew Fish