diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2020-04-03 10:38:53 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2020-04-03 10:38:53 -0400 |
commit | dc07509f296661cf7a4d4bceb88a1a897757de98 (patch) | |
tree | 07637f41c8dfbc4cab5cefa65749a8a748603c99 /indra/test/print.h | |
parent | b793ab8619d8c52a099aa85fdd831990ca95c6f4 (diff) |
DRTVWR-476: Cherry-pick debug aids from commit 77b0c53 (fiber-mutex)
Diffstat (limited to 'indra/test/print.h')
-rw-r--r-- | indra/test/print.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/indra/test/print.h b/indra/test/print.h new file mode 100644 index 0000000000..08e36caddf --- /dev/null +++ b/indra/test/print.h @@ -0,0 +1,42 @@ +/** + * @file print.h + * @author Nat Goodspeed + * @date 2020-01-02 + * @brief print() function for debugging + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Copyright (c) 2020, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_PRINT_H) +#define LL_PRINT_H + +#include <iostream> + +// print(..., NONL); +// leaves the output dangling, suppressing the normally appended std::endl +struct NONL_t {}; +#define NONL (NONL_t()) + +// normal recursion end +inline +void print() +{ + std::cerr << std::endl; +} + +// print(NONL) is a no-op +inline +void print(NONL_t) +{ +} + +template <typename T, typename... ARGS> +void print(T&& first, ARGS&&... rest) +{ + std::cerr << first; + print(std::forward<ARGS>(rest)...); +} + +#endif /* ! defined(LL_PRINT_H) */ |