This is the mail archive of the 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]
Other format: [Raw text]

Re: Configure-time testing for GCC plugins to determine C vs C++? (Was Re: status of GCC & C++)


Le 26 mars 2012 à 20:33, Basile Starynkevitch a écrit :

> And I still think that GCC 4.7.1 should be able to tell by itself if it was compiled by C
> or by C++.

Actually you can already find it for every GCC version you are interested in (4.6.x and 4.7.x), with very little logic, as it was pointed out to you yesterday here and here (the solution with gcc -v as using nm is not a portable solution).

This will work in most case : the targeted GCC you want to build a plugin for can be run on the build machine.

If you need to be able to cross-build a plugin on arch A for a targeted GCC running on host arch B, then you won't be able to invoke gcc -v.

Anyway there is a a solution that works all the time, all you need is being able to grep in a file for a given pattern. Just take a look at the following file :  $(gcc -print-file-name=plugin)/include/auto-host.h

You'll find something like this :

/* Define if building with C++. */

So that's it, you already got all you need for all version.


Romain Geissler

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