diff options
author | TizenOpenSource <tizenopensrc@samsung.com> | 2023-12-22 18:14:24 +0900 |
---|---|---|
committer | TizenOpenSource <tizenopensrc@samsung.com> | 2023-12-22 18:14:24 +0900 |
commit | 14adf159fc9eb1212b2e61ea78e94c135abde0fe (patch) | |
tree | 759368bce8b58bc20ffbb70cff0c19736f5bef22 /src/message.h | |
parent | cfd886868fa8595b045007a2ad673c18c5f222b3 (diff) | |
download | doxygen-14adf159fc9eb1212b2e61ea78e94c135abde0fe.tar.gz doxygen-14adf159fc9eb1212b2e61ea78e94c135abde0fe.tar.bz2 doxygen-14adf159fc9eb1212b2e61ea78e94c135abde0fe.zip |
Imported Upstream version 1.9.8upstream/1.9.8upstream
Diffstat (limited to 'src/message.h')
-rw-r--r-- | src/message.h | 77 |
1 files changed, 64 insertions, 13 deletions
diff --git a/src/message.h b/src/message.h index dc61bbb..bb824c8 100644 --- a/src/message.h +++ b/src/message.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2020 by Dimitri van Heesch. + * Copyright (C) 1997-2023 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby @@ -26,23 +26,74 @@ #endif extern void msg(const char *fmt, ...) PRINTFLIKE(1,2); -extern void warn(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); extern void va_warn(const QCString &file, int line, const char* fmt, va_list args); -extern void warn_simple(const QCString &file,int line,const char *text); -extern void warn_undoc(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); -extern void warn_incomplete_doc(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); -extern void warn_doc_error(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); -extern void warn_uncond(const char *fmt, ...) PRINTFLIKE(1, 2); -extern void err(const char *fmt, ...) PRINTFLIKE(1, 2); -extern void err_full(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); -extern void term(const char *fmt, ...) PRINTFLIKE(1, 2); +extern void warn_undoc_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn_incomplete_doc_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn_doc_error_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn_uncond_(const char *fmt, ...) PRINTFLIKE(1, 2); +extern void err_(const char *fmt, ...) PRINTFLIKE(1, 2); +extern void err_full_(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void term_(const char *fmt, ...) PRINTFLIKE(1, 2); extern QCString warn_line(const QCString &file,int line); void initWarningFormat(); void warn_flush(); extern void finishWarnExit(); -extern void printlex(int dbg, bool enter, const char *lexName, const char *fileName); - #undef PRINTFLIKE -#endif +// N is size including 0-terminal +template<std::size_t N> +constexpr bool has_newline_at_end(const char (&str)[N]) +{ + return str[N-2]=='\n'; +} + +#define msg_no_newline_allowed(x) \ + static_assert(!has_newline_at_end(x),"text: \"" x "\" should not have \\n at end"); + +#define msg_newline_required(x) \ + static_assert(has_newline_at_end(x),"text: \"" x "\" should have \\n at end"); + +#define warn(file,line,fmt,...) do { \ + msg_no_newline_allowed(fmt); \ + warn_(file,line,fmt,##__VA_ARGS__); \ + } while(0) + +#define warn_undoc(file,line,fmt,...) do { \ + msg_no_newline_allowed(fmt); \ + warn_undoc_(file,line,fmt,##__VA_ARGS__); \ + } while(0) + +#define warn_incomplete_doc(file,line,fmt,...) do { \ + msg_no_newline_allowed(fmt); \ + warn_incomplete_doc_(file,line,fmt,##__VA_ARGS__); \ + } while(0) + +#define warn_doc_error(file,line,fmt,...) do { \ + msg_no_newline_allowed(fmt); \ + warn_doc_error_(file,line,fmt,##__VA_ARGS__); \ + } while(0) + +#define warn_uncond(fmt,...) do { \ + msg_newline_required(fmt); \ + warn_uncond_(fmt,##__VA_ARGS__); \ + } while(0) + +#define err(fmt,...) do { \ + msg_newline_required(fmt); \ + err_(fmt,##__VA_ARGS__); \ + } while(0) + +#define err_full(file,line,fmt,...) do { \ + msg_no_newline_allowed(fmt); \ + err_full_(file,line,fmt,##__VA_ARGS__); \ + } while(0) + +#define term(fmt,...) do { \ + msg_newline_required(fmt); \ + term_(fmt,##__VA_ARGS__); \ + } while(0) + +#endif // MESSAGE_H + |