From 20de7400c6061474ada2ba2b0a56b663bda3a2e3 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Mon, 14 Feb 2022 17:47:33 +0100 Subject: [PATCH] tests: Avoid -Wdangling-pointer warning The code is correct, but gcc thinks the pointer is still NULL after the call. As obvious workaround don't seem to work, just disable the warning for now. --- tests/test-fpi-device.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test-fpi-device.c b/tests/test-fpi-device.c index 3d0621ac..a7b2611b 100644 --- a/tests/test-fpi-device.c +++ b/tests/test-fpi-device.c @@ -147,6 +147,10 @@ tod_check_device_version (FpDevice *device_class, typedef FpDevice FpAutoCloseDevice; +/* gcc 12.0.1 is complaining about dangling pointers in the auto_close* functions */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-pointer" + static FpAutoCloseDevice * auto_close_fake_device_new (void) { @@ -179,6 +183,8 @@ auto_close_fake_device_free (FpAutoCloseDevice *device) } G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpAutoCloseDevice, auto_close_fake_device_free) +#pragma GCC diagnostic pop + typedef FpDeviceClass FpAutoResetClass; static FpAutoResetClass default_fake_dev_class = {0};