Can any open source compiler convert C++ source to C source?

Can any open source compiler convert C++ source to C source?

Post by Daniel Wilkers » Thu, 31 Jan 2002 11:20:20



Hi.  I have a tool for doing static program analysis of C programs,
but I would like to run it on a C++ program.  I don't need to compile
the resulting code, just run it through this static analysis tool.
The output doesn't even need to be readable.  Is there any compiler
that will do this that I don't have to spend a lot for?

Please email response in addition to posting.

Thank you,
Daniel
daniel_wilkerson at yahoo.com

 
 
 

Can any open source compiler convert C++ source to C source?

Post by Dann Corbi » Thu, 31 Jan 2002 15:03:41



Quote:> Hi.  I have a tool for doing static program analysis of C programs,
> but I would like to run it on a C++ program.

Why not cough up the cash for a copy of Lint?  It works on C++
http://www.gimpel.com/

Quote:> I don't need to compile
> the resulting code, just run it through this static analysis tool.
> The output doesn't even need to be readable.

Good, because it won't be.

Quote:> Is there any compiler
> that will do this that I don't have to spend a lot for?

C-Front type compilers can do this.  But what they spew out will be an
unintelligible mess.
http://www.unipress.com/toolkit/cfront.html
http://www.epc.co.uk/search.html
Some others too, I think.
--
C-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
 "The C-FAQ Book" ISBN 0-201-84519-9
C.A.P. FAQ: ftp://cap.connx.com/pub/Chess%20Analysis%20Project%20FAQ.htm

 
 
 

Can any open source compiler convert C++ source to C source?

Post by Greg Come » Sat, 02 Feb 2002 14:05:13






>> Hi.  I have a tool for doing static program analysis of C programs,
>> but I would like to run it on a C++ program.

>Why not cough up the cash for a copy of Lint?  It works on C++
>http://www.gimpel.com/

That could help.  Of course though, the static analysis he's
interested in may not be lint'y kinds of things.

Quote:>> I don't need to compile
>> the resulting code, just run it through this static analysis tool.
>> The output doesn't even need to be readable.

>Good, because it won't be.

>> Is there any compiler
>> that will do this that I don't have to spend a lot for?

>C-Front type compilers can do this.  But what they spew out will be an
>unintelligible mess.

Right, it's not necessarily intended for people.

Quote:>http://www.unipress.com/toolkit/cfront.html
>http://www.epc.co.uk/search.html
>Some others too, I think.

As you know, Comeau C++ generates C too, is an active product,
extremely up to date, and customizing such things is part of
what we do, unlike many of the others.
--
Greg Comeau   What's next: additional Windows backends and 'export'!
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?