Doxygen
Loading...
Searching...
No Matches
message.h File Reference
#include <fmt/core.h>
#include <fmt/compile.h>
#include "types.h"
#include "qcstring.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.

Classes

struct  fmt::formatter< T >
 
struct  fmt::formatter< QCString >
 adds support for formatting QCString More...
 
struct  fmt::formatter< Protection >
 adds support for formatting Protected More...
 
struct  fmt::formatter< Specifier >
 adds support for formatting Specifier More...
 
struct  fmt::formatter< MethodTypes >
 adds support for formatting MethodTypes More...
 
struct  fmt::formatter< RelatesType >
 adds support for formatting RelatesType More...
 
struct  fmt::formatter< Relationship >
 adds support for formatting RelationShip More...
 
struct  fmt::formatter< SrcLangExt >
 adds support for formatting SrcLangExt More...
 
struct  fmt::formatter< MemberType >
 adds support for formatting MemberType More...
 
struct  fmt::formatter< TypeSpecifier >
 adds support for formatting TypeSpecifier More...
 
struct  fmt::formatter< EntryType >
 adds support for formatting EntryType More...
 
struct  fmt::formatter< MemberListType >
 adds support for formatting MemberListType More...
 

Namespaces

namespace  fmt
 

Macros

#define msg_no_newline_allowed(x)
 
#define msg_newline_required(x)
 
#define msg(fmt, ...)
 
#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_layout(file, line, fmt, ...)
 
#define warn_uncond(fmt, ...)
 
#define err(fmt, ...)
 
#define err_full(file, line, fmt, ...)
 
#define term(fmt, ...)
 

Enumerations

enum class  WarningType {
  Generic , Undocumented , IncompleteDoc , DocError ,
  Layout
}
 

Functions

void msg_ (fmt::string_view fmt, fmt::format_args args)
 
void warn_ (WarningType type, const QCString &file, int line, fmt::string_view fmt, fmt::format_args args)
 
void warn_uncond_ (fmt::string_view fmt, fmt::format_args args)
 
void err_ (fmt::string_view fmt, fmt::format_args args)
 
void err_full_ (const QCString &file, int line, fmt::string_view fmt, fmt::format_args args)
 
void term_ (fmt::string_view fmt, fmt::format_args args)
 
QCString warn_line (const QCString &file, int line)
 
void initWarningFormat ()
 
void warn_flush ()
 
void finishWarnExit ()
 
template<typename ... Args>
void err_fmt (fmt::format_string< Args... > fmt, Args &&... args)
 
template<typename ... Args>
void err_full_fmt (const QCString &file, int line, fmt::format_string< Args... > fmt, Args &&... args)
 
template<typename ... Args>
void term_fmt (fmt::format_string< Args... > fmt, Args &&... args)
 
template<typename ... Args>
void msg_fmt (fmt::format_string< Args... > fmt, Args &&... args)
 
template<typename ... Args>
void warn_fmt (WarningType type, const QCString &file, int line, fmt::format_string< Args... > fmt, Args &&... args)
 
template<typename ... Args>
void warn_uncond_fmt (fmt::format_string< Args... > fmt, Args &&... args)
 
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(FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)
Definition message.h:144

Definition at line 127 of file message.h.

127#define err(fmt,...) do { \
128 msg_newline_required(fmt); \
129 err_fmt(FMT_STRING(fmt),##__VA_ARGS__); \
130 } 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_fmt(file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)

Definition at line 132 of file message.h.

132#define err_full(file,line,fmt,...) do { \
133 msg_no_newline_allowed(fmt); \
134 err_full_fmt(file,line,FMT_STRING(fmt),##__VA_ARGS__); \
135 } while (0)

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

◆ msg

