public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marc Glisse <marc.glisse@inria.fr>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc@gcc.gnu.org
Subject: Re: PATCH RFA: Build stages 2 and 3 with C++
Date: Sun, 31 Jul 2011 23:20:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.02.1108010008200.5578@laptop-mg.saclay.inria.fr> (raw)
In-Reply-To: <mcroc0u3ef5.fsf@coign.corp.google.com>

On Fri, 15 Jul 2011, Ian Lance Taylor wrote:

> I would like to propose this patch as a step toward building gcc using a
> C++ compiler.  This patch builds stage1 with the C compiler as usual,
> and defaults to building stages 2 and 3 with a C++ compiler built during
> stage 1.  This means that the gcc installed and used by most people will
> be built by a C++ compiler.  This will ensure that gcc is fully
> buildable with C++, while retaining the ability to bootstrap with only a
> C compiler, not a C++ compiler.

Nice step. Now that gcc can (mostly) build with g++, it would be great if 
it could build with a non-gnu compiler. More precisely, with a compiler 
that doesn't define __GNUC__. Indeed, the code is quite different in this 
case, as can be seen trying to compile gcc with CC='gcc -U__GNUC__' and 
CXX='g++ -U__GNUC__' (there are other reasons why this won't work, but at 
least it shows some of the same issues I see with sunpro).


To start with, the obstack_free macro casts a pointer to an int -> error.
/data/repos/gcc/trunk/libcpp/directives.c:2048:7: error: cast from Β‘char*Β’ 
to Β‘intΒ’ loses precision [-fpermissive]


Then, ENUM_BITFIELD(cpp_ttype) is expanded to unsigned int instead of the 
enum, and conversions from int to enum require an explicit cast in C++, 
giving many errors like:
/data/repos/gcc/trunk/libcpp/charset.c:1615:79: error: invalid conversion 
from Β‘unsigned intΒ’ to Β‘cpp_ttypeΒ’ [-fpermissive]
/data/repos/gcc/trunk/libcpp/charset.c:1371:1: error:   initializing 
argument 5 of Β‘bool cpp_interpret_string(cpp_reader*, const cpp_string*, 
size_t, cpp_string*, cpp_ttype)Β’ [-fpermissive]

Do we want to add a cast in almost every place a field declared with 
ENUM_BITFIELD is used? That's quite a lot of places, everywhere in gcc...
The alternative would be to store the full enum instead of a bitfield 
(just for stage1 so that's not too bad), but some comments in the code 
seem to advise against it.

-- 
Marc Glisse

  parent reply	other threads:[~2011-07-31 22:56 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-16  6:56 Ian Lance Taylor
2011-07-16  7:05 ` Andrew Pinski
2011-07-16  7:48   ` Ian Lance Taylor
2011-07-16  7:59     ` Basile Starynkevitch
2011-07-17  3:17       ` Ian Lance Taylor
2011-07-16 16:11 ` Diego Novillo
2011-07-16 22:58   ` Ian Lance Taylor
2011-07-17 10:36     ` Richard Guenther
2011-07-17 12:21       ` Eric Botcazou
2011-07-17 16:55         ` Richard Guenther
2011-07-17 17:55           ` Markus Trippelsdorf
2011-07-17 22:37             ` Markus Trippelsdorf
2011-09-04 17:20   ` Thomas Schwinge
2011-07-16 20:40 ` Toon Moene
2011-07-19 21:33 ` Ian Lance Taylor
2011-07-19 22:24   ` Gabriel Dos Reis
2011-07-20  0:46   ` H.J. Lu
2011-07-20  1:15     ` H.J. Lu
2011-07-20  6:28   ` David Edelsohn
2011-07-20  9:34     ` Jonathan Wakely
2011-07-20 11:02       ` Jonathan Wakely
2011-07-20 12:41         ` David Edelsohn
2011-07-20 12:48           ` Richard Guenther
2011-07-20 14:07             ` Diego Novillo
2011-07-20 14:34               ` Ian Lance Taylor
2011-07-20 15:35                 ` Jonathan Wakely
2011-07-20 15:06   ` Toon Moene
2011-07-20 15:23     ` Ian Lance Taylor
2011-07-20 15:53       ` David Edelsohn
2011-07-20 15:55         ` Ian Lance Taylor
2011-07-20 20:05           ` David Edelsohn
2011-07-20 20:53             ` Ian Lance Taylor
2011-07-20 21:06               ` Mike Stump
2011-07-21  0:10                 ` Ian Lance Taylor
2011-07-21  9:40                   ` Basile Starynkevitch
2011-07-21 16:06                     ` Ian Lance Taylor
2011-07-21 17:44                       ` Jakub Jelinek
2011-07-21 19:40                         ` Ian Lance Taylor
2011-07-21 20:12                           ` Basile Starynkevitch
2011-07-21 22:38                             ` Ian Lance Taylor
2011-07-21  6:57                 ` David Edelsohn
2011-07-21  7:25                   ` Eric Botcazou
2011-07-21 14:24               ` David Edelsohn
2011-07-20 17:58         ` Thomas Schwinge
2011-07-20 21:41     ` Toon Moene
2011-07-31 23:20 ` Marc Glisse [this message]
2011-08-01  9:14   ` Richard Guenther
2011-08-01  9:53     ` Joseph S. Myers
2011-08-01  9:59       ` Richard Guenther
2011-08-01 10:05       ` Marc Glisse
2011-08-08 17:42 ` Romain Geissler
2011-08-08 18:49   ` Ian Lance Taylor
2011-08-08 19:40     ` Romain Geissler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1108010008200.5578@laptop-mg.saclay.inria.fr \
    --to=marc.glisse@inria.fr \
    --cc=gcc@gcc.gnu.org \
    --cc=iant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).