Doxygen
Loading...
Searching...
No Matches
message.h File Reference
#include <cstdarg>
#include "qcstring.h"
#include "util.h"
+ Include dependency graph for message.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PRINTFLIKE(FORMAT, PARAM)
 
#define msg_no_newline_allowed(x)
 
#define msg_newline_required(x)
 
#define warn(file, line, fmt, ...)
 
#define warn_undoc(file, line, fmt, ...)
 
#define warn_incomplete_doc(file, line, fmt, ...)
 
#define warn_doc_error(file, line, fmt, ...)
 
#define warn_uncond(fmt, ...)
 
#define err(fmt, ...)
 
#define err_full(file, line, fmt, ...)
 
#define term(fmt, ...)
 

Functions

void msg (const char *fmt,...) PRINTFLIKE(1
 
void void warn_ (const QCString &file, int line, const char *fmt,...) PRINTFLIKE(3
 
void void void va_warn (const QCString &file, int line, const char *fmt, va_list args)
 
void warn_undoc_ (const QCString &file, int line, const char *fmt,...) PRINTFLIKE(3
 
void void warn_incomplete_doc_ (const QCString &file, int line, const char *fmt,...) PRINTFLIKE(3
 
void void void warn_doc_error_ (const QCString &file, int line, const char *fmt,...) PRINTFLIKE(3
 
void void void void warn_uncond_ (const char *fmt,...) PRINTFLIKE(1
 
void void void void void err_ (const char *fmt,...) PRINTFLIKE(1
 
void void void void void void err_full_ (const QCString &file, int line, const char *fmt,...) PRINTFLIKE(3
 
void void void void void void void term_ (const char *fmt,...) PRINTFLIKE(1
 
void void void void void void void QCString warn_line (const QCString &file, int line)
 
void initWarningFormat ()
 
void warn_flush ()
 
void finishWarnExit ()
 
template<std::size_t N>
constexpr bool has_newline_at_end (const char(&str)[N])
 

Macro Definition Documentation

◆ err

#define err ( fmt,
... )
Value:
do { \
msg_newline_required(fmt); \
err_(fmt,##__VA_ARGS__); \
} while(0)

Definition at line 84 of file message.h.

84#define err(fmt,...) do { \
85 msg_newline_required(fmt); \
86 err_(fmt,##__VA_ARGS__); \
87 } while(0)

Referenced by MemberDefImpl::_writeReimplements(), FileDefImpl::acquireFileVersion(), DefinitionImpl::addInnerCompound(), addValidAliasToMap(), adjustBoolSetting(), adjustColorStyleSetting(), adjustConfiguration(), adjustStringSetting(), RTFGenerator::beginRTFDocument(), bindIntParameter(), bindTextParameter(), Config::checkAndCorrect(), checkFileName(), checkList(), checkPngResult(), classInheritedProtectionLevel(), convertMapFile(), DotFilePatcher::convertMapFile(), copyExtraFiles(), copyFile(), copyIcon(), copyLatexStyleSheet(), copyLogo(), ResourceMgr::copyResourceAs(), copyStyleSheet(), MemberList::countDecMembers(), createCroppedEPS(), createCroppedPDF(), createDVIFile(), createEPSbboxFile(), PerlModGenerator::createOutputDir(), PerlModGenerator::createOutputFile(), createPNG(), createPostscriptFile(), HtmlHelp::Private::createProjectFile(), DotManager::createRunner(), FlowChart::createSVG(), createSVGFromPDF(), createSVGFromPDFviaInkscape(), RTFGenerator::decIndentLevel(), NamespaceLinkedRefMap::declVisible(), elemIsVisible(), Htags::execute(), extractBoundingBox(), fileToString(), DocParser::findAndCopyImage(), FlowChart::findLabel(), finishWarnExit(), generateDEF(), generateFormula(), generateOutput(), CitationManager::generatePage(), generateSqlite3(), generateXML(), generateXMLForClass(), generateXMLForConcept(), generateXMLForDir(), generateXMLForFile(), generateXMLForGroup(), generateXMLForModule(), generateXMLForNamespace(), generateXMLForPage(), FilterCache::getFileContentsPipe(), DocPara::handleShowDate(), hasNonReferenceNestedGroupRec(), hasNonReferenceNestedNamespaceRec(), hasNonReferenceSuperClassRec(), LatexDocVisitor::incIndentLevel(), RTFDocVisitor::incIndentLevel(), RTFGenerator::incIndentLevel(), RTFGenerator::init(), initializeTables(), initializeViews(), initWarningFormat(), CitationManager::insertCrossReferencesForBibFile(), FileDefImpl::insertMember(), GroupDefImpl::insertMember(), NamespaceDefImpl::insertMember(), ClassDefImpl::internalInsertMember(), ClassDefImpl::isBaseClass(), ClassDefImpl::isSubClass(), VhdlDocGen::isSubClass(), loadExtensions(), Htags::loadFilemap(), loadStylesheet(), openDbConnection(), DocbookDocVisitor::operator()(), DocbookDocVisitor::operator()(), HtmlDocVisitor::operator()(), HtmlDocVisitor::operator()(), LatexDocVisitor::operator()(), LatexDocVisitor::operator()(), PerlModDocVisitor::operator()(), PerlModDocVisitor::operator()(), PerlModDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), TextDocVisitor::operator()(), XmlDocVisitor::operator()(), DotGraph::prepareDotFile(), prepareStatement(), preProcessFile(), RTFGenerator::preProcessFileInplace(), DotRunner::readBoundingBox(), readCodeFragment(), readConfiguration(), readInputFile(), readTagFile(), readTextFileByName(), FileDefImpl::removeMember(), GroupDefImpl::removeMember(), resetPDFSize(), DotFilePatcher::run(), runHtmlHelpCompiler(), runQHelpGenerator(), StyleData::setStyle(), showDate(), SysTimeKeeper::stop(), testRTFOutput(), updateEPSBoundingBox(), updateLanguageMapping(), SearchIndexExternal::write(), ResourceMgr::writeCategory(), writeCombineScript(), MemberDefImpl::writeDeclaration(), writeDefaultLayoutFile(), FileDefImpl::writeDetailedDescription(), writeDiaGraphFromFile(), ConceptDefImpl::writeDocumentation(), DirDefImpl::writeDocumentation(), FileDefImpl::writeDocumentation(), GroupDefImpl::writeDocumentation(), MemberList::writeDocumentation(), ModuleDefImpl::writeDocumentation(), NamespaceDefImpl::writeDocumentation(), ClassDefImpl::writeDocumentationContents(), HtmlGenerator::writeExternalSearchPage(), ClassDiagram::writeFigure(), FlowChart::writeFlowChart(), writeJavasScriptSearchDataPage(), MemberList::writePlainDeclarations(), HtmlGenerator::writeSearchPage(), DefinitionImpl::writeSourceDef(), HtmlGenerator::writeStyleInfo(), and writeTagFile().

◆ err_full

#define err_full ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
err_full_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
} while(0)
QCString removeLongPathMarker(QCString path)
Definition util.cpp:298

Definition at line 89 of file message.h.

89#define err_full(file,line,fmt,...) do { \
90 msg_no_newline_allowed(fmt); \
91 err_full_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
92 } while(0)

Referenced by NamespaceDefImpl::compoundTypeString(), do_mscgen_generate(), DotRunner::run(), runPlantumlContent(), writeDiaGraphFromFile(), and writeMscGraphFromFile().

◆ msg_newline_required

#define msg_newline_required ( x)
Value:
static_assert(has_newline_at_end(x),"text: \"" x "\" should have \\n at end");
constexpr bool has_newline_at_end(const char(&str)[N])
Definition message.h:48

Definition at line 56 of file message.h.

56#define msg_newline_required(x) \
57 static_assert(has_newline_at_end(x),"text: \"" x "\" should have \\n at end");

◆ msg_no_newline_allowed

#define msg_no_newline_allowed ( x)
Value:
static_assert(!has_newline_at_end(x),"text: \"" x "\" should not have \\n at end");

Definition at line 53 of file message.h.

53#define msg_no_newline_allowed(x) \
54 static_assert(!has_newline_at_end(x),"text: \"" x "\" should not have \\n at end");

◆ PRINTFLIKE

#define PRINTFLIKE ( FORMAT,
PARAM )

◆ term

◆ warn

#define warn ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
} while(0)

Definition at line 59 of file message.h.

59#define warn(file,line,fmt,...) do { \
60 msg_no_newline_allowed(fmt); \
61 warn_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
62 } while(0)

Referenced by addAnchor(), addClassToGroups(), addConceptToGroups(), addDirToGroups(), ModuleManager::addDocs(), addExampleToGroups(), addGroupToGroups(), addIncludeFile(), addMemberDocs(), addMemberFunction(), addMemberToGroups(), addModuleToGroups(), addNamespaceToGroups(), addRelatedPage(), addSection(), addXRefItem(), buildExampleList(), buildFileList(), buildGroupListFiltered(), checkBlocks(), checkFormula(), DocGroup::close(), convertCppComments(), decrLevel(), endCondSection(), endCondSection(), DocGroup::enterCompound(), LayoutParser::error(), Markdown::Private::extractTitleId(), findClassRelation(), findDefineDocumentation(), findDirDocumentation(), findEnumDocumentation(), findGlobalMember(), findMainPage(), findMember(), getConvertLatexMacro(), MemberDefImpl::getOutputFileBase(), DocPara::handleCommand(), DocPara::handleDoxyConfig(), handleElse(), handleElseIf(), handleEndIf(), handleEndParBlock(), handleExample(), handleFileInfoResult(), handleInheritanceGraph(), handleMemberOf(), vhdl::parser::VhdlErrorHandler::handleOtherError(), handleParBlock(), vhdl::parser::VhdlErrorHandler::handleParseError(), handleRelated(), handleRelatedAlso(), handleSubpage(), handleToc(), vhdl::parser::VhdlErrorHandler::handleUnexpectedToken(), CitationManager::insertCrossReferencesForBibFile(), ClassDefImpl::internalInsertMember(), DocGroup::leaveFile(), vhdl::parser::VhdlTokenManagerErrorHandler::lexicalError(), vhdl::parser::VhdlTokenManagerErrorHandler::lexicalError(), loadExtensions(), loadStylesheet(), otherCaseDone(), CondParser::parse(), CommentScanner::parseCommentBlock(), parseIncludeOptions(), parseMain(), parsePrototype(), parsePrototype(), pop_state(), pop_state(), pop_state(), Preprocessor::processFile(), processSection(), readIncludeFile(), resolveClassNestingRelations(), LayoutParser::startElement(), LayoutParser::startNavEntry(), subrHandleCommentBlock(), tryAddEnumDocsToGroupMember(), MemberDefImpl::virtualness(), MemberDefImpl::warnIfUndocumented(), writeDirTreeNode(), writeExceptionListImpl(), and writeGroupTreeNode().

◆ warn_doc_error

#define warn_doc_error ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_doc_error_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
} while(0)

Definition at line 74 of file message.h.

74#define warn_doc_error(file,line,fmt,...) do { \
75 msg_no_newline_allowed(fmt); \
76 warn_doc_error_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
77 } while(0)

Referenced by DocParser::checkArgumentName(), DocParser::checkRetvalName(), DocParser::checkUnOrMultipleDocumentedParams(), DocParser::defaultHandleToken(), DocAnchor::DocAnchor(), DocCite::DocCite(), DocEmoji::DocEmoji(), DocFormula::DocFormula(), DocHtmlCaption::DocHtmlCaption(), DocRef::DocRef(), DocParser::errorHandleDefaultToken(), DocParser::findAndCopyImage(), DocParser::handleAHref(), DocParser::handleAnchor(), DocPara::handleCite(), DocPara::handleCommand(), DocPara::handleDoxyConfig(), DocPara::handleEmoji(), DocPara::handleFile(), DocPara::handleHtmlEndTag(), DocPara::handleHtmlStartTag(), DocPara::handleIFile(), DocPara::handleILine(), DocParser::handleImage(), DocParser::handleImg(), DocPara::handleInclude(), DocPara::handleIncludeOperator(), DocParser::handleInternalRef(), DocPara::handleLink(), DocParser::handleLinkedWord(), DocParser::handlePrefix(), DocPara::handleRef(), DocPara::handleSection(), DocPara::handleShowDate(), DocPara::handleStartCode(), DocParser::handleStyleArgument(), DocParser::handleStyleLeave(), DocParser::handleUnclosedStyleCommands(), DocDiaFile::parse(), DocDotFile::parse(), DocHRef::parse(), DocHtmlBlockQuote::parse(), DocHtmlCaption::parse(), DocHtmlDescList::parse(), DocHtmlDescTitle::parse(), DocHtmlDetails::parse(), DocHtmlHeader::parse(), DocHtmlList::parse(), DocHtmlRow::parse(), DocHtmlSummary::parse(), DocHtmlTable::parse(), DocInclude::parse(), DocIncOperator::parse(), DocIndexEntry::parse(), DocInternal::parse(), DocLink::parse(), DocMscFile::parse(), DocPara::parse(), DocParamList::parse(), DocPlantUmlFile::parse(), DocRef::parse(), DocRoot::parse(), DocSecRefItem::parse(), DocSecRefList::parse(), DocSection::parse(), DocText::parse(), DocHtmlList::parseXml(), DocHtmlRow::parseXml(), DocParamList::parseXml(), DocParser::processCopyDoc(), readIncludeFile(), DocParser::readTextFileByName(), and MemberDefImpl::warnIfUndocumentedParams().

◆ warn_incomplete_doc

#define warn_incomplete_doc ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_incomplete_doc_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
} while(0)

