From db3ead3577c354e2fa9530933c12d3f1851034cb Mon Sep 17 00:00:00 2001 From: Robert Quattlebaum Date: Fri, 17 Jun 2016 20:20:19 -0700 Subject: [PATCH] spinel: Add definitions for __BEGIN_DECLS and __END_DECLS (#172) Sometimes platforms don't provide definitions for `__BEGIN_DECLS` and `__END_DECLS`. --- src/ncp/spinel.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ncp/spinel.h b/src/ncp/spinel.h index 2d2663d76..2bcd7a8c0 100644 --- a/src/ncp/spinel.h +++ b/src/ncp/spinel.h @@ -34,16 +34,26 @@ #include #include -__BEGIN_DECLS - // ---------------------------------------------------------------------------- #ifndef DOXYGEN_SHOULD_SKIP_THIS -# if defined(__GNUC__) && !SPINEL_EMBEDDED + +# if defined(__GNUC__) # define SPINEL_API_EXTERN extern __attribute__ ((visibility ("default"))) # define SPINEL_API_NONNULL_ALL __attribute__((nonnull)) # define SPINEL_API_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) # endif // ifdef __GNUC__ + +# if !defined(__BEGIN_DECLS) || !defined(__END_DECLS) +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +# else // if defined(__cplusplus) +# define __BEGIN_DECLS +# define __END_DECLS +# endif // else defined(__cplusplus) +# endif // if !defined(__BEGIN_DECLS) || !defined(__END_DECLS) + #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef SPINEL_API_EXTERN @@ -67,6 +77,8 @@ __BEGIN_DECLS // ---------------------------------------------------------------------------- +__BEGIN_DECLS + typedef enum { SPINEL_STATUS_OK = 0, ///< Operation has completed successfully.