# HG changeset patch # User David Demelier # Date 1320869323 -3600 # Node ID f773c76b1f3c7080ac946bdd534ab67e5a6fb8ae # Parent b2cd1fd33bb081701353247c7dcc09e8e901c5cb Added extern C tests diff -r b2cd1fd33bb0 -r f773c76b1f3c array.h --- a/array.h Wed Nov 09 20:12:24 2011 +0100 +++ b/array.h Wed Nov 09 21:08:43 2011 +0100 @@ -19,6 +19,10 @@ #ifndef _ARRAY_H_ #define _ARRAY_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* Add some nonnull attributes for gcc/clang */ #ifdef __GNUC__ # define __at_malloc __attribute__ ((malloc)) @@ -80,4 +84,8 @@ (a)->i < (a)->length; \ ++(a)->i, var = ARRAY_INDEX((a), (a)->i, type)) +#ifdef __cplusplus +} +#endif + #endif /* _ARRAY_H_ */ diff -r b2cd1fd33bb0 -r f773c76b1f3c buffer.h --- a/buffer.h Wed Nov 09 20:12:24 2011 +0100 +++ b/buffer.h Wed Nov 09 21:08:43 2011 +0100 @@ -19,9 +19,11 @@ #ifndef _BUFFER_H_ #define _BUFFER_H_ -#define BUFFER_DEFAULT_BSIZE 512 +#include -#include +#ifdef __cplusplus +extern "C" { +#endif /* * Some useful attributes with gcc or clang. @@ -39,6 +41,8 @@ # define __at_printf(...) #endif +#define BUFFER_DEFAULT_BSIZE 512 + enum buffer_type { BUFFER_FIXED = 0, BUFFER_AUTO = 1 @@ -63,4 +67,8 @@ void buffer_clear(struct buffer *) __at_nonnull; void buffer_free(struct buffer *) __at_nonnull; +#ifdef __cplusplus +} +#endif + #endif /* _BUFFER_H_ */ diff -r b2cd1fd33bb0 -r f773c76b1f3c err.h --- a/err.h Wed Nov 09 20:12:24 2011 +0100 +++ b/err.h Wed Nov 09 21:08:43 2011 +0100 @@ -21,6 +21,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /* * Attribute noreturn may helps. This may produce a warning with GCC 4.5: * @@ -34,7 +38,7 @@ */ #ifdef __GNUC__ -#define _NORETURN_ __attribute__ ((noreturn)) +# define __at_noreturn __attribute__ ((noreturn)) #endif /* @@ -43,16 +47,16 @@ * with the error code given as first argument. */ -void err(int, const char *, ...) _NORETURN_; -void verr(int, const char *, va_list) _NORETURN_; +void err(int, const char *, ...) __at_noreturn; +void verr(int, const char *, va_list) __at_noreturn; /* * errx() functions are similar to err() except that they do not append the * system error message. */ -void errx(int, const char *, ...) _NORETURN_; -void verrx(int, const char *, va_list) _NORETURN_; +void errx(int, const char *, ...) __at_noreturn; +void verrx(int, const char *, va_list) __at_noreturn; /* * warn() functions are similar to err() but they do not call exit(). @@ -69,4 +73,8 @@ void warnx(const char *, ...); void vwarnx(const char *, va_list); +#ifdef __cplusplus +} +#endif + #endif /* _ERR_H_ */ diff -r b2cd1fd33bb0 -r f773c76b1f3c module.h --- a/module.h Wed Nov 09 20:12:24 2011 +0100 +++ b/module.h Wed Nov 09 21:08:43 2011 +0100 @@ -25,6 +25,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + /* Unsupported on windows */ #if defined(_WIN32) || defined(__WIN32__) #define MOD_LAZY 1 @@ -48,4 +52,8 @@ int module_find(struct module *, const char *); void module_free(struct module *); +#ifdef __cplusplus +} +#endif + #endif /* _MODULE_H_ */ diff -r b2cd1fd33bb0 -r f773c76b1f3c parray.h --- a/parray.h Wed Nov 09 20:12:24 2011 +0100 +++ b/parray.h Wed Nov 09 21:08:43 2011 +0100 @@ -19,6 +19,10 @@ #ifndef _PARRAY_H_ #define _PARRAY_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* Add some nonnull attributes for gcc/clang */ #ifdef __GNUC__ # define __at_malloc __attribute__ ((malloc)) @@ -91,4 +95,8 @@ (a)->length = 0; \ } while (/* CONSTCOND */ 0); +#ifdef __cplusplus +} +#endif + #endif /* _PARRAY_H_ */