X-Git-Url: https://git.cworth.org/git?p=notmuch;a=blobdiff_plain;f=compat%2Fcompat.h;h=c1ee0f93e9a907463a49dd2d5aee5ea6d96cc493;hp=173ef680ceb8d9d9d67833fcd9db6e10ea4382aa;hb=31c7001c99e042c2722217410d8a913875d44149;hpb=7d06e14e79f41c485f6cb448994498c5581dc69d diff --git a/compat/compat.h b/compat/compat.h index 173ef680..c1ee0f93 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -26,6 +26,14 @@ #ifndef NOTMUCH_COMPAT_H #define NOTMUCH_COMPAT_H +#ifdef __cplusplus +extern "C" { +#endif + +#if !STD_GETPWUID +#define _POSIX_PTHREAD_SEMANTICS 1 +#endif + #if !HAVE_GETLINE #include #include @@ -42,4 +50,16 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp); char* strcasestr(const char *haystack, const char *needle); #endif /* !HAVE_STRCASESTR */ +/* Silence gcc warnings about unused results. These warnings exist + * for a reason; any use of this needs to be justified. */ +#ifdef __GNUC__ +#define IGNORE_RESULT(x) ({ __typeof__(x) __z = (x); (void)(__z = __z); }) +#else /* !__GNUC__ */ +#define IGNORE_RESULT(x) x +#endif /* __GNUC__ */ + +#ifdef __cplusplus +} +#endif + #endif /* NOTMUCH_COMPAT_H */