Re: [edk2] [PATCH] OvmfPkg/XenPvBlkDxe: Don't include system inttypes.h

Subject: Re: [edk2] [PATCH] OvmfPkg/XenPvBlkDxe: Don't include system inttypes.h

From: Andrew Fish <afish@apple.com>

To: edk2-devel@lists.sourceforge.net

Date: 2014-11-11 22:04:30


On Nov 11, 2014, at 1:51 PM, Jordan Justen <jordan.l.justen@intel.com> wrote:

EDK II code should not include system include files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>
Cc: Scott Duplichan <scott@notabs.org>
---
OvmfPkg/XenPvBlkDxe/BlockFront.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c
index 8d43d83..6add552 100644
--- a/OvmfPkg/XenPvBlkDxe/BlockFront.c
+++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c
@@ -3,6 +3,7 @@

  Copyright (c) 2007-2008 Samuel Thibault.
  Copyright (C) 2014, Citrix Ltd.
+  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
@@ -34,10 +35,8 @@
#include <IndustryStandard/Xen/io/protocols.h>
#include <IndustryStandard/Xen/io/xenbus.h>

-//
-// Header used for UINT32_MAX and UINT16_MAX
-//
-#include "inttypes.h"
+#define UINT32_MAX ((UINTN)0xFFFFFFFF)
+#define UINT16_MAX ((UINTN)0xFFFF)


Why do we need to #define these? They already exist?

https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Base.h
///
/// Maximum values for common UEFI Data Types
///
#define MAX_INT8    ((INT8)0x7F)
#define MAX_UINT8   ((UINT8)0xFF)
#define MAX_INT16   ((INT16)0x7FFF)
#define MAX_UINT16  ((UINT16)0xFFFF)
#define MAX_INT32   ((INT32)0x7FFFFFFF)
#define MAX_UINT32  ((UINT32)0xFFFFFFFF)
#define MAX_INT64   ((INT64)0x7FFFFFFFFFFFFFFFULL)
#define MAX_UINT64  ((UINT64)0xFFFFFFFFFFFFFFFFULL)

///
/// Maximum legal x64 INTN and UINTN values.
///
#define MAX_INTN   ((INTN)0x7FFFFFFFFFFFFFFFULL)
#define MAX_UINTN  ((UINTN)0xFFFFFFFFFFFFFFFFULL)
etc.

Thanks,

Andrew Fish


/**
  Helper to read an integer from XenStore.
--
2.1.1


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel