Hello dear GCC developers, I am working on an issue in Meson wrt GCC built-in functions, see https://github.com/mesonbuild/meson/issues/10641.
As you already know, some built-ins are always inlined, while others are inlined only at times (e.g. depending on the target architecture) and resolve to a regular function call otherwise. The issue is about the latter's, i.e. those that may emit regular function calls. In fact, even though __has_builtin(func) evaluates to 1, func may not be present in libraries (libgcc, libc, libm), causing linking errors if not inlined. Because some of the GCC built-in functions are not part of the C standard (e.g. sincos), it's not worthwhile to require having implementations in libc. In addition, should generic implementations be added to libgcc, those would likely have sub-par performance or accuracy issues (being generic). As such, I think that a build system should check if an implementation of a conditionally-inlined built-in function is provided in the target libc. I have a few questions: 1. Is inlining of built-ins dependant only on the target architecture and command-line arguments? 2. If the answer to 1 is yes, could a __is_builtin_inlined (func) macro be added to GCC? It should tell whether func is going to be substituted inline for the given compiler invocation 3. Is it true that conditionally-inlined built-ins are exactly those that come in the two variants of '__builtin_func' and 'func'? Thanks, Luca Bacci