Re: [PATCH v2 1/3] compat/posix.h: track SA_RESTART fallback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx> writes:

> On Wed, Jun 25, 2025 at 09:07:15AM -0800, Junio C Hamano wrote:
>> "Carlo Marcelo Arenas Belón via GitGitGadget"
>> <gitgitgadget@xxxxxxxxx> writes:
>> 
>> > +# Define USE_NON_POSIX_SIGNAL if don't have support for SA_RESTART or
>> > +# prefer using ANSI C signal() over POSIX sigaction()
>> > +
>> > +AC_CACHE_CHECK([whether SA_RESTART is supported], [ac_cv_siginterrupt], [
>> > +	AC_COMPILE_IFELSE(
>> > +		[AC_LANG_PROGRAM([#include <signal.h>], [[
>> > +		#ifdef SA_RESTART
>> > +		#endif
>> > +		siginterrupt(SIGCHLD, 1)
>> 
>> This is curious.  What is this #ifdef/#endif doing that does not
>> have anything in it?
>
> It checks that `SA_RESTART` is defined in `signal.h`, which should
> fail at least in QNX, NonStop and Windows.

The above roughly expands to

        #include <signal.h>
        int main(void)
        {
                #ifdef SA_RESTART
                #endif
                siginterrupt(SIGCHLD, 1);
                return 0;
        }

Are you saying that a preprocessor macro SA_RESTART, which may or
may not be defined, when asked by "#ifdef", causes what is left in
the preprocessed source change in any meaningful way to cause the
compilation to fail?

I understand that these platforms may fail to compile the above due
to siginterrupt() not declared in <signal.h>, but I cannot quite see
how the empty #ifdef NO_SUCH_SYMBOL/#endif block that comes before
it changes anything.

On a debian-derived host I happen to have access to, compiling the
above fails, with or without "s/SA_RESTART/NO_SUCH_SYMBOL/", not
because of the empty #ifdef/#endif block, but because use of
siginterrupt() gets deprecation warning.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux