X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=tests%2Futils%2Futils.h;h=87b4918def3a9960a230b4ace04ad71b56007128;hb=f65ab3f72378bd72dd992688a21e3eb39330b2cd;hp=afacf8d2f8cda641976aca064a6b52cf6c456fcd;hpb=0c818c97b35a36971c326171d9aea5b0a432ced9;p=lttng-tools.git diff --git a/tests/utils/utils.h b/tests/utils/utils.h index afacf8d2f..87b4918de 100644 --- a/tests/utils/utils.h +++ b/tests/utils/utils.h @@ -8,7 +8,14 @@ #ifndef TEST_UTILS_H #define TEST_UTILS_H -#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)) +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +#if !defined(__GLIBC__) || \ + ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)) /* * Version using XSI strerror_r. @@ -23,13 +30,12 @@ /* * Version using GNU strerror_r, for linux with appropriate defines. */ -#define PERROR_NO_LOGGER(msg, args...) \ - do { \ - char *_perror_buf; \ - char _perror_tmp[200]; \ - _perror_buf = strerror_r( \ - errno, _perror_tmp, sizeof(_perror_tmp)); \ - fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \ +#define PERROR_NO_LOGGER(msg, args...) \ + do { \ + char *_perror_buf; \ + char _perror_tmp[200]; \ + _perror_buf = strerror_r(errno, _perror_tmp, sizeof(_perror_tmp)); \ + fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \ } while (0); #endif @@ -37,4 +43,8 @@ int usleep_safe(useconds_t usec); int create_file(const char *path); int wait_on_file(const char *path); +#if defined(__cplusplus) +} +#endif + #endif /* TEST_UTILS_H */