mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Fixing a bunch of format strings.
Also leveraging GCC if available to check format specificier. Closes #567.
This commit is contained in:
parent
d86525ce61
commit
63b46a0ae2
14 changed files with 38 additions and 31 deletions
|
@ -15,6 +15,13 @@
|
|||
class Connection;
|
||||
class Location;
|
||||
|
||||
// Check printf-style variadic arguments if we can.
|
||||
#if __GNUC__
|
||||
#define FMT_ATTR __attribute__((format(printf, 2, 3))) // sic! 1st is "this" I guess.
|
||||
#else
|
||||
#define FMT_ATTR
|
||||
#endif
|
||||
|
||||
class Reporter {
|
||||
public:
|
||||
Reporter();
|
||||
|
@ -22,25 +29,25 @@ public:
|
|||
|
||||
// Report an informational message, nothing that needs specific
|
||||
// attention.
|
||||
void Info(const char* fmt, ...);
|
||||
void Info(const char* fmt, ...) FMT_ATTR;
|
||||
|
||||
// Report a warning that may indicate a problem.
|
||||
void Warning(const char* fmt, ...);
|
||||
void Warning(const char* fmt, ...) FMT_ATTR;
|
||||
|
||||
// Report a non-fatal error. Processing proceeds normally after the error
|
||||
// has been reported.
|
||||
void Error(const char* fmt, ...);
|
||||
void Error(const char* fmt, ...) FMT_ATTR;
|
||||
|
||||
// Returns the number of errors reported so far.
|
||||
int Errors() { return errors; }
|
||||
|
||||
// Report a fatal error. Bro will terminate after the message has been
|
||||
// reported.
|
||||
void FatalError(const char* fmt, ...);
|
||||
void FatalError(const char* fmt, ...) FMT_ATTR;
|
||||
|
||||
// Report a fatal error. Bro will terminate after the message has been
|
||||
// reported and always generate a core dump.
|
||||
void FatalErrorWithCore(const char* fmt, ...);
|
||||
void FatalErrorWithCore(const char* fmt, ...) FMT_ATTR;
|
||||
|
||||
// Report a traffic weirdness, i.e., an unexpected protocol situation
|
||||
// that may lead to incorrectly processing a connnection.
|
||||
|
@ -51,15 +58,15 @@ public:
|
|||
|
||||
// Syslog a message. This methods does nothing if we're running
|
||||
// offline from a trace.
|
||||
void Syslog(const char* fmt, ...);
|
||||
void Syslog(const char* fmt, ...) FMT_ATTR;
|
||||
|
||||
// Report about a potential internal problem. Bro will continue
|
||||
// normally.
|
||||
void InternalWarning(const char* fmt, ...);
|
||||
void InternalWarning(const char* fmt, ...) FMT_ATTR;
|
||||
|
||||
// Report an internal program error. Bro will terminate with a core
|
||||
// dump after the message has been reported.
|
||||
void InternalError(const char* fmt, ...);
|
||||
void InternalError(const char* fmt, ...) FMT_ATTR;
|
||||
|
||||
// Toggle whether non-fatal messages should be reported through the
|
||||
// scripting layer rather on standard output. Fatal errors are always
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue