public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* rest of the ix86 patch
@ 1998-04-08  2:13 Ulrich Drepper
  1998-04-17 17:53 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Drepper @ 1998-04-08  2:13 UTC (permalink / raw)
  To: egcs

Hi,

Richard already applied most of the ix86 patch I sent last week.  This
is the rest:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: config/i386/i386.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/i386.h,v
retrieving revision 1.17
diff -u -r1.17 i386.h
--- i386.h	1998/04/04 20:25:41	1.17
+++ i386.h	1998/04/08 00:53:05
@@ -304,36 +304,30 @@
 %{mpentiumpro:-mcpu=pentiumpro}}"
 #endif
 \f
-#ifndef CPP_CPU_SPEC
-#ifdef __STDC__
+#ifndef CPP_CPU_DEFAULT_SPEC
 #if TARGET_CPU_DEFAULT == 1
-#define CPP_CPU_DEFAULT "-Di486"
+#define CPP_CPU_DEFAULT_SPEC "-Di486"
 #else
 #if TARGET_CPU_DEFAULT == 2
-#define CPP_CPU_DEFAULT "-Di586"
+#define CPP_CPU_DEFAULT_SPEC "-Dpentium -Di586"
 #else
 #if TARGET_CPU_DEFAULT == 3
-#define CPP_CPU_DEFAULT "-Di686"
+#define CPP_CPU_DEFAULT_SPEC "-Dpentiumpro -Di686"
 #else
-#define CPP_CPU_DEFAULT ""
+#define CPP_CPU_DEFAULT_SPEC ""
 #endif
 #endif
-#endif /* TARGET_CPU_DEFAULT */
-
-#define CPP_CPU_SPEC "\
--Di386 " CPP_CPU_DEFAULT " -Asystem(unix) -Acpu(i386) -Amachine(i386) \
-%{mcpu=i486:-Di486} %{m486:-Di486} \
-%{mpentium:-Dpentium -Di586} %{mcpu=pentium:-Dpentium -Di586} \
-%{mpentiumpro:-Dpentiumpro -Di686} %{mcpu=pentiumpro:-Dpentiumpro -Di686}"
+#endif
+#endif /* CPP_CPU_DEFAULT_SPEC */
 
-#else
+#ifndef CPP_CPU_SPEC
 #define CPP_CPU_SPEC "\
 -Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386) \
 %{mcpu=i486:-Di486} %{m486:-Di486} \
 %{mpentium:-Dpentium -Di586} %{mcpu=pentium:-Dpentium -Di586} \
-%{mpentiumpro:-Dpentiumpro -Di686} %{mcpu=pentiumpro:-Dpentiumpro -Di686}"
-#endif /* __STDC__ */
-#endif /* CPP_CPU_SPEC */
+%{mpentiumpro:-Dpentiumpro -Di686} %{mcpu=pentiumpro:-Dpentiumpro -Di686} \
+%{!mcpu:%{!m486:%{!mpentium*: %(cpp_cpu_default)}}}"
+#endif
 
 #ifndef CC1_SPEC
 #define CC1_SPEC "%(cc1_spec) "
@@ -354,6 +348,7 @@
 #endif
 
 #define EXTRA_SPECS							\
+  { "cpp_cpu_default",	CPP_CPU_DEFAULT_SPEC },				\
   { "cpp_cpu",	CPP_CPU_SPEC },						\
   { "cc1_cpu",  CC1_CPU_SPEC },						\
   SUBTARGET_EXTRA_SPECS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*BUT* this is not really correct since gcc cannot handle this

	%{!mcpu:%{!m486:%{!mpentium*: %(cpp_cpu_default)}}}

correctly.  The problem is that gcc runs over the string a second
time, adding __*__ to the defines.  But it does so before the %(...) 
expressions are expanded (at least this is how I explain me the
output).  So I get

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc version egcs-2.91.16 980328 (gcc-2.8.0 release)
 /happy/clown/H-egcs-i686-linux-gnu/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.16/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386) -Dpentiumpro -Di686 -D__i386__ -Asystem(unix) -Acpu(i386) -Amachine(i386) -Dpentiumpro -Di686 u.c /tmp/cca00342.i
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

instead of

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc version egcs-2.91.16 980328 (gcc-2.8.0 release)
 /happy/clown/H-egcs-i686-linux-gnu/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.16/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386) -Dpentiumpro -Di686 -D__i386__ -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__pentiumpro__ -D__i686__ u.c /tmp/cca00342.i
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(Please note the last two -D parameters).


I think the solution for this problem is to expand the string before
generating the __*__ protected names.  I don't know where this happens
so if somebody knows more about this please step ahead :-). Otherwise
I'd appreciate pointers.

-- Uli
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: rest of the ix86 patch
  1998-04-08  2:13 rest of the ix86 patch Ulrich Drepper
@ 1998-04-17 17:53 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 1998-04-17 17:53 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: egcs

	*BUT* this is not really correct since gcc cannot handle this

	%{!mcpu:%{!m486:%{!mpentium*: %(cpp_cpu_default)}}}

	correctly.  The problem is that gcc runs over the string a second
	time, adding __*__ to the defines.  But it does so before the %(...) 
	expressions are expanded (at least this is how I explain me the
	output).

You fix this by using %[cpp_cpu_default] instead of %(cpp_cpu_default).
Using [] instead of () tells gcc that it should add underscores to any
preprocessor defines contained within.  I think this is enough to make
your patch work the way you want it to.

There are still some minor problems though.  First is that we get __FOO__ but
not __FOO.  Normally we get both.  Second is that we get FOO even when -ansi.
Normally we don't.  I'd been meaning to fix these problems but haven't had
time for it yet.  They shouldn't interfere with what you are doing though.

Jim

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-04-17 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-08  2:13 rest of the ix86 patch Ulrich Drepper
1998-04-17 17:53 ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).