Definition at line 69 of file message.h.

69#define warn_incomplete_doc(file,line,fmt,...) do { \
70 msg_no_newline_allowed(fmt); \
71 warn_incomplete_doc_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
72 } while(0)

Referenced by DocParser::checkUnOrMultipleDocumentedParams().

◆ warn_uncond

◆ warn_undoc

#define warn_undoc ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_undoc_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
} while(0)

Definition at line 64 of file message.h.

64#define warn_undoc(file,line,fmt,...) do { \
65 msg_no_newline_allowed(fmt); \
66 warn_undoc_(removeLongPathMarker(file),line,fmt,##__VA_ARGS__); \
67 } while(0)

Referenced by computeClassRelations(), findMember(), MemberDefImpl::warnIfUndocumented(), and warnUndocumentedNamespaces().

Function Documentation

◆ err_()

void void void void void err_ ( const char * fmt,
... )
extern

References err_(), and PRINTFLIKE.

◆ err_full_()

void void void void void void err_full_ ( const QCString & file,
int line,
const char * fmt,
... )
extern

References err_full_(), and PRINTFLIKE.

◆ finishWarnExit()

void finishWarnExit ( )
extern

Definition at line 310 of file message.cpp.

311{
312 fflush(stdout);
313 if (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-")
314 {
316 g_warnFile = nullptr;
317 }
318 if (g_warnStat && g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-")
319 {
320
321 std::ifstream warnFile = Portable::openInputStream(g_warnlogFile);
322 if (!warnFile.is_open())
323 {
324 g_warnFile = stderr;
325 err("Cannot open warnings file '%s' for reading\n",g_warnlogFile.data());
326 }
327 else
328 {
329 std::string line;
330 while (getline(warnFile,line))
331 {
332 fprintf(stderr,"%s\n",line.c_str());
333 }
334 warnFile.close();
335 }
336 }
337
339
340 if (g_warnStat && (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS ||
341 g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT))
342 {
343 exit(1);
344 }
345}
static bool g_warnlogTemp
Definition message.cpp:37
static std::atomic_bool g_warnStat
Definition message.cpp:38
static WARN_AS_ERROR_t g_warnBehavior
Definition message.cpp:35
static FILE * g_warnFile
Definition message.cpp:34
static QCString g_warnlogFile
Definition message.cpp:36
#define err(fmt,...)
Definition message.h:84
std::ifstream openInputStream(const QCString &name, bool binary=false, bool openAtEnd=false)
Definition portable.cpp:676
void unlink(const QCString &fileName)
Definition portable.cpp:561
int fclose(FILE *f)
Definition portable.cpp:386

References err, Portable::fclose(), g_warnBehavior, g_warnFile, g_warnlogFile, g_warnlogTemp, g_warnStat, Portable::openInputStream(), and Portable::unlink().

Referenced by generateOutput(), and term_().

◆ has_newline_at_end()

template<std::size_t N>
bool has_newline_at_end ( const char(&) str[N])
constexpr

Definition at line 48 of file message.h.

49{
50 return str[N-2]=='\n';
51}

◆ initWarningFormat()

void initWarningFormat ( )

Definition at line 41 of file message.cpp.

42{
43 g_warnFormat = Config_getString(WARN_FORMAT);
44 g_warnLineFormat = Config_getString(WARN_LINE_FORMAT);
45 g_warnBehavior = Config_getEnum(WARN_AS_ERROR);
46 g_warnlogFile = Config_getString(WARN_LOGFILE);
47 if (g_warnlogFile.isEmpty() && g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT)
48 {
49 uint32_t pid = Portable::pid();
50 g_warnlogFile.sprintf("doxygen_warnings_temp_%d.tmp",pid);
51 g_warnlogTemp = true;
52 }
53
54 if (!g_warnlogFile.isEmpty())
55 {
56 if (g_warnlogFile == "-")
57 {
58 g_warnFile = stdout;
59 }
60 else
61 {
62 FileInfo fi(g_warnlogFile.str());
63 Dir d(fi.dirPath().c_str());
64 if (!d.exists() && !d.mkdir(fi.dirPath().c_str()))
65 {
66 // point it to something valid, because warn() relies on it
67 g_warnFile = stderr;
68 err("Cannot create directory for '%s', redirecting 'WARN_LOGFILE' output to 'stderr'\n",g_warnlogFile.data());
69 }
70 else if (!(g_warnFile = Portable::fopen(g_warnlogFile,"w")))
71 {
72 // point it to something valid, because warn() relies on it
73 g_warnFile = stderr;
74 err("Cannot open '%s' for writing, redirecting 'WARN_LOGFILE' output to 'stderr'\n",g_warnlogFile.data());
75 }
76 }
77 }
78 else
79 {
80 g_warnFile = stderr;
81 }
82 if (g_warnBehavior != WARN_AS_ERROR_t::NO)
83 {
85 }
86
87 // make sure the g_warnFile is closed in case we call exit and it is still open
88 std::atexit([](){
89 if (g_warnFile && g_warnFile!=stderr && g_warnFile!=stdout)
90 {
92 g_warnFile = nullptr;
93 }
94 });
95}
Class representing a directory in the file system.
Definition dir.h:75
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
#define Config_getString(name)
Definition config.h:32
#define Config_getEnum(name)
Definition config.h:35
static QCString g_warnLineFormat
Definition message.cpp:31
static const char * g_errorStr
Definition message.cpp:33
static const char * g_warningStr
Definition message.cpp:32
static QCString g_warnFormat
Definition message.cpp:30
FILE * fopen(const QCString &fileName, const QCString &mode)
Definition portable.cpp:366
uint32_t pid()
Definition portable.cpp:265

References Config_getEnum, Config_getString, FileInfo::dirPath(), err, Dir::exists(), Portable::fclose(), Portable::fopen(), g_errorStr, g_warnBehavior, g_warnFile, g_warnFormat, g_warningStr, g_warnLineFormat, g_warnlogFile, g_warnlogTemp, Dir::mkdir(), and Portable::pid().

Referenced by checkConfiguration(), and term_().

◆ msg()

void msg ( const char * fmt,
... )
extern

References PRINTFLIKE.

◆ term_()

void void void void void void void term_ ( const char * fmt,
... )
extern

◆ va_warn()

void void void va_warn ( const QCString & file,
int line,
const char * fmt,
va_list args )
extern

Definition at line 225 of file message.cpp.

226{
227 do_warn(Config_getBool(WARNINGS), file, line, g_warningStr, fmt, args);
228}
#define Config_getBool(name)
Definition config.h:33
static void do_warn(bool enabled, const QCString &file, int line, const char *prefix, const char *fmt, va_list args)
Definition message.cpp:176
Definition trace.h:153

References Config_getBool, do_warn(), and g_warningStr.

Referenced by warn_().

◆ warn_()

void void warn_ ( const QCString & file,
int line,
const char * fmt,
... )
extern

References PRINTFLIKE, va_warn(), and warn_().

◆ warn_doc_error_()

void void void warn_doc_error_ ( const QCString & file,
int line,
const char * fmt,
... )
extern

References PRINTFLIKE, and warn_doc_error_().

◆ warn_flush()

void warn_flush ( )

Definition at line 303 of file message.cpp.

304{
305 fflush(g_warnFile);
306}

References g_warnFile.

Referenced by Statistics::end(), and term_().

◆ warn_incomplete_doc_()

void void warn_incomplete_doc_ ( const QCString & file,
int line,
const char * fmt,
... )
extern

◆ warn_line()

void void void void void void void QCString warn_line ( const QCString & file,
int line )
extern

Definition at line 205 of file message.cpp.

206{
207 QCString fileSubst = file.isEmpty() ? "<unknown>" : file;
208 QCString lineSubst; lineSubst.setNum(line);
209 return substitute(
212 "$file",fileSubst
213 ),
214 "$line",lineSubst
215 );
216}
This is an alternative implementation of QCString.
Definition qcstring.h:101
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString & setNum(short n)
Definition qcstring.h:444
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477

References g_warnLineFormat, QCString::isEmpty(), QCString::setNum(), and substitute().

Referenced by addMemberFunction(), checkPageRelations(), computePageRelations(), findGlobalMember(), and term_().

◆ warn_uncond_()

void void void void warn_uncond_ ( const char * fmt,
... )
extern

References PRINTFLIKE, and warn_uncond_().

◆ warn_undoc_()

void warn_undoc_ ( const QCString & file,
int line,
const char * fmt,
... )
extern

References PRINTFLIKE, and warn_undoc_().