Skip to content

swebb2066/cpp-resolve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This command line program can modify a source code tree of C/C++ files deleting all but one branch of conditionally compiled preprocessor directives.

Only those conditional compilation expressions in which all identifiers are resolved are modified.

For example, cpp_resolve -d LOG4CXX_ABI_VERSION=16 src may result in the following diff report leaving a single line of code in place of the preprocessor code block:

@@ -255,11 +234,7 @@ class LOG4CXX_EXPORT Hierarchy : public spi::LoggerRepository
                @param ifNotUsed If true and use_count() indicates there are other references, do not remove the Logger and return false.
                @returns true if \c name Logger was removed from the hierarchy.
                */
-#if LOG4CXX_ABI_VERSION <= 15
-               bool removeLogger(const LogString& name, bool ifNotUsed = true);
-#else
                bool removeLogger(const LogString& name, bool ifNotUsed = true) override;
-#endif

        private:

Synopsis

cpp_resolve {options} {file_or_directory_list}

Option Description
-h [ --help ] output a usage synopsis
-q [ --quiet ] do not print file names
-s [ --substitute ] arg add arg to the list of identifier substitions
-d [ --define ] arg add arg to the list of macro definitions
-c [ --count ] do not apply changes, list the number of lines to be removed from each file
-e [ --ext ] arg add arg to the list of checked file extensions

Use a string of the form identifier=newIdentifier for the --substitute arg.

Use a string of the form macroName=intValue for the --define arg.

The default list of checked file extensions is [.cpp, .cxx, .hpp, .h].

About

Modify C/C++ source files given the value of macros used in preprocessor conditional section expressions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors