Skip to content

Commit

Permalink
Remove redundant checks in config file
Browse files Browse the repository at this point in the history
- removing checks on type "string" as this is already handled in emptyValueToDefault
- implement emtyToDefault also for type "list" and remove now redundant updates
- remove redundant value settings in config file.
  • Loading branch information
albert-github committed Sep 14, 2021
1 parent 7664493 commit 1c85524
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 86 deletions.
2 changes: 0 additions & 2 deletions src/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ Go to the <a href="commands.html">next</a> section or return to the
started.
]]>
</docs>
<value name=''/>
</option>
<option type='list' id='STRIP_FROM_INC_PATH' format='string'>
<docs>
Expand Down Expand Up @@ -1394,7 +1393,6 @@ FILE_VERSION_FILTER = "cleartool desc -fmt \%Vn"
\note If this tag is empty the current directory is searched.
]]>
</docs>
<value name=''/>
</option>
<option type='string' id='INPUT_ENCODING' format='string' defval='UTF-8'>
<docs>
Expand Down
1 change: 1 addition & 0 deletions src/configimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class ConfigList : public ConfigOption
WidgetType widgetType() const { return m_widgetType; }
StringVector *valueRef() { return &m_value; }
StringVector getDefault() { return m_defaultValue; }
void emptyValueToDefault() { if (m_value.empty() && !m_defaultValue.empty()) m_value=m_defaultValue; };
void writeTemplate(TextStream &t,bool sl,bool);
void compareDoxyfile(TextStream &t);
void writeXMLDoxyfile(TextStream &t);
Expand Down
95 changes: 11 additions & 84 deletions src/configimpl.l
Original file line number Diff line number Diff line change
Expand Up @@ -1559,32 +1559,17 @@ void Config::checkAndCorrect(bool quiet)
//------------------------
// check WARN_FORMAT
QCString warnFormat = Config_getString(WARN_FORMAT);
if (warnFormat.stripWhiteSpace().isEmpty())
if (warnFormat.find("$file")==-1)
{
Config_updateString(WARN_FORMAT,"$file:$line $text");
warn_uncond("warning format does not contain a $file tag!\n");
}
else
if (warnFormat.find("$line")==-1)
{
if (warnFormat.find("$file")==-1)
{
warn_uncond("warning format does not contain a $file tag!\n");
}
if (warnFormat.find("$line")==-1)
{
warn_uncond("warning format does not contain a $line tag!\n");
}
if (warnFormat.find("$text")==-1)
{
warn_uncond("warning format foes not contain a $text tag!\n");
}
warn_uncond("warning format does not contain a $line tag!\n");
}

//------------------------
// set default man page extension if non is given by the user
QCString manExtension = Config_getString(MAN_EXTENSION);
if (manExtension.isEmpty())
if (warnFormat.find("$text")==-1)
{
Config_updateString(MAN_EXTENSION,".3");
warn_uncond("warning format foes not contain a $text tag!\n");
}

//------------------------
Expand All @@ -1603,17 +1588,6 @@ void Config::checkAndCorrect(bool quiet)
Config_updateEnum(PAPER_TYPE,PAPER_TYPE_t::a4);
}


//------------------------
// check & correct HTML_FILE_EXTENSION
QCString htmlFileExtension=Config_getString(HTML_FILE_EXTENSION);
htmlFileExtension=htmlFileExtension.stripWhiteSpace();
if (htmlFileExtension.isEmpty())
{
htmlFileExtension = ".html";
}
Config_updateString(HTML_FILE_EXTENSION,htmlFileExtension);

//------------------------
// check & correct STRIP_FROM_PATH
StringVector stripFromPath = Config_getList(STRIP_FROM_PATH);
Expand Down Expand Up @@ -1839,14 +1813,9 @@ void Config::checkAndCorrect(bool quiet)
if (dotFontName=="FreeSans" || dotFontName=="FreeSans.ttf")
{
warn_uncond("doxygen no longer ships with the FreeSans font.\n"
"You may want to clear or change DOT_FONTNAME.\n"
"Otherwise you run the risk that the wrong font is being used for dot generated graphs.\n");
}
else if (dotFontName.isEmpty())
{
dotFontName = "Helvetica";
" You may want to clear or change DOT_FONTNAME.\n"
" Otherwise you run the risk that the wrong font is being used for dot generated graphs.\n");
}
Config_updateString(DOT_FONTNAME,dotFontName);

//------------------------
// clip number of threads
Expand Down Expand Up @@ -1889,12 +1858,8 @@ void Config::checkAndCorrect(bool quiet)
uint i=0,l=dotPath.length();
for (i=0;i<l;i++) if (dotPath.at(i)=='/') dotPath.at(i)='\\';
#endif
Config_updateString(DOT_PATH,dotPath);
}
else // make sure the string is empty but not null!
{
dotPath="";
}
Config_updateString(DOT_PATH,dotPath);

//------------------------
// check plantuml path
Expand Down Expand Up @@ -1927,8 +1892,8 @@ void Config::checkAndCorrect(bool quiet)
qPrint(plantumlJarPath));
plantumlJarPath="";
}
Config_updateString(PLANTUML_JAR_PATH,plantumlJarPath);
}
Config_updateString(PLANTUML_JAR_PATH,plantumlJarPath);

//------------------------
// check dia path
Expand All @@ -1950,12 +1915,8 @@ void Config::checkAndCorrect(bool quiet)
for (i=0;i<l;i++) if (diaPath.at(i)=='/') diaPath.at(i)='\\';
#endif
}
Config_updateString(DIA_PATH,diaPath);
}
else // make sure the string is empty but not null!
{
diaPath="";
}
Config_updateString(DIA_PATH,diaPath);

//------------------------
// check INPUT
Expand All @@ -1978,28 +1939,6 @@ void Config::checkAndCorrect(bool quiet)
}
Config_updateList(INPUT,inputSources);

//------------------------
// add default file patterns if needed
StringVector filePatternList = Config_getList(FILE_PATTERNS);
if (filePatternList.empty())
{
ConfigOption * opt = ConfigImpl::instance()->get("FILE_PATTERNS");
if (opt->kind()==ConfigOption::O_List)
{
filePatternList = ((ConfigList*)opt)->getDefault();
}
}
Config_updateList(FILE_PATTERNS,filePatternList);

//------------------------
// add default pattern if needed
StringVector examplePatternList = Config_getList(EXAMPLE_PATTERNS);
if (examplePatternList.empty())
{
examplePatternList.push_back("*");
Config_updateList(EXAMPLE_PATTERNS,examplePatternList);
}

//------------------------
// if no output format is enabled, warn the user
if (!Config_getBool(GENERATE_HTML) &&
Expand Down Expand Up @@ -2057,18 +1996,6 @@ void Config::checkAndCorrect(bool quiet)
Config_updateInt(MAX_DOT_GRAPH_DEPTH,1000);
}

//------------------------
// add default words if needed
const StringVector &annotationFromBrief = Config_getList(ABBREVIATE_BRIEF);
if (annotationFromBrief.empty())
{
Config_updateList(ABBREVIATE_BRIEF,
{ "The $name class", "The $name widget",
"The $name file", "is", "provides", "specifies",
"contains", "represents", "a", "an", "the"
});
}

//------------------------
// some default settings for vhdl
if (Config_getBool(OPTIMIZE_OUTPUT_VHDL) &&
Expand Down

0 comments on commit 1c85524

Please sign in to comment.