Skip to content

Commit ba083a9

Browse files
committed
Add WARN_LAYOUT_FILE option to toggle warnings in layout file
Also update the documentation regarding new layout behavior when information is missing.
1 parent 880c498 commit ba083a9

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

doc/customize.dox

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,11 @@ this attribute can be used anyway (the default is `visible="yes"`).
420420
Some elements have a \c title attribute. This attribute can be used
421421
to customize the title Doxygen will use as a header for the piece.
422422

423+
Note that as of doxygen version 1.13.1 and layout version 2.0, Doxygen
424+
will insert defaults for elements that are missing in
425+
the user defined layout file. This allows for the introduction of new elements, without having
426+
to update the user defined layout files to make them appear.
427+
For older Doxygen or layout versions, missing elements are treated as being invisible.
423428

424429
\section xmlgenerator Using the XML output
425430

src/config.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,16 @@ PATH=/Library/TeX/texbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
14581458
If set to \c NO, Doxygen will accept undocumented enumeration values.
14591459
If \ref cfg_extract_all "EXTRACT_ALL" is set to \c YES then this flag will
14601460
automatically be disabled.
1461+
]]>
1462+
</docs>
1463+
</option>
1464+
<option type='bool' id='WARN_LAYOUT_FILE' defval='1'>
1465+
<docs>
1466+
<![CDATA[
1467+
If \c WARN_LAYOUT_FILE option is set to \c YES, Doxygen will warn
1468+
about issues found while parsing the user defined layout file, such as missing
1469+
or wrong elements. See also \ref cfg_layout_file "LAYOUT_FILE" for details.
1470+
If set to \c NO, problems with the layout file will be suppressed.
14611471
]]>
14621472
</docs>
14631473
</option>

src/layout.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class LayoutParser
203203
}
204204
void error( const std::string &fileName,int lineNr,const std::string &msg)
205205
{
206-
warn(fileName.c_str(),lineNr,"%s",msg.c_str());
206+
warn_layout_(fileName.c_str(),lineNr,"%s",msg.c_str());
207207
}
208208
void startElement( const std::string &name, const XMLHandlers::Attributes& attrib );
209209
void endElement( const std::string &name );
@@ -559,11 +559,11 @@ class LayoutParser
559559
std::string fileName = m_locator->fileName();
560560
if (type.isEmpty())
561561
{
562-
warn(fileName.c_str(),m_locator->lineNr(),"an entry tag within a navindex has no type attribute! Check your layout file!");
562+
warn_layout_(fileName.c_str(),m_locator->lineNr(),"an entry tag within a navindex has no type attribute! Check your layout file!");
563563
}
564564
else
565565
{
566-
warn(fileName.c_str(),m_locator->lineNr(),"the type '%s' is not supported for the entry tag within a navindex! Check your layout file!",qPrint(type));
566+
warn_layout_(fileName.c_str(),m_locator->lineNr(),"the type '%s' is not supported for the entry tag within a navindex! Check your layout file!",qPrint(type));
567567
}
568568
m_invalidEntry=TRUE;
569569
return;
@@ -1365,7 +1365,7 @@ void LayoutParser::startElement( const std::string &name, const XMLHandlers::Att
13651365
else
13661366
{
13671367
std::string fileName = m_locator->fileName();
1368-
warn(fileName.c_str(),m_locator->lineNr(),"Unexpected start tag '%s' found in scope='%s'!",
1368+
warn_layout_(fileName.c_str(),m_locator->lineNr(),"Unexpected start tag '%s' found in scope='%s'!",
13691369
qPrint(name),qPrint(m_scope));
13701370
}
13711371
}
@@ -1711,7 +1711,7 @@ static void mergeDocEntryLists(const QCString &fileName,LayoutDocEntryList &targ
17111711
{
17121712
// for efficiency we move the elements from the source list to the target list, thus modifying the source list!
17131713
//printf("--> insert at %zu before %s\n",*it,qPrint(*it<targetList.size()?targetList[*it]->id():"none"));
1714-
warn(fileName,1,"User defined layout misses entry '%s'. Using default value.",qPrint(id));
1714+
warn_layout_(fileName,1,"User defined layout misses entry '%s'. Using default value.",qPrint(id));
17151715
targetList.insert(targetList.begin()+*it, std::move(sourceList[idx]));
17161716
}
17171717
}

src/message.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ void warn_doc_error_(const QCString &file,int line,const char *fmt, ...)
251251
va_end(args);
252252
}
253253

254+
void warn_layout_(const QCString &file,int line,const char *fmt, ...)
255+
{
256+
va_list args;
257+
va_start(args, fmt);
258+
do_warn(Config_getBool(WARN_LAYOUT_FILE), file, line, g_warningStr, fmt, args);
259+
va_end(args);
260+
}
261+
254262
void warn_uncond_(const char *fmt, ...)
255263
{
256264
va_list args;

src/message.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern void va_warn(const QCString &file, int line, const char* fmt, va_list arg
3232
extern void warn_undoc_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4);
3333
extern void warn_incomplete_doc_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4);
3434
extern void warn_doc_error_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4);
35+
extern void warn_layout_(const QCString &file, int line, const char *fmt, ...) PRINTFLIKE(3, 4);
3536
extern void warn_uncond_(const char *fmt, ...) PRINTFLIKE(1, 2);
3637
extern void err_(const char *fmt, ...) PRINTFLIKE(1, 2);
3738
extern void err_full_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4);

0 commit comments

Comments
 (0)