From: daniel@poradnik-webmastera.com
To: gcc-help@gcc.gnu.org
Subject: Re: C++ name mangling in C
Date: Sat, 09 Aug 2014 20:28:00 -0000 [thread overview]
Message-ID: <20140809222815.Horde.fi7naBAb0FA72H4icn4BOg1@sirzooro.prohost.pl> (raw)
In-Reply-To: <alpine.DEB.2.11.1408092157400.10998@stedding.saclay.inria.fr>
Cytowanie Marc Glisse <marc.glisse@inria.fr>:
>> Therefore I was looking for a way to detect such bugs with some
>> tool. I thought about forcing C++ mangling when compiling C code,
>> but looks that gcc does not have any command line option to this.
>> Please correct me if I am wrong.
>>
>> If there is no such option, I would like to open an enhancement to
>> add it. I thought about it for some time and looks that this new
>> option should do 3 things: enable C++ name mangling, enable extern
>> "C" directive and define the __cplusplus macro. Any comments on
>> this proposal is also welcome.
>
> How about compiling your code with g++ then? (possibly add
> -fpermissive to accept more C-isms)
I already tried, and got error on some typedef struct declaration (do
not remember exact syntax now). I will try to add -fpermissive and see
if it will help.
> If you define __cplusplus, you'll need a C++ compiler anyway because
> the headers will contain C++ code.
I see. In my case this is needed mostly for C stdlib. Other 3rd party
libs usually have C and C++ interface separated, so simple support for
extern "C" would be enough.
Another option to use instead of defining __cplusplus is to generate C
names for functions defined in system headers (including ones from
paths specified with -isystem). But this seems to be more complex,
probably some extra interaction between preprocessor and compiler
would be needed.
> Compiling with -flto may also generate interesting messages.
Will give it a try too.
--
Regards,
Daniel
next prev parent reply other threads:[~2014-08-09 20:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-09 19:51 daniel
2014-08-09 20:00 ` Marc Glisse
2014-08-09 20:28 ` daniel [this message]
2014-08-10 0:50 ` Jonathan Wakely
2014-08-10 19:55 ` daniel
2014-08-10 23:36 ` Jonathan Wakely
2014-08-11 10:45 ` daniel
2014-08-11 11:24 ` Jonathan Wakely
2014-08-11 12:16 ` daniel
[not found] ` <20140811141602.Horde.U2tZekSvXHQDnS4cFS-29A1@sirzooro.proh ost.pl>
2014-08-11 12:40 ` Fabian Cenedese
2014-08-11 11:29 ` Florian Weimer
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=20140809222815.Horde.fi7naBAb0FA72H4icn4BOg1@sirzooro.prohost.pl \
--to=daniel@poradnik-webmastera.com \
--cc=gcc-help@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).