[coreboot] New patch to review for coreboot: 7a0cac1 Fix size_t for certain versions of GCC

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Thu May 24 02:07:06 CEST 2012


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1040

-gerrit

commit 7a0cac14ac8891d927978c9c6f9cc22d1f406d4d
Author: Stefan Reinauer <reinauer at chromium.org>
Date:   Mon May 14 13:21:08 2012 -0700

    Fix size_t for certain versions of GCC
    
    When compiling coreboot with the latest ChromeOS toolchain, GCC
    complains that some printk calls use %zu in connection with size_t
    types since it resolves the typedefs to long unsigned int.
    
    The problem is solved by using the GCC built-in __SIZE_TYPE__ if it
    exists and define __SIZE_TYPE__ to long unsigned int otherwise.
    
    Change-Id: I449c3d385b5633a05e57204704e981de6e017b86
    Signed-off-by: Stefan Reinauer <reinauer at google.com>
---
 src/arch/x86/include/stddef.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/arch/x86/include/stddef.h b/src/arch/x86/include/stddef.h
index e4fc019..c737be1 100644
--- a/src/arch/x86/include/stddef.h
+++ b/src/arch/x86/include/stddef.h
@@ -2,7 +2,10 @@
 #define I386_STDDEF_H
 
 typedef long ptrdiff_t;
-typedef unsigned long size_t;
+#ifndef __SIZE_TYPE__
+#define __SIZE_TYPE__ long unsigned int
+#endif
+typedef __SIZE_TYPE__ size_t;
 typedef long ssize_t;
 
 typedef int wchar_t;




More information about the coreboot mailing list