This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Support -fno-builtin-foo options in C++
- From: Roger Sayle <roger at eyesopen dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Cc: Paul Koning <pkoning at equallogic dot com>
- Date: Sun, 14 Jul 2002 10:47:27 -0600 (MDT)
- Subject: [PATCH] Support -fno-builtin-foo options in C++
This patch originally started life as a documentation correction.
Since builtin functions were re-enabled in C++ for GCC v3.1, the
"-fno-builtin" is now functional again. However reading the
affected documentation, I realized there's also no reason that
g++ doesn't also support "-fno-builtin-foo" to disable the
builtin function "foo" (in C++ terms this disables both "::foo"
and "std::foo"). This option is now available on all C-family
front-ends.
Tested with a complete bootstrap and "make -k check", all languages
except Ada and treelang, on i686-pc-linux-gnu with no new regressions.
Ok for mainline?
2002-07-14 Roger Sayle <roger@eyesopen.com>
* cp/decl2.c (cxx_decode_option): Support -fno-builtin-foo.
* doc/invoke.texi: Document that both -fno-builtin-foo and
-fno-builtin are supported by the g++ front-end.
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.545
diff -c -3 -p -r1.545 decl2.c
*** cp/decl2.c 9 Jul 2002 23:31:28 -0000 1.545
--- cp/decl2.c 14 Jul 2002 04:57:52 -0000
*************** cxx_decode_option (argc, argv)
*** 540,545 ****
--- 540,547 ----
warning ("-fname-mangling-version is no longer supported");
return 1;
}
+ else if ((option_value = skip_leading_substring (p, "no-builtin-")))
+ disable_builtin_function (option_value);
else if (dump_switch_p (p))
;
else
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.155
diff -c -3 -p -r1.155 invoke.texi
*** doc/invoke.texi 10 Jul 2002 19:17:51 -0000 1.155
--- doc/invoke.texi 14 Jul 2002 04:57:54 -0000
*************** switch only affects the @code{asm} and @
*** 1079,1085 ****
@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
--- 1079,1085 ----
@code{inline} is a standard keyword in ISO C99.
@item -fno-builtin
! @itemx -fno-builtin-@var{function}
@opindex fno-builtin
@cindex built-in functions
Don't recognize built-in functions that do not begin with
*************** and faster, but since the function calls
*** 1097,1111 ****
cannot set a breakpoint on those calls, nor can you change the behavior
of the functions by linking with a different library.
! In C++, @option{-fno-builtin} is always in effect. The @option{-fbuiltin}
! option has no effect. Therefore, in C++, the only way to get the
! optimization benefits of built-in functions is to call the function
! 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
--- 1097,1104 ----
cannot set a breakpoint on those calls, nor can you change the behavior
of the functions by linking with a different library.
! With the @option{-fno-builtin-@var{function}} option
! 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
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833