stddef.h: Use compiler macros for built-in integer types

ptrdiff_t, wchar_t, and wint_t are all integer types built-in to the C
language (as opposed to being library-only types defined in a header).
In the past we had to define these typedefs ourselves because of romcc,
but now that it's gone we should use the GCC-provided macros to select
the types the compiler expects.

Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Change-Id: I0874eddf780b6e41ce773ad8b4faa595e4bbd8a7
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55260
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Jacob Garber 2021-06-06 19:56:14 -06:00 committed by Patrick Georgi
parent 3d2ef9aea9
commit 26979ca470
1 changed files with 3 additions and 6 deletions

View File

@ -3,10 +3,7 @@
#include <commonlib/helpers.h> #include <commonlib/helpers.h>
typedef long ptrdiff_t; typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ unsigned long
#endif
typedef __SIZE_TYPE__ size_t; typedef __SIZE_TYPE__ size_t;
/* There is a GCC macro for a size_t type, but not /* There is a GCC macro for a size_t type, but not
* for a ssize_t type. Below construct tricks GCC * for a ssize_t type. Below construct tricks GCC
@ -16,8 +13,8 @@ typedef __SIZE_TYPE__ size_t;
typedef __SIZE_TYPE__ ssize_t; typedef __SIZE_TYPE__ ssize_t;
#undef unsigned #undef unsigned
typedef int wchar_t; typedef __WCHAR_TYPE__ wchar_t;
typedef unsigned int wint_t; typedef __WINT_TYPE__ wint_t;
#define NULL ((void *)0) #define NULL ((void *)0)