changeset 66:f773c76b1f3c

Added extern C tests
author David Demelier <markand@malikania.fr>
date Wed, 09 Nov 2011 21:08:43 +0100
parents b2cd1fd33bb0
children cff6869fbc94
files array.h buffer.h err.h module.h parray.h
diffstat 5 files changed, 47 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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_ */
--- 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 <stdarg.h>
 
-#include <stdarg.h>
+#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_ */
--- 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 <stdarg.h>
 
+#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_ */
--- 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 <dlfcn.h>
 #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_ */
--- 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_ */