From 7d14c755ce793f99c3e833e7115d954cfbed175c Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sun, 18 Nov 2001 03:30:57 +0000 Subject: c-common.c (struct disabled_builtin, [...]): New. * c-common.c (struct disabled_builtin, disabled_builtins, disable_builtin_function, builtin_function_disabled_p): New. (builtin_function_2): Check for disabled built-in functions. * c-common.h (disable_builtin_function): Declare. * c-decl.c (c_decode_option): Handle -fno-builtin-FUNCTION. * doc/invoke.texi: Document -fno-builtin-FUNCTION. * doc/extend.texi: Mention -fno-builtin-FUNCTION. testsuite: * gcc.dg/no-builtin-1.c: New test. From-SVN: r47133 --- gcc/doc/extend.texi | 4 +++- gcc/doc/invoke.texi | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 5461cae..d0fdae6 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -4376,7 +4376,9 @@ The ISO C89 functions @code{abs}, @code{cos}, @code{fabs}, @code{strlen}, @code{strncat}, @code{strncmp}, @code{strncpy}, @code{strpbrk}, @code{strrchr}, @code{strspn}, and @code{strstr} are all recognized as built-in functions unless @option{-fno-builtin} is -specified. All of these functions have corresponding versions prefixed +specified (or @option{-fno-builtin-@var{function}} is specified for an +individual function). All of these functions have +corresponding versions prefixed with @code{__builtin_}, except that the version for @code{sqrt} is called @code{__builtin_fsqrt}. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c8bfd474..83e5c97 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -162,7 +162,7 @@ in the following sections. @xref{C Dialect Options,,Options Controlling C Dialect}. @gccoptlist{ -ansi -std=@var{standard} -aux-info @var{filename} @gol --fno-asm -fno-builtin @gol +-fno-asm -fno-builtin -fno-builtin-@var{function} @gol -fhosted -ffreestanding @gol -trigraphs -traditional -traditional-cpp @gol -fallow-single-precision -fcond-mismatch @gol @@ -1025,6 +1025,7 @@ switch only affects the @code{asm} and @code{typeof} keywords, since @code{inline} is a standard keyword in ISO C99. @item -fno-builtin +@itemx -fno-builtin-@var{function} @r{(C and Objective-C only)} @opindex fno-builtin @cindex built-in functions Don't recognize built-in functions that do not begin with @@ -1049,6 +1050,20 @@ using the @samp{__builtin_} prefix. The GNU C++ Standard Library uses built-in functions to implement many functions (like @code{std::strchr}), so that you automatically get efficient code. +With the @option{-fno-builtin-@var{function}} option, not available +when compiling C++, only the built-in function @var{function} is +disabled. @var{function} must not begin with @samp{__builtin_}. If a +function is named this is not built-in in this version of GCC, this +option is ignored. There is no corresponding +@option{-fbuiltin-@var{function}} option; if you wish to enable +built-in functions selectively when using @option{-fno-builtin} or +@option{-ffreestanding}, you may define macros such as: + +@smallexample +#define abs(n) __builtin_abs ((n)) +#define strcpy(d, s) __builtin_strcpy ((d), (s)) +@end smallexample + @item -fhosted @opindex fhosted @cindex hosted environment -- cgit v1.1