From aea0a5cfce262ce2ab16fd96d87c12cf5e756380 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Wed, 12 Apr 2023 10:18:20 -0600 Subject: Fix GCC 12 dangling-pointer warning We're storing a persistent pointer to an ephemeral local variable which technically is a dangling pointer and the compiler is correct. However, since we never indirect the pointer, this is a safe operation and we can suppress the warning. Also, some C run-times (like MUSL) aren't including indirectly so we must include it explicitly or we won't have the type definition for uintptr_t. Fixes issue #867. Signed-off-by: Philip Prindeville --- source/components/utilities/utdebug.c | 5 +++++ source/include/platform/aclinux.h | 1 + 2 files changed, 6 insertions(+) (limited to 'source') diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c index b0c3640f2..82e8a6205 100644 --- a/source/components/utilities/utdebug.c +++ b/source/components/utilities/utdebug.c @@ -185,7 +185,12 @@ AcpiUtInitStackPtrTrace ( ACPI_SIZE CurrentSp; +#pragma GCC diagnostic push +#if defined(__GNUC__) && __GNUC__ >= 12 +#pragma GCC diagnostic ignored "-Wdangling-pointer=" +#endif AcpiGbl_EntryStackPointer = &CurrentSp; +#pragma GCC diagnostic pop } diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h index da37a2fad..f5234b972 100644 --- a/source/include/platform/aclinux.h +++ b/source/include/platform/aclinux.h @@ -312,6 +312,7 @@ #ifdef ACPI_USE_STANDARD_HEADERS #include #include +#include #define ACPI_OFFSET(d, f) offsetof(d, f) #endif -- cgit v1.2.1