From ec2bf1e7b1ae8c4cf33cfb59946a3e0ee24a455d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 6 Jan 2018 15:52:21 +0000 Subject: [PATCH] Revert r327338, undoing the changes to the ACPI_ADD_PTR and ACPI_SUB_PTR macros. Instead, turn off clang 6.0.0 warnings about null pointer arithmetic in usr.sbin/acpi/acpidb instead. --- sys/contrib/dev/acpica/include/actypes.h | 4 ++-- usr.sbin/acpi/acpidb/Makefile | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 3e8fe6fb3558..2d71de51ede4 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -651,8 +651,8 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p)) #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p)) -#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_UINTPTR_T) (a) + (ACPI_SIZE)(b)) -#define ACPI_SUB_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_UINTPTR_T) (a) - (ACPI_SIZE)(b)) +#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b))) +#define ACPI_SUB_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b))) #define ACPI_PTR_DIFF(a, b) (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))) /* Pointer/Integer type conversions */ diff --git a/usr.sbin/acpi/acpidb/Makefile b/usr.sbin/acpi/acpidb/Makefile index a425d4014f58..493f2b897d06 100644 --- a/usr.sbin/acpi/acpidb/Makefile +++ b/usr.sbin/acpi/acpidb/Makefile @@ -80,3 +80,7 @@ CFLAGS+= -DACPI_EXEC_APP -fno-strict-aliasing LIBADD= pthread .include + +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 60000 +CWARNFLAGS+= -Wno-null-pointer-arithmetic +.endif