This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Define __NO_INLINE__ if not inlining


Hi!

Some glibc optimizations (namely bits/string2.h) check whether inlining will
be done and if so, optimize, otherwise don't do anything.
The check used there is currently:

#if defined __GNUC__ && __GNUC__ >= 2
# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined __cplusplus
#  ifndef __NO_STRING_INLINES
...

This works well most of the time, but fails badly if people do:
#include <string.h>
and use -O2 -fno-inline (e.g. avifile does that, some others as well).
What do you think about the following patch which would define __NO_INLINE__
if inline keyword won't be honored, so that glibc could use that check as
well?

2001-05-04  Jakub Jelinek  <jakub@redhat.com

	* gcc.c (cpp_options): Define __NO_INLINE__ unless we are honoring
	"inline" keyword.

--- gcc/gcc.c.jj	Thu May  3 20:12:47 2001
+++ gcc/gcc.c	Fri May  4 22:08:38 2001
@@ -647,7 +647,7 @@ static const char *cpp_options =
  %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
  %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
  %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
- %{ffast-math:-D__FAST_MATH__}\
+ %{fno-inline|O0|!O*:-D__NO_INLINE__} %{ffast-math:-D__FAST_MATH__}\
  %{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\
  %{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0}\
  %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}}\

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]