This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch: always_inline attribute
- From: Jason Merrill <jason at redhat dot com>
- To: aldyh at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 06 Apr 2002 17:47:56 +0100
- Subject: Re: patch: always_inline attribute
- References: <877DF7FA-2667-11D6-BCEB-000393750C1E@redhat.com><wvlwux42lht.fsf@prospero.cambridge.redhat.com><20020321021010.GA8489@redhat.com><wvlhenatjtp.fsf@prospero.cambridge.redhat.com><20020321002035.06142@taarna.cygnus.com><wvlbsditjhg.fsf@prospero.cambridge.redhat.com>
Here's a patch that allows both -O -fno-inline and -O0 -finline. Tested
i686-pc-linux-gnu, applied trunk and 3.1.
2002-04-06 Jason Merrill <jason@redhat.com>
* toplev.c (flag_no_inline, flag_really_no_inline): Default to 2.
(parse_options_and_default_flags): Set them appropriately.
* c-common.c (c_common_post_options): Don't set flag_really_no_inline.
*** toplev.c.~1~ Thu Apr 4 09:54:52 2002
--- toplev.c Sat Apr 6 17:40:04 2002
*************** int flag_keep_inline_functions;
*** 636,647 ****
/* Nonzero means that functions will not be inlined. */
! int flag_no_inline;
/* Nonzero means that we don't want inlining by virtue of -fno-inline,
not just because the tree inliner turned us off. */
! int flag_really_no_inline;
/* Nonzero means that we should emit static const variables
regardless of whether or not optimization is turned on. */
--- 636,647 ----
/* Nonzero means that functions will not be inlined. */
! int flag_no_inline = 2;
/* Nonzero means that we don't want inlining by virtue of -fno-inline,
not just because the tree inliner turned us off. */
! int flag_really_no_inline = 2;
/* Nonzero means that we should emit static const variables
regardless of whether or not optimization is turned on. */
*************** parse_options_and_default_flags (argc, a
*** 4716,4721 ****
--- 4716,4726 ----
}
}
+ if (flag_no_inline == 2)
+ flag_no_inline = 0;
+ else
+ flag_really_no_inline = flag_no_inline;
+
/* Set flag_no_inline before the post_options () hook. The C front
ends use it to determine tree inlining defaults. FIXME: such
code should be lang-independent when all front ends use tree
*************** parse_options_and_default_flags (argc, a
*** 4735,4740 ****
--- 4740,4748 ----
warning ("-Wuninitialized is not supported without -O");
}
+ if (flag_really_no_inline == 2)
+ flag_really_no_inline = flag_no_inline;
+
/* All command line options have been parsed; allow the front end to
perform consistency checks, etc. */
(*lang_hooks.post_options) ();
*** c-common.c.~1~ Thu Apr 4 09:54:52 2002
--- c-common.c Wed Apr 3 21:39:53 2002
*************** c_common_post_options ()
*** 4111,4119 ****
{
cpp_post_options (parse_in);
- /* Save no-inline information we may clobber below. */
- flag_really_no_inline = flag_no_inline;
-
flag_inline_trees = 1;
/* Use tree inlining if possible. Function instrumentation is only
--- 4111,4116 ----