Viewed 7k times. For example, I have lot's of these: test. Improve this question. Add a comment. Active Oldest Votes. This is the description of the tool from the linked site emphasis mine : The unifdef utility selectively processes conditional C preprocessor if and ifdef directives. If you check out the manual there are some exceptions listed in the BUGS section: Handling one line at a time means preprocessor directives split across more than one physical line because of comments or backslash-newline cannot be handled in every situation.
Trigraphs are not recognized. The text-mode and ignore functionality does not correspond to modern cpp 1 behaviour. Improve this answer.
Shafik Yaghmour Shafik Yaghmour k 34 34 gold badges silver badges bronze badges. See the proposed duplicate question; sunifdef Son of unifdef and coan are also options. JonathanLeffler interesting, it does not look like sunifdef is being maintained anymore but coan does look interesting.
Coan is supposed to replace sunifdef. I've used sunifdef for a number of years with no problems on some extremely contorted rats nests of ifdef code with no problems. Coan was a bit more of a work in progress, so I didn't use it — but it was several years ago that I last did any work with Coan so it has probably improved since then. Sign up or log in Sign up using Google. Sign up using Facebook. I'll be checking it out Around I wrote a tool that did exactly what you are looking for.
I never got around to distributing the tool, but the code can be found here:. It's about 1. I used unifdef years ago for just the sort of problem you describe, and it worked fine. Even if it hasn't been updated since , the syntax of preprocessor ifdefs hasn't changed materially since then, so I expect it will still do what you want.
I suppose there might be some compile problems, although the packages appear recent. If you need something similar to a preprocessor, the flexible solution is Wave from boost. As it's a library, you can hook into its input and output code. Original Question What I'd like is not a standard C pre-processor, but a variation on it which would accept from somewhere - probably the command line via -DNAME1 and -UNAME2 options - a specification of which macros are defined, and would then eliminate dead code.
This is a simple case - I'd be hoping that the code could handle more complex cases too. Then output a textual description and value for each member variable of your derived class. In the following example, the Dump function first calls the Dump function for its base class. It then writes a short description of each member variable along with the member's value to the diagnostic stream. You must supply a CDumpContext argument to specify where the dump output will go.
The debug information for a large MFC application can take up a lot of disk space. You can use one of these procedures to reduce the size:. These options build a single program database PDB file that contains debug information for the entire library, reducing redundancy and saving space.
In this case, the lack of debug information will prevent you from using most debugger facilities within the MFC library code, but because the MFC libraries are already thoroughly debugged, this may not be a problem.
Building selected modules with the MFC debug libraries enables you to use stepping and the other debug facilities in those modules. This procedure makes use of both the Debug and Release configurations of the project, thus necessitating the changes described in the following steps and also making a "rebuild all" necessary when a full Release build is required.
In the Configuration Manager dialog box , locate your project in the grid. In the Property Pages dialog box, under the Configuration Properties folder, select the General category. The current setting appears in the right column of the grid. In the left pane of the Properties Pages dialog box, open the Linker folder and select the Input Category.
In the properties grid, find Additional Dependencies. Click OK to save the new build options and close the Property Pages dialog box. From the Build menu, select Rebuild. This removes all debug information from your modules but does not affect the MFC library. Now you must add debug information back to selected modules in your application. Remember that you can set breakpoints and perform other debugger functions only in modules you have compiled with debug information.
For each project file in which you want to include debug information, carry out the following steps:. If you are using an application wizard-generated application or have precompiled headers, you have to turn off the precompiled headers or recompile them before compiling the other modules.
Otherwise, you will receive warning C and error message C From the Build menu, select Build to rebuild project files that are out of date. As an alternative to the technique described in this topic, you can use an external makefile to define individual options for each file. Debugging Native Code. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Is this page helpful? Please rate your experience Yes No. Any additional feedback?
0コメント