All,
I'm looking for a tool that is able to take my code base (which is
full of preprocessor directives) and spit out source code that is
"clean" of any preprocessor directives based on the options I choose
(possibly via some kind of user input screen).
Does such a tool exist? A Visual Studio plugin would be even better.
FYI: I have requirements to rid my code of all conditionally compiled
code.
Thanks,
Dan 14 2575
lagman wrote:
All,
I'm looking for a tool that is able to take my code base (which is
full of preprocessor directives) and spit out source code that is
"clean" of any preprocessor directives based on the options I choose
(possibly via some kind of user input screen).
Most compilers have an options to output the pre-processes code. -E is
often used for this.
--
Ian Collins
Ian Collins wrote:
lagman wrote:
>All,
I'm looking for a tool that is able to take my code base (which is full of preprocessor directives) and spit out source code that is "clean" of any preprocessor directives based on the options I choose (possibly via some kind of user input screen).
Most compilers have an options to output the pre-processes code. -E is
often used for this.
... but that's not a good tool for the task, because it will
expand all the macros and replace #include directives with the
included source.
The FAQ has pointers to some tools that might address the
problem better. (Can't vouch for them myself, but the pointers
are probably worth a look.)
-- Er*********@sun .com
Eric Sosman wrote:
Ian Collins wrote:
>lagman wrote:
>>All,
I'm looking for a tool that is able to take my code base (which is full of preprocessor directives) and spit out source code that is "clean" of any preprocessor directives based on the options I choose (possibly via some kind of user input screen).
Most compilers have an options to output the pre-processes code. -E is often used for this.
... but that's not a good tool for the task, because it will
expand all the macros and replace #include directives with the
included source.
Isn't #include a preprocessor directive?
The OP asked for something that would 'spit out source code that is
"clean" of any preprocessor directives'.
--
Ian Collins
Ian Collins <ia******@hotma il.comwrites:
Eric Sosman wrote:
>Ian Collins wrote:
>>lagman wrote: All,
I'm looking for a tool that is able to take my code base (which is full of preprocessor directives) and spit out source code that is "clean" of any preprocessor directives based on the options I choose (possibly via some kind of user input screen).
Most compilers have an options to output the pre-processes code. -E is often used for this.
... but that's not a good tool for the task, because it will expand all the macros and replace #include directives with the included source.
Isn't #include a preprocessor directive?
Yes, but...
The OP asked for something that would 'spit out source code that is
"clean" of any preprocessor directives'.
They clarified the requirement:
| FYI: I have requirements to rid my code of all conditionally compiled
| code.
--
Ben.
Ben Bacarisse wrote:
Ian Collins <ia******@hotma il.comwrites:
>Eric Sosman wrote:
>>Ian Collins wrote: lagman wrote: All, > I'm looking for a tool that is able to take my code base (which is full of preprocessor directives) and spit out source code that is "clean" of any preprocessor directives based on the options I choose (possibly via some kind of user input screen). > Most compilers have an options to output the pre-processes code. -E is often used for this. ... but that's not a good tool for the task, because it will expand all the macros and replace #include directives with the included source.
Isn't #include a preprocessor directive?
Yes, but...
>The OP asked for something that would 'spit out source code that is "clean" of any preprocessor directives'.
They clarified the requirement:
| FYI: I have requirements to rid my code of all conditionally compiled
| code.
Which -E would do.
--
Ian Collins
Ian Collins <ia******@hotma il.comwrites:
Ben Bacarisse wrote:
>Ian Collins <ia******@hotma il.comwrites:
>>Eric Sosman wrote: Ian Collins wrote: lagman wrote: >All, >> >I'm looking for a tool that is able to take my code base (which is >full of preprocessor directives) and spit out source code that is >"clean" of any preprocessor directives based on the options I choose >(possibl y via some kind of user input screen). >> Most compilers have an options to output the pre-processes code. -E is often used for this. ... but that's not a good tool for the task, because it will expand all the macros and replace #include directives with the included source.
Isn't #include a preprocessor directive?
Yes, but...
>>The OP asked for something that would 'spit out source code that is "clean" of any preprocessor directives'.
They clarified the requirement:
| FYI: I have requirements to rid my code of all conditionally compiled | code.
Which -E would do.
I never said otherwise! A tool that follows #includes (so it can find
#defines and so on) but does not replace them is more useful than -E.
Once you have expanded #includes you may not even have C anymore! You
certainly won't have portable C. The result might not even compile
using different compiler flags.
Eric was saying that the OP's *real* requirement might be better
served with a tool that is less crude than actually running the
pre-processor.
--
Ben.
Ian Collins wrote:
Eric Sosman wrote:
>Ian Collins wrote:
>>lagman wrote: All,
I'm looking for a tool that is able to take my code base (which is full of preprocessor directives) and spit out source code that is "clean" of any preprocessor directives based on the options I choose (possibly via some kind of user input screen).
Most compilers have an options to output the pre-processes code. -E is often used for this.
... but that's not a good tool for the task, because it will expand all the macros and replace #include directives with the included source.
Isn't #include a preprocessor directive?
The OP asked for something that would 'spit out source code that is
"clean" of any preprocessor directives'.
You're right. Sorry; I'd imagined for a moment that
the O.P. was asking for something useful.
O.P.: Follow Ian's suggestion to get source code that
is completely free from preprocessor directives (perhaps
after stripping out some #line directives), and almost
completely useless. You will never be able to move the
resulting source to another machine, or even to another
compiler. You may not even be able to move it to your
current compiler if you decide to change the compilation
options or apply the latest patches. Have a nice life!
--
Eric Sosman es*****@ieee-dot-org.invalid
On Oct 23, 2:46*am, lagman <dan_hoff...@ha ilmail.netwrote :
All,
I'm looking for a tool that is able to take my code base (which is
full of preprocessor directives) and spit out source code that is
"clean" of any preprocessor directives based on the options I choose
(possibly via some kind of user input screen).
Does such a tool exist? *A Visual Studio plugin would be even better.
FYI: *I have requirements to rid my code of all conditionally compiled
code.
Do you wish that your code should be 'compilable' after you get rid of
all preprocessor directives ? Or you just want to run some static code
analysis tool on it ?
- Pranav http://pranavsbrain.peshwe.com
On Oct 22, 8:05*pm, Eric Sosman <esos...@ieee-dot-org.invalidwrot e:
Ian Collins wrote:
Eric Sosman wrote:
Ian Collins wrote: lagman wrote: All,
>>I'm looking for a tool that is able to take my code base (which is full of preprocessor directives) and spit out source code that is "clean" of any preprocessor directives based on the options I choose (possibly via some kind of user input screen).
>Most compilers have an options to output the pre-processes code. *-E is often used for this.
* * ... but that's not a good tool for the task, because it will
expand all the macros and replace #include directives with the
included source.
Isn't #include a preprocessor directive?
The OP asked for something that would 'spit out source code that is
"clean" of any preprocessor directives'.
* * *You're right. *Sorry; I'd imagined for a moment that
the O.P. was asking for something useful.
* * *O.P.: Follow Ian's suggestion to get source code that
is completely free from preprocessor directives (perhaps
after stripping out some #line directives), and almost
completely useless. *You will never be able to move the
resulting source to another machine, or even to another
compiler. *You may not even be able to move it to your
current compiler if you decide to change the compilation
options or apply the latest patches. *Have a nice life!
--
Eric Sosman
esos...@ieee-dot-org.invalid- Hide quoted text -
- Show quoted text -
Sorry.. I'll clarify.. Not all preprocessor directives, just
conditionally compiled code (i.e. #ifdef/#ifndef)
Thanks,
Dan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: qazmlp |
last post by:
I hope comp.lang.c will not find the following question as a
complete off-topic.
I would like to remove ie.comment out the 'cout' statements during
compilation(actually preprocessing) time.
The statements like this:
cout<<"something\n" ;
should be made as
|
by: Trying_Harder |
last post by:
Is it possible to redefine a macro with global scope after
undefining it in a function? If yes, could someone explain
how?
/If/ my question above isn't very clear you can refer to
the following example.
eg cosider 2 files sample.c and sample.h
sample.h
|
by: seemanta dutta |
last post by:
Greetings C gurus,
I have used preprocessor directives since a very long time. But
whenever I see some professional piece of C code, the linux kernel for
example, I get literally confused by the amount of preprocessor
directives used in these code.
Can anyone please tell me how to actually use these preprocessor
directives in a more...
|
by: max(01)* |
last post by:
hi.
i want to examine preprocessed source which only has certain macros
expanded, for example i would like to have:
#include <stdio.h>
#include "other.c"
int main() {
...
}
|
by: Christopher Ireland |
last post by:
Hello,
I'm looking for a C# Preprocessor (shareware with source, if possible)
which has the functionality of preprocessors which already exist in
other languages, e.g.
http://www.zeitungsjunge.de/delphi/dipp/
DIPP is a Pascal Preprocessor. The purpose of DIPP is to manipulate
Pascal source code files.
| |
by: claus.tondering |
last post by:
I need to write a macro that inserts
someStruct m_someStruct;
into another struct declaration.
The problem is that if the programmer specifies one particluar struct
(called alpha), nothing should be inserted.
So, is it possible to write a macro that does this:
MACRO(alpha) expands to nothing
|
by: Urs Thuermann |
last post by:
Does a tool exist to apply C preprocessor expansion to a C source only
partially, i.e. replace only some directives? I want to replace some
#if's by their expansions, e.g. all #ifdef SOME_SYMBOL, but keep all
other #ifdef OTHER_SYMBOL and all #include directives.
urs
|
by: Bogdan |
last post by:
Can anyone recommend a program for indentation of C preprocessor
directives. My file looks like this:
#ifdef a
#define b
#else
#define c
#endif
int main()
{
|
by: Sam of California |
last post by:
Is it accurate to say that "the preprocessor is just a pass in the parsing
of the source file"?
I responded to that comment by saying that the preprocessor is not just a
pass. It processes statements that the compiler does not process. The good
people in the alt.comp.lang.learn.c-c++ newsgroup insist that the
preprocessor is just one of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |