Jump to content
  • Advertisement
Sign in to follow this  
_walrus

outputing code path at preprocesser time

This topic is 5411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, is there a tool that allows for the input of c/c++ code and it outputs only the code from the path set by the preprocessor flags. I have some code that i want to cut out all the code paths that dont get compiled. thanks

Share this post


Link to post
Share on other sites
Advertisement
no what i mean is that i i want to generate a source file that containes the original source minus all the code that is ommited from by the preprocessor.


for instance if i had a file:
#define LINUX

#if defined(LINUX)
foo();
foo();
foo();
#else
boo();
boo();
boo();
#endif


the tool would produce

foo();
foo();
foo();


I want this cause i i have some C source (actually a lot) that i want to port to Java. I want to do this fast so i want to get rid of as much clutter as possible (i'm only porting one specific) compile path over. For instance this thing has build paths for 64 bit processor, asm,... etc and i wwant to get ride of this stuff using some automated process. I'm sure there's gotta be a tool out there that does this cause its pretty much just running the copiler with out the syntactic transduction.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by _walrus
Hi, is there a tool that allows for the input of c/c++ code and it outputs only the code from the path set by the preprocessor flags. I have some code that i want to cut out all the code paths that dont get compiled. thanks

The C-language FAQ has a short section on selective preprocessors.

Share this post


Link to post
Share on other sites
The previous post was mine. Firefox just doesn't want to keep me logged in today..

Quote:
Original post by _walrus
Hi, is there a tool that allows for the input of c/c++ code and it outputs only the code from the path set by the preprocessor flags. I have some code that i want to cut out all the code paths that dont get compiled. thanks

The C-language FAQ has a short section on selective preprocessors.

Share this post


Link to post
Share on other sites
Quote:
Original post by doynax
The previous post was mine. Firefox just doesn't want to keep me logged in today..

Quote:
Original post by _walrus
Hi, is there a tool that allows for the input of c/c++ code and it outputs only the code from the path set by the preprocessor flags. I have some code that i want to cut out all the code paths that dont get compiled. thanks

The C-language FAQ has a short section on selective preprocessors.



Perfect thats exacty what i want. Thanks a million!!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!