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 to support C99 __STDC_HOSTED__


This patch adds support for C99's __STDC_HOSTED__.  It isn't perfect -
suitable combinations of the -ffreestanding, -fhosted,
-fno-freestanding and -fno-hosted will get the wrong definition
(e.g. `-ffreestanding -fhosted') - but it works for any single one of
these options or none of them.  This is no worse than `-funsigned-char
-fsigned-char' which (at least on systems with char signed) will lead
to a signed char but __CHAR_UNSIGNED__ defined as well.  Perhaps a
specs expert can explain how to fix such problems in general - i.e.,
how to ensure that what the specs do agrees with the compiler's
internal logic setting the variables controlling its behaviour,
including where headers that override each other are used multiple
times and interleaved.

Bootstrapped with no regressions on i686-pc-linux-gnu.  OK to commit?

2000-09-16  Joseph S. Myers  <jsm28@cam.ac.uk>

	* gcc.c (cpp_options): Add specs for __STDC_HOSTED__.

--- gcc.c.orig	Sat Sep 16 20:33:30 2000
+++ gcc.c	Sat Sep 16 21:01:34 2000
@@ -564,6 +564,8 @@ static const char *cpp_options =
  %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
  %{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}}\
  %{fshow-column} %{fno-show-column}\
  %{fleading-underscore} %{fno-leading-underscore}\
  %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{U*} %{D*} %{i*} %Z %i\

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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