From 189200d0b0f6fff473d302880d9569f45d4d8c4d Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Sat, 8 Apr 2023 19:43:42 +0100 Subject: [PATCH 1/2] Make WCHAR and CHAR16 identical And actually use wchar_t gnu-efi already uses L string literals which are of type wchar_t Signed-off-by: Callum Farmer --- inc/aarch64/efibind.h | 13 ++++--------- inc/arm/efibind.h | 13 ++++--------- inc/ia32/efibind.h | 14 +++++--------- inc/ia64/efibind.h | 14 +++++--------- inc/mips64el/efibind.h | 13 ++++--------- inc/riscv64/efibind.h | 8 +++----- inc/x86_64/efibind.h | 10 ++++------ 7 files changed, 29 insertions(+), 56 deletions(-) diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h index da94c3b..1454422 100644 --- a/inc/aarch64/efibind.h +++ b/inc/aarch64/efibind.h @@ -38,12 +38,10 @@ typedef int64_t intptr_t; // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif -#ifndef __CHAR16_TYPE__ -# define __CHAR16_TYPE__ unsigned short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -52,15 +50,12 @@ typedef uint32_t UINT32; typedef int32_t INT32; typedef uint16_t UINT16; -typedef __CHAR16_TYPE__ CHAR16; typedef int16_t INT16; typedef uint8_t UINT8; typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; - #undef VOID #define VOID void diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h index b4753a1..d391b14 100644 --- a/inc/arm/efibind.h +++ b/inc/arm/efibind.h @@ -46,12 +46,10 @@ typedef int32_t intptr_t; // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif -#ifndef __CHAR16_TYPE__ -# define __CHAR16_TYPE__ unsigned short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -60,15 +58,12 @@ typedef uint32_t UINT32; typedef int32_t INT32; typedef uint16_t UINT16; -typedef __CHAR16_TYPE__ CHAR16; typedef int16_t INT16; typedef uint8_t UINT8; typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; - #undef VOID #define VOID void diff --git a/inc/ia32/efibind.h b/inc/ia32/efibind.h index b0b0d76..6b0e6b4 100644 --- a/inc/ia32/efibind.h +++ b/inc/ia32/efibind.h @@ -85,12 +85,11 @@ Revision History // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif -#ifndef __CHAR16_TYPE__ -# define __CHAR16_TYPE__ unsigned short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 + typedef uint64_t UINT64; typedef int64_t INT64; @@ -101,15 +100,12 @@ typedef int64_t INT64; #endif typedef uint16_t UINT16; -typedef __CHAR16_TYPE__ CHAR16; typedef int16_t INT16; typedef uint8_t UINT8; typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; - #undef VOID #define VOID void diff --git a/inc/ia64/efibind.h b/inc/ia64/efibind.h index ebe8cac..254afd6 100644 --- a/inc/ia64/efibind.h +++ b/inc/ia64/efibind.h @@ -71,12 +71,11 @@ Revision History // // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif -#ifndef __CHAR16_TYPE__ -# define __CHAR16_TYPE__ unsigned short -#endif + +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -85,15 +84,12 @@ typedef uint32_t UINT32; typedef int32_t INT32; typedef uint16_t UINT16; -typedef __CHAR16_TYPE__ CHAR16; typedef int16_t INT16; typedef uint8_t UINT8; typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; - #undef VOID #define VOID void diff --git a/inc/mips64el/efibind.h b/inc/mips64el/efibind.h index e26c519..4f7430f 100644 --- a/inc/mips64el/efibind.h +++ b/inc/mips64el/efibind.h @@ -40,12 +40,10 @@ typedef int64_t intptr_t; // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif -#ifndef __CHAR16_TYPE__ -# define __CHAR16_TYPE__ unsigned short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -54,15 +52,12 @@ typedef uint32_t UINT32; typedef int32_t INT32; typedef uint16_t UINT16; -typedef __CHAR16_TYPE__ CHAR16; typedef int16_t INT16; typedef uint8_t UINT8; typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; - #undef VOID #define VOID void diff --git a/inc/riscv64/efibind.h b/inc/riscv64/efibind.h index dfec652..22a12d4 100644 --- a/inc/riscv64/efibind.h +++ b/inc/riscv64/efibind.h @@ -22,7 +22,7 @@ // Basic EFI types of various widths // - +#include typedef uint64_t UINT64; typedef int64_t INT64; @@ -32,10 +32,8 @@ typedef uint16_t UINT16; typedef int16_t INT16; typedef uint8_t UINT8; typedef int8_t INT8; -#ifndef __WCHAR_TYPE__ -#define __WCHAR_TYPE__ short -#endif -typedef __WCHAR_TYPE__ WCHAR; +typedef wchar_t CHAR16; +#define WCHAR CHAR16 #ifndef BOOLEAN typedef uint8_t BOOLEAN; #endif diff --git a/inc/x86_64/efibind.h b/inc/x86_64/efibind.h index 835e0b9..152e0ca 100644 --- a/inc/x86_64/efibind.h +++ b/inc/x86_64/efibind.h @@ -96,9 +96,10 @@ Revision History // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -109,15 +110,12 @@ typedef int64_t INT64; #endif typedef uint16_t UINT16; -typedef __CHAR16_TYPE__ CHAR16; typedef int16_t INT16; typedef uint8_t UINT8; typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; - #undef VOID #define VOID void From 056bdaa53e8dbffbf5363cc9a58ccea666334be3 Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Thu, 13 Apr 2023 14:32:37 +0100 Subject: [PATCH 2/2] Make VOID a typedef 'void' is a type so VOID can be typedef instead of a '#define' to improve compiler output Signed-off-by: Callum Farmer --- inc/aarch64/efibind.h | 2 +- inc/arm/efibind.h | 2 +- inc/ia32/efibind.h | 2 +- inc/ia64/efibind.h | 2 +- inc/mips64el/efibind.h | 2 +- inc/riscv64/efibind.h | 2 +- inc/x86_64/efibind.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h index 1454422..d6b5d0f 100644 --- a/inc/aarch64/efibind.h +++ b/inc/aarch64/efibind.h @@ -57,7 +57,7 @@ typedef char CHAR8; typedef int8_t INT8; #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; typedef uint64_t UINTN; diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h index d391b14..8c578df 100644 --- a/inc/arm/efibind.h +++ b/inc/arm/efibind.h @@ -65,7 +65,7 @@ typedef char CHAR8; typedef int8_t INT8; #undef VOID -#define VOID void +typedef void VOID; typedef int32_t INTN; typedef uint32_t UINTN; diff --git a/inc/ia32/efibind.h b/inc/ia32/efibind.h index 6b0e6b4..718e8d1 100644 --- a/inc/ia32/efibind.h +++ b/inc/ia32/efibind.h @@ -107,7 +107,7 @@ typedef char CHAR8; typedef int8_t INT8; #undef VOID -#define VOID void +typedef void VOID; typedef int32_t INTN; diff --git a/inc/ia64/efibind.h b/inc/ia64/efibind.h index 254afd6..1d2745b 100644 --- a/inc/ia64/efibind.h +++ b/inc/ia64/efibind.h @@ -91,7 +91,7 @@ typedef char CHAR8; typedef int8_t INT8; #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; diff --git a/inc/mips64el/efibind.h b/inc/mips64el/efibind.h index 4f7430f..cf77ddc 100644 --- a/inc/mips64el/efibind.h +++ b/inc/mips64el/efibind.h @@ -59,7 +59,7 @@ typedef char CHAR8; typedef int8_t INT8; #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; typedef uint64_t UINTN; diff --git a/inc/riscv64/efibind.h b/inc/riscv64/efibind.h index 22a12d4..4fdf81d 100644 --- a/inc/riscv64/efibind.h +++ b/inc/riscv64/efibind.h @@ -38,7 +38,7 @@ typedef wchar_t CHAR16; typedef uint8_t BOOLEAN; #endif #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; typedef uint64_t UINTN; diff --git a/inc/x86_64/efibind.h b/inc/x86_64/efibind.h index 152e0ca..e454ed2 100644 --- a/inc/x86_64/efibind.h +++ b/inc/x86_64/efibind.h @@ -117,7 +117,7 @@ typedef char CHAR8; typedef int8_t INT8; #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN;