summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2020-10-25 17:42:43 (GMT)
committeralbert-github <albert.tests@gmail.com>2020-10-25 17:42:43 (GMT)
commitef91bacb7a69bbf7bccb4a864698cc003aabac66 (patch)
tree99eb51bdb6cb6ecfb8f6245ac0304fa35559f8c2 /src
parent49bd996c0e05df763632c346038a2346174f7382 (diff)
downloadDoxygen-ef91bacb7a69bbf7bccb4a864698cc003aabac66.zip
Doxygen-ef91bacb7a69bbf7bccb4a864698cc003aabac66.tar.gz
Doxygen-ef91bacb7a69bbf7bccb4a864698cc003aabac66.tar.bz2
Incorrect handling of string with spaces and no quotes
During some tests on the documentation of LLVM the (CMake generated) doxygen configuration file contained the line: ``` DOT_PATH=D:\Program Files (x86)\Graphviz2.38\bin\dot.exe ``` and this was interpreted by doxygen as ``` DOT_PATH = D:\ProgramFiles(x86)\Graphviz2.38\bin\dot.exe ``` without any message other than that later on the `dot` executable could not be found. It is clear that here the double quotes were missing. This problem has been solved by giving a warning and setting the value to the default value. - configimpl.l - config_doxyw.l during the checking some debug facilities for the doxywizard were required and this has been implemented: - config_doxyw.l - doxywizard.h - doxywizard.cpp it was also discovered that in case of none existing int or bool values were specified the wrong "defaults" were taken (it was set to `0` / `false`), now the correct defaults are taken - inputbool.cpp - inputint.cpp
Diffstat (limited to 'src')
-rw-r--r--src/configimpl.l101
1 files changed, 61 insertions, 40 deletions
diff --git a/src/configimpl.l b/src/configimpl.l
index ed23a12..d7fcdf1 100644
--- a/src/configimpl.l
+++ b/src/configimpl.l
@@ -512,6 +512,7 @@ static int g_inputPosition;
static int g_yyLineNr;
static QCString g_yyFileName;
static QCString g_tmpString;
+static QCString g_cmd;
static QCString *g_string=0;
static bool *g_bool=0;
static StringVector *g_list=0;
@@ -523,6 +524,7 @@ static int g_includeDepth;
static bool g_configUpdate = FALSE;
static QCString g_encoding;
static ConfigImpl *g_config;
+static int g_part;
/* -----------------------------------------------------------------
*/
@@ -686,11 +688,9 @@ static void readIncludeFile(const char *incName)
%x SkipComment
%x SkipInvalid
%x GetString
-%x GetBool
%x GetStrList
%x GetStrList1
%x GetQuotedString
-%x GetEnvVar
%x Include
%%
@@ -701,15 +701,16 @@ static void readIncludeFile(const char *incName)
BEGIN(Start);
unput(*yytext);
}
-<Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"##".*"\n" { g_config->appendUserComment(yytext);g_yyLineNr++;}
-<Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"#" { BEGIN(SkipComment); }
-<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { QCString cmd=yytext;
- cmd=cmd.left(cmd.length()-1).stripWhiteSpace();
- ConfigOption *option = g_config->get(cmd);
+<Start,GetString,GetStrList,GetStrList1,SkipInvalid>"##".*"\n" { g_config->appendUserComment(yytext);g_yyLineNr++;}
+<Start,GetString,GetStrList,GetStrList1,SkipInvalid>"#" { BEGIN(SkipComment); }
+<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { g_cmd=yytext;
+ g_cmd=g_cmd.left(g_cmd.length()-1).stripWhiteSpace();
+ g_part=0;
+ ConfigOption *option = g_config->get(g_cmd);
if (option==0) // oops not known
{
config_warn("ignoring unsupported tag '%s' at line %d, file %s\n",
- cmd.data(),g_yyLineNr,g_yyFileName.data());
+ g_cmd.data(),g_yyLineNr,g_yyFileName.data());
BEGIN(SkipInvalid);
}
else // known tag
@@ -726,7 +727,7 @@ static void readIncludeFile(const char *incName)
g_list = ((ConfigList *)option)->valueRef();
g_list->clear();
g_elemStr="";
- if (cmd == "PREDEFINED")
+ if (g_cmd == "PREDEFINED")
{
BEGIN(GetStrList1);
}
@@ -759,13 +760,13 @@ static void readIncludeFile(const char *incName)
if (g_configUpdate)
{
config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n"
- " This tag has been removed.\n", cmd.data(),g_yyLineNr,g_yyFileName.data());
+ " This tag has been removed.\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data());
}
else
{
config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n"
" To avoid this warning please remove this line from your configuration "
- "file or upgrade it using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data());
+ "file or upgrade it using \"doxygen -u\"\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data());
}
BEGIN(SkipInvalid);
break;
@@ -773,26 +774,26 @@ static void readIncludeFile(const char *incName)
if (g_configUpdate)
{
config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n"
- " This tag has been removed.\n", cmd.data(),g_yyLineNr,g_yyFileName.data());
+ " This tag has been removed.\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data());
}
else
{
config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n"
" To avoid this warning please remove this line from your configuration "
- "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data());
+ "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data());
}
BEGIN(SkipInvalid);
break;
}
}
}
-<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { QCString cmd=yytext;
- cmd=cmd.left(cmd.length()-2).stripWhiteSpace();
- ConfigOption *option = g_config->get(cmd);
+<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { g_cmd=yytext;
+ g_cmd=g_cmd.left(g_cmd.length()-2).stripWhiteSpace();
+ ConfigOption *option = g_config->get(g_cmd);
if (option==0) // oops not known
{
config_warn("ignoring unsupported tag '%s' at line %d, file %s\n",
- cmd.data(),g_yyLineNr,g_yyFileName.data());
+ g_cmd.data(),g_yyLineNr,g_yyFileName.data());
BEGIN(SkipInvalid);
}
else // known tag
@@ -807,7 +808,7 @@ static void readIncludeFile(const char *incName)
case ConfigOption::O_List:
g_list = ((ConfigList *)option)->valueRef();
g_elemStr="";
- if (cmd == "PREDEFINED")
+ if (g_cmd == "PREDEFINED")
{
BEGIN(GetStrList1);
}
@@ -827,13 +828,13 @@ static void readIncludeFile(const char *incName)
case ConfigOption::O_Obsolete:
config_warn("Tag '%s' at line %d of file %s has become obsolete.\n"
"To avoid this warning please update your configuration "
- "file using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data());
+ "file using \"doxygen -u\"\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data());
BEGIN(SkipInvalid);
break;
case ConfigOption::O_Disabled:
config_warn("Tag '%s' at line %d of file %s belongs to an option that was not enabled at compile time.\n"
"To avoid this warning please remove this line from your configuration "
- "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data());
+ "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data());
BEGIN(SkipInvalid);
break;
}
@@ -869,7 +870,7 @@ static void readIncludeFile(const char *incName)
}
<Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,g_yyLineNr,g_yyFileName.data()); }
-<GetString,GetBool,SkipInvalid>\n { g_yyLineNr++; BEGIN(Start); }
+<GetString,SkipInvalid>\n { g_yyLineNr++; BEGIN(Start); }
<GetStrList,GetStrList1>\n {
g_yyLineNr++;
if (!g_elemStr.isEmpty())
@@ -895,8 +896,26 @@ static void readIncludeFile(const char *incName)
}
g_elemStr.resize(0);
}
-<GetString>[^ \"\t\r\n]+ { (*g_string)+=configStringRecode(yytext,g_encoding,"UTF-8");
- checkEncoding();
+<GetString>[^ \"\t\r\n]+ {
+ // for each command we only want 1 warning
+ if (g_part==1)
+ {
+ config_warn("Invalid value for '%s' tag in line %d, file %s\n"
+ "Value should not contain unquoted whitespace, "
+ "using the default.\n",
+ g_cmd.data(),g_yyLineNr,g_yyFileName.data());
+ (*g_string)="";
+ }
+ else if (g_part > 1)
+ {
+ (*g_string)="";
+ }
+ else
+ {
+ (*g_string)+=configStringRecode(yytext,g_encoding,"UTF-8");
+ checkEncoding();
+ }
+ g_part++;
}
<GetString,GetStrList,GetStrList1,SkipInvalid>"\"" { g_lastState=YY_START;
BEGIN(GetQuotedString);
@@ -908,8 +927,25 @@ static void readIncludeFile(const char *incName)
//printf("Quoted String = '%s'\n",g_tmpString.data());
if (g_lastState==GetString)
{
- (*g_string)+=configStringRecode(g_tmpString,g_encoding,"UTF-8");
- checkEncoding();
+ // for each command we only want 1 warning
+ if (g_part==1)
+ {
+ config_warn("Invalid value for '%s' tag in line %d, file %s\n"
+ "Value should not contain unquoted whitespace, "
+ "using the default.\n",
+ g_cmd.data(),g_yyLineNr,g_yyFileName.data());
+ (*g_string)="";
+ }
+ else if (g_part > 1)
+ {
+ (*g_string)="";
+ }
+ else
+ {
+ (*g_string)+=configStringRecode(g_tmpString,g_encoding,"UTF-8");
+ checkEncoding();
+ }
+ g_part++;
}
else
{
@@ -926,21 +962,6 @@ static void readIncludeFile(const char *incName)
g_tmpString+='"';
}
<GetQuotedString>. { g_tmpString+=*yytext; }
-<GetBool>[a-zA-Z]+ {
- QCString bs=yytext;
- bs=bs.upper();
- if (bs=="YES" || bs=="1")
- *g_bool=TRUE;
- else if (bs=="NO" || bs=="0")
- *g_bool=FALSE;
- else
- {
- *g_bool=FALSE;
- config_warn("Invalid value '%s' for "
- "boolean tag in line %d, file %s; use YES or NO\n",
- bs.data(),g_yyLineNr,g_yyFileName.data());
- }
- }
<GetStrList1>[^ \#\"\t\r\n]+ {
g_elemStr+=configStringRecode(yytext,g_encoding,"UTF-8");
}