aboutsummaryrefslogtreecommitdiff
path: root/src/lib/log
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-22 09:39:06 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-22 09:39:06 -0400
commitb2d487ae2249a307cd23255dbb1a22241eefd6ef (patch)
treecd754fbe8d1c13264749f997f1221b1635a97e49 /src/lib/log
parent2d013bbe5cccaccf9ace0beec5a987fb80e850ad (diff)
parent7e7a4874b8fa333d1840cc5f2c0b118d6a0e7c47 (diff)
downloadtor-b2d487ae2249a307cd23255dbb1a22241eefd6ef.tar.gz
tor-b2d487ae2249a307cd23255dbb1a22241eefd6ef.zip
Merge branch 'ticket31705_v2' into ticket31705_v2_merged
Conflicts: src/feature/dirparse/authcert_parse.c src/feature/dirparse/ns_parse.c src/feature/hs/hs_service.c src/lib/conf/conftesting.h src/lib/log/log.h src/lib/thread/threads.h src/test/test_options.c These conflicts were mostly related to autostyle improvements, with one or two due to doxygen fixes.
Diffstat (limited to 'src/lib/log')
-rw-r--r--src/lib/log/log.c2
-rw-r--r--src/lib/log/log.h4
-rw-r--r--src/lib/log/ratelim.h2
-rw-r--r--src/lib/log/util_bug.h9
4 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/log/log.c b/src/lib/log/log.c
index dc53b386b0..cb92ef07ef 100644
--- a/src/lib/log/log.c
+++ b/src/lib/log/log.c
@@ -523,7 +523,7 @@ logfile_deliver(logfile_t *lf, const char *buf, size_t msg_len,
* pass them, and some very old ones do not detect overflow so well.
* Regrettably, they call their maximum line length MAXLINE. */
#if MAXLINE < 64
-#warn "MAXLINE is a very low number; it might not be from syslog.h after all"
+#warning "MAXLINE is a very low number; it might not be from syslog.h."
#endif
char *m = msg_after_prefix;
if (msg_len >= MAXLINE)
diff --git a/src/lib/log/log.h b/src/lib/log/log.h
index 374db76e12..19cb9484d7 100644
--- a/src/lib/log/log.h
+++ b/src/lib/log/log.h
@@ -23,10 +23,12 @@
#include <syslog.h>
#define LOG_WARN LOG_WARNING
#if LOG_DEBUG < LOG_ERR
+#ifndef COCCI
#error "Your syslog.h thinks high numbers are more important. " \
"We aren't prepared to deal with that."
#endif
-#else /* !defined(HAVE_SYSLOG_H) */
+#endif
+#else /* !(defined(HAVE_SYSLOG_H)) */
/* Note: Syslog's logging code refers to priorities, with 0 being the most
* important. Thus, all our comparisons needed to be reversed when we added
* syslog support.
diff --git a/src/lib/log/ratelim.h b/src/lib/log/ratelim.h
index 1db54ba726..64f52df666 100644
--- a/src/lib/log/ratelim.h
+++ b/src/lib/log/ratelim.h
@@ -45,7 +45,9 @@ typedef struct ratelim_t {
int n_calls_since_last_time;
} ratelim_t;
+#ifndef COCCI
#define RATELIM_INIT(r) { (r), 0, 0 }
+#endif
#define RATELIM_TOOMANY (16*1000*1000)
char *rate_limit_log(ratelim_t *lim, time_t now);
diff --git a/src/lib/log/util_bug.h b/src/lib/log/util_bug.h
index c3141754de..dcff5fd9c3 100644
--- a/src/lib/log/util_bug.h
+++ b/src/lib/log/util_bug.h
@@ -131,7 +131,9 @@
#undef BUG
// Coverity defines this in global headers; let's override it. This is a
// magic coverity-only preprocessor thing.
+#ifndef COCCI
#nodef BUG(x) (x)
+#endif
#endif /* defined(__COVERITY__) */
#if defined(__COVERITY__) || defined(__clang_analyzer__)
@@ -200,6 +202,7 @@
: 0)
#endif /* defined(ALL_BUGS_ARE_FATAL) || ... */
+#ifndef COCCI
#ifdef __GNUC__
#define IF_BUG_ONCE__(cond,var) \
if (( { \
@@ -208,7 +211,7 @@
if (bool_result && !var) { \
var = 1; \
tor_bug_occurred_(SHORT_FILE__, __LINE__, __func__, \
- "!("#cond")", 1, NULL); \
+ ("!("#cond")"), 1, NULL); \
} \
bool_result; } ))
#else /* !defined(__GNUC__) */
@@ -218,10 +221,12 @@
(var ? 1 : \
(var=1, \
tor_bug_occurred_(SHORT_FILE__, __LINE__, __func__, \
- "!("#cond")", 1, NULL), \
+ ("!("#cond")"), 1, NULL), \
1)) \
: 0)
#endif /* defined(__GNUC__) */
+#endif
+
#define IF_BUG_ONCE_VARNAME_(a) \
warning_logged_on_ ## a ## __
#define IF_BUG_ONCE_VARNAME__(a) \