LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-18-2006, 11:08 AM   #1
angustia
Member
 
Registered: Apr 2003
Location: chile
Posts: 58

Rep: Reputation: 15
C: preprocess only ifdefs


hi

i've got a big ugly c code, full of

#ifdef WIN32
#elif LINUX
#else
#endif

i would like to process the code to apply only #ifdefs, to extract the LINUX version fo the code.

i tried cpp but it adds more code from the #include files and replaces constants with their values, losing their meanings.

there's some tool for that? or something with M4?

thanks in advance
 
Old 12-18-2006, 01:19 PM   #2
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
There is unifdef command, which has gained a lot of publicity recently because it is used by the new headers_install target of Linux kernel makefiles. If your distro does not have it packaged, you can get it from here. See the manpage for usage.
 
Old 12-18-2006, 02:30 PM   #3
angustia
Member
 
Registered: Apr 2003
Location: chile
Posts: 58

Original Poster
Rep: Reputation: 15
Thumbs up

deleted

i realised that the problem is elsewhere...

unifdef can work with segments of the source file but with the whole file it seems fail and nothing get changed... and there's no error message

Last edited by angustia; 12-18-2006 at 05:06 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
#ifdefs versus runtime arguments Dark_Helmet Programming 5 09-27-2004 11:52 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration