Support compile time argument consistency checking for functions that
accept a PrintLib format string followed by a variable argument list.
Macro 'EFIFORMAT' added to the function prototype accepts a single
argument indicating which function argument holds the format string.
The EFIFORMAT macro assumes the variable argument list immediately
follows the format string. Format string argument checking requires
a compiler that understands EDK2 format strings, such as GCC with
the gcc_format from BaseTools/gcc applied.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>   
---


 OvmfPkg/Include/Protocol/XenBus.h | 2 +-
 OvmfPkg/XenBusDxe/XenStore.h      | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Include/Protocol/XenBus.h 
b/OvmfPkg/Include/Protocol/XenBus.h
index 3509691..46ad93b 100644
--- a/OvmfPkg/Include/Protocol/XenBus.h
+++ b/OvmfPkg/Include/Protocol/XenBus.h
@@ -132,7 +132,7 @@ XENSTORE_STATUS
 **/
 typedef
 XENSTORE_STATUS
-(EFIAPI *XENBUS_XS_PRINTF) (
+(EFIAPI EFIFORMAT (5) *XENBUS_XS_PRINTF) (
   IN XENBUS_PROTOCOL        *This,
   IN CONST XENSTORE_TRANSACTION *Transaction,
   IN CONST CHAR8            *Directory,
diff --git a/OvmfPkg/XenBusDxe/XenStore.h b/OvmfPkg/XenBusDxe/XenStore.h
index de56901..5a26cbb 100644
--- a/OvmfPkg/XenBusDxe/XenStore.h
+++ b/OvmfPkg/XenBusDxe/XenStore.h
@@ -188,6 +188,7 @@ XenStoreTransactionEnd (
 **/
 XENSTORE_STATUS
 EFIAPI
+EFIFORMAT (4)
 XenStoreSPrint (
   IN CONST XENSTORE_TRANSACTION *Transaction,
   IN CONST CHAR8            *DirectoryPath,
@@ -344,6 +345,7 @@ XenBusXenStoreTransactionEnd (
 
 XENSTORE_STATUS
 EFIAPI
+EFIFORMAT (5)
 XenBusXenStoreSPrint (
   IN XENBUS_PROTOCOL        *This,
   IN CONST XENSTORE_TRANSACTION *Transaction,


_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to