__attribute__ error ("message")

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

 



Hello

May I check, does this attribute error output the error message usually?
My example links fine without any warnings or errors.

Maybe I am misunderstanding it. I am sharing a simple program below and godbolt trunk example.
I only get to see the error message if I don't implement the function and get a link failure.

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

error ("message")
warning ("message")

If the error or warning attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, an error or warning (respectively) that includes message is diagnosed. 



https://godbolt.org/z/n849GPTjj


void compile_abort() __attribute__((error("compile abort")));

void compile_abort()
{
    __builtin_abort();
}

int main()
{
    compile_abort();
}



[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