Skip to content

Commit 1f0746c

Browse files
committed
Merge branch 'master' of github.com:doxygen/doxygen
2 parents 5e84de6 + cd6707d commit 1f0746c

13 files changed

+270
-271
lines changed

src/clangparser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ void ClangTUParser::linkMacro(OutputCodeList &ol,const FileDef *fd,
706706
void ClangTUParser::linkIdentifier(OutputCodeList &ol,const FileDef *fd,
707707
uint32_t &line,uint32_t &column,const char *text,int tokenIndex)
708708
{
709-
AUTO_TRACE("line={} colum={} text={}",line,column,text);
709+
AUTO_TRACE("line={} column={} text={}",line,column,text);
710710
CXCursor c = p->cursors[tokenIndex];
711711
CXCursorKind cKind = clang_getCursorKind(c);
712712
AUTO_TRACE_ADD("cursor kind={}",(int)cKind);

src/commentcnv.l

+1-1
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ static bool readIncludeFile(yyscan_t yyscanner,const QCString &inc,const QCStrin
17461746
int count = incText.contains(blockId.data());
17471747
if (count!=2)
17481748
{
1749-
warn_doc_error(yyextra->fileName,yyextra->lineNr,"block marked with [{}] for \\snippet{{doc}} should appear twice in file {}, found it {:d} times, skipping",
1749+
warn_doc_error(yyextra->fileName,yyextra->lineNr,"block marked with {} for \\snippet{{doc}} should appear twice in file {}, found it {:d} times, skipping",
17501750
blockId,absFileName,count);
17511751
return false;
17521752
}

src/commentscan.l

+12
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ static inline const char *getLexerFILE() {return __FILE__;}
572572
CMD ("\\"|"@")
573573
PRE ("pre"|"PRE")
574574
TABLE ("table"|"TABLE")
575+
TABLEDEL ("table"|"tr"|"th"|"td"|"TABLE"|"TR"|"TH"|"TD")
575576
P [pP]
576577
UL ("ul"|"UL")
577578
OL ("ol"|"OL")
@@ -1213,6 +1214,17 @@ STopt [^\n@\\]*
12131214
addOutput(yyscanner,yytext);
12141215
if (*yytext == '\n') yyextra->lineNr++;
12151216
}
1217+
<Comment>"<"[/]?{TABLEDEL}">" { // In case in xrefitem type some special handling is required
1218+
if (yyextra->inContext==OutputXRef)
1219+
{
1220+
setOutput(yyscanner,OutputDoc);
1221+
addOutput(yyscanner,yytext);
1222+
}
1223+
else
1224+
{
1225+
REJECT;
1226+
}
1227+
}
12161228
<Comment>. { // catch-all for anything else
12171229
addOutput(yyscanner,*yytext);
12181230
}

src/defgen.cpp

+10-53
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,8 @@ static void generateDEFForMember(const MemberDef *md,
114114
<< md->getOutputFileBase() << "_1" << md->anchor()
115115
<< "';\n";
116116

117-
t << memPrefix << "virt = ";
118-
switch (md->virtualness())
119-
{
120-
case Specifier::Normal: t << "normal;\n"; break;
121-
case Specifier::Virtual: t << "virtual;\n"; break;
122-
case Specifier::Pure: t << "pure-virtual;\n"; break;
123-
default: ASSERT(0);
124-
}
125-
126-
t << memPrefix << "prot = ";
127-
switch(md->protection())
128-
{
129-
case Protection::Public: t << "public;\n"; break;
130-
case Protection::Protected: t << "protected;\n"; break;
131-
case Protection::Private: t << "private;\n"; break;
132-
case Protection::Package: t << "package;\n"; break;
133-
}
117+
t << memPrefix << "virt = " << to_string_lower(md->virtualness()) << ";\n";
118+
t << memPrefix << "prot = " << to_string_lower(md->protection()) << ";\n";
134119

135120
if (md->memberType()!=MemberType::Define &&
136121
md->memberType()!=MemberType::Enumeration
@@ -341,47 +326,19 @@ static void generateDEFForClass(const ClassDef *cd,TextStream &t)
341326
for (const auto &bcd : cd->baseClasses())
342327
{
343328
t << " cp-ref = {\n" << " ref-type = base;\n";
344-
t << " ref-id = '"
345-
<< bcd.classDef->getOutputFileBase() << "';\n";
346-
t << " ref-prot = ";
347-
switch (bcd.prot)
348-
{
349-
case Protection::Public: t << "public;\n"; break;
350-
case Protection::Package: // package scope is not possible
351-
case Protection::Protected: t << "protected;\n"; break;
352-
case Protection::Private: t << "private;\n"; break;
353-
}
354-
t << " ref-virt = ";
355-
switch(bcd.virt)
356-
{
357-
case Specifier::Normal: t << "non-virtual;"; break;
358-
case Specifier::Virtual: t << "virtual;"; break;
359-
case Specifier::Pure: t << "pure-virtual;"; break;
360-
}
361-
t << "\n };\n";
329+
t << " ref-id = '" << bcd.classDef->getOutputFileBase() << "';\n";
330+
t << " ref-prot = " << to_string_lower_class(bcd.prot) << ";\n";
331+
t << " ref-virt = " << to_string_lower(bcd.virt) << ";\n";
332+
t << " };\n";
362333
}
363334

364335
for (const auto &bcd : cd->subClasses())
365336
{
366337
t << " cp-ref = {\n" << " ref-type = derived;\n";
367-
t << " ref-id = '"
368-
<< bcd.classDef->getOutputFileBase() << "';\n";
369-
t << " ref-prot = ";
370-
switch (bcd.prot)
371-
{
372-
case Protection::Public: t << "public;\n"; break;
373-
case Protection::Package: // packet scope is not possible!
374-
case Protection::Protected: t << "protected;\n"; break;
375-
case Protection::Private: t << "private;\n"; break;
376-
}
377-
t << " ref-virt = ";
378-
switch (bcd.virt)
379-
{
380-
case Specifier::Normal: t << "non-virtual;"; break;
381-
case Specifier::Virtual: t << "virtual;"; break;
382-
case Specifier::Pure: t << "pure-virtual;"; break;
383-
}
384-
t << "\n };\n";
338+
t << " ref-id = '" << bcd.classDef->getOutputFileBase() << "';\n";
339+
t << " ref-prot = " << to_string_lower_class(bcd.prot) << ";\n";
340+
t << " ref-virt = " << to_string_lower(bcd.virt) << ";\n";
341+
t << " };\n";
385342
}
386343

387344
size_t numMembers = 0;

src/htmldocvisitor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ void HtmlDocVisitor::operator()(const DocImage &img)
16951695
{
16961696
src = correctURL(url,img.relPath());
16971697
}
1698-
if (typeSVG && !inlineImage)
1698+
if (typeSVG && !inlineImage && !src.startsWith("http://") && !src.startsWith("https://"))
16991699
{
17001700
m_t << "<object type=\"image/svg+xml\" data=\"" << convertToHtml(src)
17011701
<< "\"" << sizeAttribs << attrs;

src/memberdef.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -3367,8 +3367,12 @@ void MemberDefImpl::_writeGroupInclude(OutputList &ol,bool inGroup) const
33673367
bool showGroupedMembInc = Config_getBool(SHOW_GROUPED_MEMB_INC);
33683368
const FileDef *fd = getFileDef();
33693369
QCString nm;
3370-
if (fd) nm = getFileDef()->docName();
3371-
if (inGroup && fd && showGroupedMembInc && !nm.isEmpty())
3370+
if (inGroup && fd && showGroupedMembInc)
3371+
{
3372+
nm = fd->absFilePath();
3373+
nm = stripFromIncludePath(nm);
3374+
}
3375+
if (!nm.isEmpty())
33723376
{
33733377
ol.startParagraph();
33743378
ol.startTypewriter();
@@ -3533,6 +3537,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml,
35333537
ldef.stripPrefix("constexpr ");
35343538
ldef.stripPrefix("consteval ");
35353539
ldef.stripPrefix("constinit ");
3540+
ldef.stripPrefix("static ");
35363541

35373542
//----------------------------------------
35383543

src/message.cpp

+23-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <cstdlib>
1818
#include <mutex>
1919
#include <atomic>
20+
#include <unordered_set>
2021

2122
#include "config.h"
2223
#include "debug.h"
@@ -25,6 +26,7 @@
2526
#include "doxygen.h"
2627
#include "fileinfo.h"
2728
#include "dir.h"
29+
#include "md5.h"
2830

2931
// globals
3032
static QCString g_warnFormat;
@@ -37,9 +39,20 @@ static QCString g_warnlogFile;
3739
static bool g_warnlogTemp = false;
3840
static std::atomic_bool g_warnStat = false;
3941
static std::mutex g_mutex;
42+
static std::unordered_set<std::string> g_warnHash;
4043

4144
//-----------------------------------------------------------------------------------------
4245

46+
static bool checkWarnMessage(QCString result)
47+
{
48+
uint8_t md5_sig[16];
49+
char sigStr[33];
50+
MD5Buffer(result.data(),result.length(),md5_sig);
51+
MD5SigToString(md5_sig,sigStr);
52+
53+
return g_warnHash.insert(sigStr).second;
54+
}
55+
4356
static void format_warn(const QCString &file,int line,const QCString &text)
4457
{
4558
QCString fileSubst = file.isEmpty() ? "<unknown>" : file;
@@ -70,7 +83,7 @@ static void format_warn(const QCString &file,int line,const QCString &text)
7083
{
7184
std::unique_lock<std::mutex> lock(g_mutex);
7285
// print resulting message
73-
fwrite(msgText.data(),1,msgText.length(),g_warnFile);
86+
if (checkWarnMessage(msgText)) fwrite(msgText.data(),1,msgText.length(),g_warnFile);
7487
}
7588
if (g_warnBehavior == WARN_AS_ERROR_t::YES)
7689
{
@@ -150,15 +163,21 @@ void warn_(WarningType type, const QCString &file, int line, fmt::string_view fm
150163

151164
void warn_uncond_(fmt::string_view fmt, fmt::format_args args)
152165
{
153-
fmt::print(g_warnFile,"{}{}",g_warningStr,vformat(fmt,args));
166+
{
167+
std::unique_lock<std::mutex> lock(g_mutex);
168+
if (checkWarnMessage(g_errorStr+fmt::vformat(fmt,args))) fmt::print(g_warnFile,"{}{}",g_warningStr,vformat(fmt,args));
169+
}
154170
handle_warn_as_error();
155171
}
156172

157173
//-----------------------------------------------------------------------------------------
158174

159175
void err_(fmt::string_view fmt, fmt::format_args args)
160176
{
161-
fmt::print(g_warnFile,"{}{}",g_errorStr,fmt::vformat(fmt,args));
177+
{
178+
std::unique_lock<std::mutex> lock(g_mutex);
179+
if (checkWarnMessage(g_errorStr+fmt::vformat(fmt,args))) fmt::print(g_warnFile,"{}{}",g_errorStr,fmt::vformat(fmt,args));
180+
}
162181
handle_warn_as_error();
163182
}
164183

@@ -175,7 +194,7 @@ void term_(fmt::string_view fmt, fmt::format_args args)
175194
{
176195
{
177196
std::unique_lock<std::mutex> lock(g_mutex);
178-
fmt::print(g_warnFile, "{}{}", g_errorStr, fmt::vformat(fmt,args));
197+
if (checkWarnMessage(g_errorStr+fmt::vformat(fmt,args))) fmt::print(g_warnFile, "{}{}", g_errorStr, fmt::vformat(fmt,args));
179198
if (g_warnFile != stderr)
180199
{
181200
size_t l = strlen(g_errorStr);

src/message.h

+6-67
Original file line numberDiff line numberDiff line change
@@ -156,108 +156,47 @@ template<> struct fmt::formatter<QCString> : formatter<std::string>
156156
template<> struct fmt::formatter<Protection> : formatter<std::string>
157157
{
158158
auto format(Protection prot, format_context& ctx) const {
159-
std::string result="Unknown";
160-
switch (prot)
161-
{
162-
case Protection::Public: result="Public"; break;
163-
case Protection::Protected: result="Protected"; break;
164-
case Protection::Private: result="Private"; break;
165-
case Protection::Package: result="Package"; break;
166-
}
167-
return formatter<std::string>::format(result, ctx);
159+
return formatter<std::string>::format(to_string(prot), ctx);
168160
}
169161
};
170162

171163
//! adds support for formatting Specifier
172164
template<> struct fmt::formatter<Specifier> : formatter<std::string>
173165
{
174166
auto format(Specifier spec, format_context& ctx) const {
175-
std::string result="Unknown";
176-
switch (spec)
177-
{
178-
case Specifier::Normal: result="Normal"; break;
179-
case Specifier::Virtual: result="Virtual"; break;
180-
case Specifier::Pure: result="Pure"; break;
181-
}
182-
return formatter<std::string>::format(result, ctx);
167+
return formatter<std::string>::format(to_string(spec), ctx);
183168
}
184169
};
185170

186171
//! adds support for formatting MethodTypes
187172
template<> struct fmt::formatter<MethodTypes> : formatter<std::string>
188173
{
189174
auto format(MethodTypes mtype, format_context& ctx) const {
190-
std::string result="Unknown";
191-
switch (mtype)
192-
{
193-
case MethodTypes::Method: result="Method"; break;
194-
case MethodTypes::Signal: result="Signal"; break;
195-
case MethodTypes::Slot: result="Slot"; break;
196-
case MethodTypes::DCOP: result="DCOP"; break;
197-
case MethodTypes::Property: result="Property"; break;
198-
case MethodTypes::Event: result="Event"; break;
199-
}
200-
return formatter<std::string>::format(result, ctx);
175+
return formatter<std::string>::format(to_string(mtype), ctx);
201176
}
202177
};
203178

204179
//! adds support for formatting RelatesType
205180
template<> struct fmt::formatter<RelatesType> : formatter<std::string>
206181
{
207182
auto format(RelatesType type, format_context& ctx) const {
208-
std::string result="Unknown";
209-
switch (type)
210-
{
211-
case RelatesType::Simple: result="Simple"; break;
212-
case RelatesType::Duplicate: result="Duplicate"; break;
213-
case RelatesType::MemberOf: result="MemberOf"; break;
214-
}
215-
return formatter<std::string>::format(result, ctx);
183+
return formatter<std::string>::format(to_string(type), ctx);
216184
}
217185
};
218186

219187
//! adds support for formatting RelationShip
220188
template<> struct fmt::formatter<Relationship> : formatter<std::string>
221189
{
222190
auto format(Relationship relation, format_context& ctx) const {
223-
std::string result="Unknown";
224-
switch (relation)
225-
{
226-
case Relationship::Member: result="Member"; break;
227-
case Relationship::Related: result="Related"; break;
228-
case Relationship::Foreign: result="Foreign"; break;
229-
}
230-
return formatter<std::string>::format(result, ctx);
191+
return formatter<std::string>::format(to_string(relation), ctx);
231192
}
232193
};
233194

234195
//! adds support for formatting SrcLangExt
235196
template<> struct fmt::formatter<SrcLangExt> : formatter<std::string>
236197
{
237198
auto format(SrcLangExt lang, format_context& ctx) const {
238-
std::string result="Unknown";
239-
switch (lang)
240-
{
241-
case SrcLangExt::Unknown: result="Unknown"; break;
242-
case SrcLangExt::IDL: result="IDL"; break;
243-
case SrcLangExt::Java: result="Java"; break;
244-
case SrcLangExt::CSharp: result="C#"; break;
245-
case SrcLangExt::D: result="D"; break;
246-
case SrcLangExt::PHP: result="PHP"; break;
247-
case SrcLangExt::ObjC: result="Objective-C"; break;
248-
case SrcLangExt::Cpp: result="C++"; break;
249-
case SrcLangExt::JS: result="Javascript"; break;
250-
case SrcLangExt::Python: result="Python"; break;
251-
case SrcLangExt::Fortran: result="Fortran"; break;
252-
case SrcLangExt::VHDL: result="VHDL"; break;
253-
case SrcLangExt::XML: result="XML"; break;
254-
//case SrcLangExt::Tcl: result="Tcl"; break;
255-
case SrcLangExt::Markdown: result="Markdown"; break;
256-
case SrcLangExt::SQL: result="SQL"; break;
257-
case SrcLangExt::Slice: result="Slice"; break;
258-
case SrcLangExt::Lex: result="Lex"; break;
259-
}
260-
return formatter<std::string>::format(result, ctx);
199+
return formatter<std::string>::format(to_string(lang), ctx);
261200
}
262201
};
263202

src/perlmodgen.cpp

+2-15
Original file line numberDiff line numberDiff line change
@@ -1386,25 +1386,12 @@ static void addPerlModDocBlock(PerlModOutput &output,
13861386

13871387
static const char *getProtectionName(Protection prot)
13881388
{
1389-
switch (prot)
1390-
{
1391-
case Protection::Public: return "public";
1392-
case Protection::Protected: return "protected";
1393-
case Protection::Private: return "private";
1394-
case Protection::Package: return "package";
1395-
}
1396-
return nullptr;
1389+
return to_string_lower(prot);
13971390
}
13981391

13991392
static const char *getVirtualnessName(Specifier virt)
14001393
{
1401-
switch(virt)
1402-
{
1403-
case Specifier::Normal: return "non_virtual";
1404-
case Specifier::Virtual: return "virtual";
1405-
case Specifier::Pure: return "pure_virtual";
1406-
}
1407-
return nullptr;
1394+
return to_string_lower(virt);
14081395
}
14091396

14101397
static QCString pathDoxyfile;

src/pyscanner.l

+6
Original file line numberDiff line numberDiff line change
@@ -1771,13 +1771,19 @@ static void initEntry(yyscan_t yyscanner)
17711771
yyextra->current->lang = SrcLangExt::Python;
17721772
yyextra->current->type.clear();
17731773
yyextra->current->name.clear();
1774+
yyextra->current->initializer.clear();
17741775
yyextra->commentScanner.initGroupInfo(yyextra->current.get());
17751776
yyextra->isStatic = FALSE;
17761777
}
17771778

17781779
static void newEntry(yyscan_t yyscanner)
17791780
{
17801781
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1782+
if (yyextra->current->name.isEmpty())
1783+
{
1784+
initEntry(yyscanner);
1785+
return;
1786+
}
17811787
bool found = false;
17821788
if (yyextra->checkDupEntry)
17831789
{

0 commit comments

Comments
 (0)