Let gcc generate a warning or an error?

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

 



Hi, I would like to do something like

static inline void foo (unsigned long x)
{
    if (__builtin_constant_p (x))
    {
        asm volatile ("... %0" :: "n" (x));
    }
    else
    {
        __builtin_error ("foo must be used with a compile time constant");
    }
}

Is there a way to generate an error/warning/info by making gcc
call error/warning/info?

So that in the above case an understandable error message is printed.

Is there an anologon to __builtin_constant_p that is true for compile
time constants only (constraint "n" in the abobe case, but not all
of "i")?

I.e. something like

    if (__builtin_constant_p (x) && !__builtin_symbol_p (x))

Thanks, Georg-Johann


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux