Subject: Re: [bug-diffutils] bug#30913: Releasing a build compatible withglibc-2.26+

From: Eric Blake <[email-masked]>
Date: Fri, 23 Mar 2018 13:50:55 -0500

On 03/23/2018 01:44 PM, Paul Eggert wrote:

>>>From 0d111b0de328d31dd3444ceeec977a7aaa5bb0ed Mon Sep 17 00:00:00 2001
> From: Paul Eggert<[email-masked]>
> Date: Fri, 23 Mar 2018 11:26:15 -0700
> Subject: [PATCH] c-stack: port to recent GCC build
> 
> Problem reported by The Fireplace (Bug#30913).
> * lib/c-stack.c (die): Define only if used.

> +++ b/lib/c-stack.c
> @@ -99,6 +99,10 @@ static void (* volatile segv_action) (int);
>   static char const * volatile program_error_message;
>   static char const * volatile stack_overflow_message;
>   
> +#if ((HAVE_LIBSIGSEGV && ! HAVE_XSI_STACK_OVERFLOW_HEURISTIC) \
> +     || (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK            \
> +         && HAVE_STACK_OVERFLOW_HANDLING && SIGINFO_WORKS))
> +

That's a maintenance nightmare to keep the #if conditions in sync. 
Would it not be simpler to just use __attribute__((unused)) on the 
function declaration, to tell the compiler that the function does not 
get used in all setups, but that it should not warn in those cases?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org