public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Basile Starynkevitch <basile@starynkevitch.net>
To: Basile Starynkevitch <basile@starynkevitch.net>
Cc: Diego Novillo <dnovillo@google.com>, gcc@gcc.gnu.org
Subject: Re: status of GCC & C++
Date: Sun, 25 Mar 2012 20:11:00 -0000	[thread overview]
Message-ID: <20120325221053.7456228239cf52763554320b@starynkevitch.net> (raw)
In-Reply-To: <20120325203031.4a1a36828c16f7481aa0c567@starynkevitch.net>

On Sun, 25 Mar 2012 20:30:31 +0200
Basile Starynkevitch <basile@starynkevitch.net> wrote:
> 
> How can a plugin know that cc1 was compiled with C++ or just with
> plain C? I don't really know (we do have GCCPLUGIN_VERSION, but should a plugin use
> ENABLE_BUILD_WITH_CXX)?

Actually, I tend to believe that this is really a bug in GCC 4.7 (specifically). I think
that 
  A)  gcc-4.7 -v should obviously tell if it was compiled in C++ mode or in C mode, since
this information is crucial to plugins. On Debian/Sid I don't have a simple way to get
that information.
% /usr/bin/gcc-4.7 -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.0-1'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c+
+,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c+
+/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu Thread model: posix gcc version 4.7.0 (Debian 4.7.0-1) 

Nothing above tell me about GCC being compiled in C++ flavor


  B) the $(gcc-4.7 -print-file-name=plugin)/ directory should have a header file with
something telling if it was compiled in C++ or C mode. (Perhaps ENABLE_BUILD_WITH_GCC
might have that role in auto-host.h, but then I think it is grossly misnamed).

Since 4.7 is probably the only release of GCC which can be compiled by C and by C++ I
believe it is a bug specific to that release.

I'm sure this bug affect several GCC plugins. It does affect GCC MELT for instance.
https://groups.google.com/forum/?fromgroups#!topic/gcc-melt/PRWr28sQExk

My feeling is that it is not only the plugins' fault (so it is not only a MELT plugin
bug, but a GCC one)


What do you think? Should 4.7.1 provide a fix to correct that? How? Testing simply
ENABLE_BUILD_WITH_GCC makes me feel unhappy; that name is really confusing, if we
understand and use it as GCC_IS_BUILT_WITH_CXX

My wish would be to add, perhaps in gcc/configure.ac of GCC 4.7.1, something which
defines GCCPLUGIN_IN_CXX in e.g.  $(gcc-4.7 -print-file-name=plugin)/plugin-version.h
when gcc-4.7 have been built with a C++ compiler so its plugins need to be compiled with
a C++ compiler. That information should also be accessible (e.g. for plugin makers) thru
some invocation of GCC (perhaps gcc -v).


Cheers 

PS. Compatibility with C++ plugins was already discussed, but I forgot when... Here I
focus on a possible bug of GCC 4.7.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

  reply	other threads:[~2012-03-25 20:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-25 17:19 Basile Starynkevitch
2012-03-25 17:25 ` Diego Novillo
2012-03-25 17:33   ` Eric Botcazou
2012-03-25 17:44     ` Diego Novillo
2012-03-25 21:37       ` Eric Botcazou
2012-03-25 21:46         ` Diego Novillo
2012-03-25 22:01           ` Gabriel Dos Reis
2012-03-28 19:50           ` Eric Botcazou
     [not found]   ` <20120325192843.05bf843acfb715c4bc9cd4aa@starynkevitch.net>
     [not found]     ` <4F6F5E48.90404@google.com>
2012-03-25 18:31       ` Basile Starynkevitch
2012-03-25 20:11         ` Basile Starynkevitch [this message]
2012-03-25 20:21           ` Gabriel Dos Reis
2012-03-25 20:29           ` Marc Glisse
2012-03-26 15:59           ` Configure-time testing for GCC plugins to determine C vs C++? (Was Re: status of GCC & C++) David Malcolm
2012-03-26 17:07             ` Joseph S. Myers
2012-03-26 18:18               ` David Malcolm
2012-03-26 18:33                 ` Basile Starynkevitch
2012-03-26 20:34                   ` Romain Geissler
2012-03-27  5:53                     ` Basile Starynkevitch
2012-03-27 10:23 ` status of GCC & C++ Ludovic Courtès

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=20120325221053.7456228239cf52763554320b@starynkevitch.net \
    --to=basile@starynkevitch.net \
    --cc=dnovillo@google.com \
    --cc=gcc@gcc.gnu.org \
    /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).