#define msg ( fmt,
... )
Value:
msg_fmt(FMT_STRING(fmt),##__VA_ARGS__)
void msg_fmt(fmt::format_string< Args... > fmt, Args &&... args)
Definition message.h:64

Definition at line 94 of file message.h.

94#define msg(fmt,...) \
95 msg_fmt(FMT_STRING(fmt),##__VA_ARGS__)

Referenced by MemberDefImpl::_writeCallerGraph(), MemberDefImpl::_writeCallGraph(), FileDefImpl::acquireFileVersion(), adjustConfiguration(), Statistics::begin(), checkAndUpdatePath(), devUsage(), anonymous_namespace{tagreader.cpp}::TagFileParser::error(), LayoutParser::error(), exitDoxygen(), format_warn(), generateConceptDocs(), generateConfigFile(), generateDocsForClassList(), generateExampleDocs(), generateFileDocs(), generateFileSources(), generateFormula(), generateNamespaceClassDocs(), generateNamespaceConceptDocs(), generateNamespaceDocs(), generateOutput(), generatePageDocs(), generateSqlite3(), generateXML(), generateXMLForClass(), LayoutDocManager::init(), FormulaManager::initFromRepository(), initializeTables(), initializeViews(), loadExtensions(), loadStylesheet(), LayoutDocManager::parse(), XMLParser::parse(), parseFile(), parseFilesMultiThreading(), parseInput(), VHDLOutlineParser::parseInput(), parseMain(), parseMain(), parseMain(), parseMain(), parseTagFile(), Statistics::print(), Debug::printFlags(), processData(), readDir(), readIncludeFile(), readTagFile(), reportError(), DotManager::run(), runPlantumlContent(), AutoTrace::setExit(), setTranslator(), stopDoxygen(), LayoutNavEntry::url(), usage(), version(), DirDefImpl::writeDirectoryGraph(), ClassDefImpl::writeDocumentationForInnerClasses(), GroupDefImpl::writeGroupGraph(), writeIndex(), and writeIndexHierarchyEntries().

◆ 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:83

Definition at line 91 of file message.h.

91#define msg_newline_required(x) \
92 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 88 of file message.h.

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

◆ term

◆ warn

#define warn ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_fmt(WarningType::Generic,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)

Definition at line 97 of file message.h.

97#define warn(file,line,fmt,...) do { \
98 msg_no_newline_allowed(fmt); \
99 warn_fmt(WarningType::Generic,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
100 } while (0)

Referenced by addAnchor(), addClassToGroups(), addConceptToGroups(), addDirToGroups(), ModuleManager::addDocs(), addExampleToGroups(), addGroupToGroups(), addIncludeFile(), addMemberDocs(), addMemberFunction(), addMemberToGroups(), addModuleToGroups(), addNamespaceToGroups(), addRelatedPage(), addSection(), addXRefItem(), buildExampleList(), buildFileList(), buildFunctionList(), buildGroupListFiltered(), buildInterfaceAndServiceList(), checkBlocks(), checkFormula(), DocGroup::close(), convertCppComments(), decrLevel(), endCondSection(), endCondSection(), DocGroup::enterCompound(), anonymous_namespace{tagreader.cpp}::TagFileParser::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(), 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_fmt(WarningType::DocError,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)

Definition at line 112 of file message.h.

112#define warn_doc_error(file,line,fmt,...) do { \
113 msg_no_newline_allowed(fmt); \
114 warn_fmt(WarningType::DocError,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
115 } 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_fmt(WarningType::IncompleteDoc,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)
@ IncompleteDoc
Definition message.h:29

Definition at line 107 of file message.h.

107#define warn_incomplete_doc(file,line,fmt,...) do { \
108 msg_no_newline_allowed(fmt); \
109 warn_fmt(WarningType::IncompleteDoc,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
110 } while (0)

Referenced by DocParser::checkUnOrMultipleDocumentedParams().

◆ warn_layout

#define warn_layout ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_fmt(WarningType::Layout,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)

Definition at line 117 of file message.h.

117#define warn_layout(file,line,fmt,...) do { \
118 msg_no_newline_allowed(fmt); \
119 warn_fmt(WarningType::Layout,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
120 } while (0)

Referenced by LayoutParser::error(), mergeDocEntryLists(), LayoutParser::startElement(), and LayoutParser::startNavEntry().

◆ warn_uncond

#define warn_uncond ( fmt,
... )

◆ warn_undoc

#define warn_undoc ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_fmt(WarningType::Undocumented,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)
@ Undocumented
Definition message.h:28

Definition at line 102 of file message.h.

102#define warn_undoc(file,line,fmt,...) do { \
103 msg_no_newline_allowed(fmt); \
104 warn_fmt(WarningType::Undocumented,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
105 } while (0)

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

Enumeration Type Documentation

◆ WarningType

enum class WarningType
strong
Enumerator
Generic 
Undocumented 
IncompleteDoc 
DocError 
Layout 

Definition at line 25 of file message.h.

26{
27 Generic,
31 Layout
32};

Function Documentation

◆ err_()

void err_ ( fmt::string_view fmt,
fmt::format_args args )

Definition at line 159 of file message.cpp.

160{
161 fmt::print(g_warnFile,"{}{}",g_errorStr,fmt::vformat(fmt,args));
163}
static const char * g_errorStr
Definition message.cpp:33
static FILE * g_warnFile
Definition message.cpp:34
static void handle_warn_as_error()
Definition message.cpp:88

References g_errorStr, g_warnFile, and handle_warn_as_error().

Referenced by err_fmt().

◆ err_fmt()

template<typename ... Args>
void err_fmt ( fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 46 of file message.h.

47{
48 err_(fmt,fmt::make_format_args(args...));
49}
void err_(fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:159

References err_().

◆ err_full_()

void err_full_ ( const QCString & file,
int line,
fmt::string_view fmt,
fmt::format_args args )

Definition at line 167 of file message.cpp.

168{
169 format_warn(file,line,QCString(g_errorStr+fmt::vformat(fmt,args)));
170}
This is an alternative implementation of QCString.
Definition qcstring.h:101
static void format_warn(const QCString &file, int line, const QCString &text)
Definition message.cpp:43

References format_warn(), and g_errorStr.

Referenced by err_full_fmt().

◆ err_full_fmt()

template<typename ... Args>
void err_full_fmt ( const QCString & file,
int line,
fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 52 of file message.h.

53{
54 err_full_(file,line,fmt,fmt::make_format_args(args...));
55}
void err_full_(const QCString &file, int line, fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:167

References err_full_().

◆ finishWarnExit()

void finishWarnExit ( )

Definition at line 276 of file message.cpp.

277{
278 fflush(stdout);
279 if (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-")
280 {
282 g_warnFile = nullptr;
283 }
284 if (g_warnStat && g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-")
285 {
286
287 std::ifstream warnFile = Portable::openInputStream(g_warnlogFile);
288 if (!warnFile.is_open())
289 {
290 g_warnFile = stderr;
291 err("Cannot open warnings file '{}' for reading\n",g_warnlogFile);
292 }
293 else
294 {
295 std::string line;
296 while (getline(warnFile,line))
297 {
298 fmt::print(stderr,"{}\n",line);
299 }
300 warnFile.close();
301 }
302 }
303
305
306 if (g_warnStat && (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS ||
307 g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT))
308 {
309 exit(1);
310 }
311}
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 QCString g_warnlogFile
Definition message.cpp:36
#define err(fmt,...)
Definition message.h:127
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().

◆ has_newline_at_end()

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

Definition at line 83 of file message.h.

84{
85 return str[N-2]=='\n';
86}

◆ initWarningFormat()

void initWarningFormat ( )

Definition at line 218 of file message.cpp.

219{
220 g_warnFormat = Config_getString(WARN_FORMAT);
221 g_warnLineFormat = Config_getString(WARN_LINE_FORMAT);
222 g_warnBehavior = Config_getEnum(WARN_AS_ERROR);
223 g_warnlogFile = Config_getString(WARN_LOGFILE);
224 if (g_warnlogFile.isEmpty() && g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT)
225 {
226 uint32_t pid = Portable::pid();
227 g_warnlogFile.sprintf("doxygen_warnings_temp_%d.tmp",pid);
228 g_warnlogTemp = true;
229 }
230
231 if (!g_warnlogFile.isEmpty())
232 {
233 if (g_warnlogFile == "-")
234 {
235 g_warnFile = stdout;
236 }
237 else
238 {
239 FileInfo fi(g_warnlogFile.str());
240 Dir d(fi.dirPath().c_str());
241 if (!d.exists() && !d.mkdir(fi.dirPath().c_str()))
242 {
243 // point it to something valid, because warn() relies on it
244 g_warnFile = stderr;
245 err("Cannot create directory for '{}', redirecting 'WARN_LOGFILE' output to 'stderr'\n",g_warnlogFile);
246 }
247 else if (!(g_warnFile = Portable::fopen(g_warnlogFile,"w")))
248 {
249 // point it to something valid, because warn() relies on it
250 g_warnFile = stderr;
251 err("Cannot open '{}' for writing, redirecting 'WARN_LOGFILE' output to 'stderr'\n",g_warnlogFile);
252 }
253 }
254 }
255 else
256 {
257 g_warnFile = stderr;
258 }
259 if (g_warnBehavior != WARN_AS_ERROR_t::NO)
260 {
262 }
263
264 // make sure the g_warnFile is closed in case we call exit and it is still open
265 std::atexit([](){
266 if (g_warnFile && g_warnFile!=stderr && g_warnFile!=stdout)
267 {
269 g_warnFile = nullptr;
270 }
271 });
272}
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_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().

◆ msg_()

void msg_ ( fmt::string_view fmt,
fmt::format_args args )

Definition at line 117 of file message.cpp.

118{
119 if (!Config_getBool(QUIET))
120 {
121 std::unique_lock<std::mutex> lock(g_mutex);
123 {
124 fmt::print("{:.3f} sec: ",(static_cast<double>(Debug::elapsedTime())));
125 }
126 fmt::print("{}",fmt::vformat(fmt,args));
127 }
128}
@ Time
Definition debug.h:35
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:132
static double elapsedTime()
Definition debug.cpp:201
#define Config_getBool(name)
Definition config.h:33
static std::mutex g_mutex
Definition message.cpp:39

References Config_getBool, Debug::elapsedTime(), g_mutex, Debug::isFlagSet(), and Debug::Time.

Referenced by msg_fmt().

◆ msg_fmt()

template<typename ... Args>
void msg_fmt ( fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 64 of file message.h.

65{
66 msg_(fmt,fmt::make_format_args(args...));
67}
void msg_(fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:117

References msg_().

◆ term_()

void term_ ( fmt::string_view fmt,
fmt::format_args args )

Definition at line 174 of file message.cpp.

175{
176 {
177 std::unique_lock<std::mutex> lock(g_mutex);
178 fmt::print(g_warnFile, "{}{}", g_errorStr, fmt::vformat(fmt,args));
179 if (g_warnFile != stderr)
180 {
181 size_t l = strlen(g_errorStr);
182 for (size_t i=0; i<l; i++) fmt::print(g_warnFile, " ");
183 fmt::print(g_warnFile, "{}\n", "Exiting...");
184 if (!Config_getBool(QUIET))
185 {
186 // cannot use `msg` due to the mutex
187 fmt::print("See '{}' for the reason of termination.\n",g_warnlogFile);
188 }
189 }
190 }
191 exit(1);
192}

References Config_getBool, g_errorStr, g_mutex, g_warnFile, and g_warnlogFile.

Referenced by term_fmt().

◆ term_fmt()

template<typename ... Args>
void term_fmt ( fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 58 of file message.h.

59{
60 term_(fmt,fmt::make_format_args(args...));
61}
void term_(fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:174

References term_().

◆ warn_()

void warn_ ( WarningType type,
const QCString & file,
int line,
fmt::string_view fmt,
fmt::format_args args )

Definition at line 132 of file message.cpp.

133{
134 bool enabled = false;
135 switch (type)
136 {
137 case WarningType::Generic: enabled = Config_getBool(WARNINGS); break;
138 case WarningType::Undocumented: enabled = Config_getBool(WARN_IF_UNDOCUMENTED); break;
139 case WarningType::IncompleteDoc: enabled = Config_getBool(WARN_IF_INCOMPLETE_DOC); break;
140 case WarningType::DocError: enabled = Config_getBool(WARN_IF_DOC_ERROR); break;
141 case WarningType::Layout: enabled = Config_getBool(WARN_LAYOUT_FILE); break;
142 }
143 if (enabled)
144 {
145 do_warn(file, line, g_warningStr, fmt, args);
146 }
147}
static void do_warn(const QCString &file, int line, const char *prefix, fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:109

References Config_getBool, do_warn(), DocError, g_warningStr, Generic, IncompleteDoc, Layout, and Undocumented.

Referenced by warn_fmt().

◆ warn_flush()

void warn_flush ( )

Definition at line 211 of file message.cpp.

212{
213 fflush(g_warnFile);
214}

References g_warnFile.

Referenced by Statistics::end().

◆ warn_fmt()

template<typename ... Args>
void warn_fmt ( WarningType type,
const QCString & file,
int line,
fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 70 of file message.h.

71{
72 warn_(type,file,line,fmt,fmt::make_format_args(args...));
73}
void warn_(WarningType type, const QCString &file, int line, fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:132

References warn_().

◆ warn_line()

QCString warn_line ( const QCString & file,
int line )

Definition at line 196 of file message.cpp.

197{
198 QCString fileSubst = file.isEmpty() ? "<unknown>" : file;
199 QCString lineSubst; lineSubst.setNum(line);
200 return substitute(
203 "$file",fileSubst
204 ),
205 "$line",lineSubst
206 );
207}
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(), and findGlobalMember().

◆ warn_uncond_()

void warn_uncond_ ( fmt::string_view fmt,
fmt::format_args args )

Definition at line 151 of file message.cpp.

152{
153 fmt::print(g_warnFile,"{}{}",g_warningStr,vformat(fmt,args));
155}

References g_warnFile, g_warningStr, and handle_warn_as_error().

Referenced by warn_uncond_fmt().

◆ warn_uncond_fmt()

template<typename ... Args>
void warn_uncond_fmt ( fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 76 of file message.h.

77{
78 warn_uncond_(fmt,fmt::make_format_args(args...));
79}
void warn_uncond_(fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:151

References warn_uncond_().