summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2017-07-21 20:34:45 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2017-07-22 16:38:19 (GMT)
commita9f7732d45c22ca7d22bed6ff2eaeb702356884e (patch)
tree0472fe6cc282a7fd82b0debe36a1ced5fb2d2e89 /test
parentaa6c2821374f6dd6ed2e628c06bc08b0c4bc485c (diff)
downloadjemalloc-a9f7732d45c22ca7d22bed6ff2eaeb702356884e.zip
jemalloc-a9f7732d45c22ca7d22bed6ff2eaeb702356884e.tar.gz
jemalloc-a9f7732d45c22ca7d22bed6ff2eaeb702356884e.tar.bz2
Logging: allow logging with empty varargs.
Currently, the log macro requires at least one argument after the format string, because of the way the preprocessor handles varargs macros. We can hide some of that irritation by pushing the extra arguments into a varargs function.
Diffstat (limited to 'test')
-rw-r--r--test/unit/log.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/unit/log.c b/test/unit/log.c
index 6db256f..053fea4 100644
--- a/test/unit/log.c
+++ b/test/unit/log.c
@@ -170,13 +170,25 @@ TEST_BEGIN(test_logs_if_no_init) {
}
TEST_END
+/*
+ * This really just checks to make sure that this usage compiles; we don't have
+ * any test code to run.
+ */
+TEST_BEGIN(test_log_only_format_string) {
+ if (false) {
+ static log_var_t l = LOG_VAR_INIT("str");
+ log(l, "No arguments follow this format string.");
+ }
+}
+TEST_END
+
int
main(void) {
-
return test(
test_log_disabled,
test_log_enabled_direct,
test_log_enabled_indirect,
test_log_enabled_global,
- test_logs_if_no_init);
+ test_logs_if_no_init,
+ test_log_only_format_string);
}