From 9e4d6df2e549c2251d2bd3a88431cec0b262fad8 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 16 Feb 2021 11:44:05 +0100 Subject: Get preprocessor output without line numbers For easier comparison of the original source with a doxygen preprocessed source the line numbers can be a bit of an obstacle. To remove the line numbers in the preprocessor output the option `NoLineno` has been added. (In case `Preprocessor` is not invoked, `NoLineno` has no effect). --- doc/preprocessing.doc | 4 ++++ src/debug.cpp | 3 ++- src/debug.h | 3 ++- src/pre.l | 5 +++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/preprocessing.doc b/doc/preprocessing.doc index 4df83ff..5a297a7 100644 --- a/doc/preprocessing.doc +++ b/doc/preprocessing.doc @@ -259,6 +259,10 @@ you can run doxygen as follows: \verbatim doxygen -d Preprocessor \endverbatim +when the line numbers are no required: +\verbatim + doxygen -d Preprocessor -d NoLineno +\endverbatim This will instruct doxygen to dump the input sources to standard output after preprocessing has been done (Hint: set QUIET = YES and WARNINGS = NO in the configuration file to disable any other diff --git a/src/debug.cpp b/src/debug.cpp index c270b47..bc5abb2 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -31,6 +31,7 @@ static std::map< std::string, Debug::DebugMask > s_labels = { "functions", Debug::Functions }, { "variables", Debug::Variables }, { "preprocessor", Debug::Preprocessor }, + { "nolineno", Debug::NoLineNo }, { "classes", Debug::Classes }, { "commentcnv", Debug::CommentCnv }, { "commentscan", Debug::CommentScan }, @@ -79,7 +80,7 @@ static int labelToEnumValue(const char *l) int Debug::setFlag(const char *lab) { int retVal = labelToEnumValue(lab); - curMask = (DebugMask)(curMask | labelToEnumValue(lab)); + curMask = (DebugMask)(curMask | retVal); return retVal; } diff --git a/src/debug.h b/src/debug.h index e71595f..5d4717a 100644 --- a/src/debug.h +++ b/src/debug.h @@ -37,7 +37,8 @@ class Debug Lex = 0x00002000, Plantuml = 0x00004000, FortranFixed2Free = 0x00008000, - Cite = 0x00010000 + Cite = 0x00010000, + NoLineNo = 0x00020000 }; static void print(DebugMask mask,int prio,const char *fmt,...); diff --git a/src/pre.l b/src/pre.l index e817a9d..21746a0 100644 --- a/src/pre.l +++ b/src/pre.l @@ -3390,11 +3390,12 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output char *newPos=output.data()+output.curPos(); Debug::print(Debug::Preprocessor,0,"Preprocessor output of %s (size: %d bytes):\n",fileName,newPos-orgPos); int line=1; - Debug::print(Debug::Preprocessor,0,"---------\n00001 "); + Debug::print(Debug::Preprocessor,0,"---------\n"); + if (!Debug::isFlagSet(Debug::NoLineNo)) Debug::print(Debug::Preprocessor,0,"00001 "); while (orgPos Date: Tue, 16 Feb 2021 19:43:55 +0100 Subject: Update preprocessing.doc --- doc/preprocessing.doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/preprocessing.doc b/doc/preprocessing.doc index 5a297a7..34aa3ed 100644 --- a/doc/preprocessing.doc +++ b/doc/preprocessing.doc @@ -259,7 +259,7 @@ you can run doxygen as follows: \verbatim doxygen -d Preprocessor \endverbatim -when the line numbers are no required: +or when the line numbers are not wanted: \verbatim doxygen -d Preprocessor -d NoLineno \endverbatim -- cgit v0.12