Thanks a lot for the suggestionCombuster wrote:Why don't you just simply compile with optimisations enabled instead of doing all these ifdefs? That way you can't mess things up.I want to let GCC replace the calls to my library functions with its built-in functions whenever possible.
It is definitely much more elegant not to pass GCC the option -fno-builtins and just do away with these preprocessor directives.
The problem is that I am using the -ffreestanding option and it also implicitly enables the -fno-builtin one. From "C Dialect-Options":
if you wish to enable built-in functions selectively when using -fno-builtin or -ffreestanding, you may define macros such as:
#define abs(n) __builtin_abs ((n))
#define strcpy(d, s) __builtin_strcpy ((d), (s))
I am assuming that you are telling me to enable optimizations in order to disable this -fno-builtin option. Where did you actually find whether -fno-builtin is disabled by enabling optimization? Did you find that in GCC's documentation or just by trial and error?Combuster wrote:Why don't you just simply compile with optimisations enabled instead of doing all these ifdefs? That way you can't mess things up.
I have been looking around, but I can't find it
Thank you