Author: astitcher
Date: Fri Apr  4 14:52:38 2014
New Revision: 1584732

URL: http://svn.apache.org/r1584732
Log:
PROTON-552: Centralise defintions of bool/true/false and make it work as C
on Visual Studio too

Modified:
    qpid/proton/trunk/proton-c/include/proton/codec.h
    qpid/proton/trunk/proton-c/include/proton/condition.h
    qpid/proton/trunk/proton-c/include/proton/connection.h
    qpid/proton/trunk/proton-c/include/proton/container.h
    qpid/proton/trunk/proton-c/include/proton/delivery.h
    qpid/proton/trunk/proton-c/include/proton/disposition.h
    qpid/proton/trunk/proton-c/include/proton/event.h
    qpid/proton/trunk/proton-c/include/proton/framing.h
    qpid/proton/trunk/proton-c/include/proton/io.h
    qpid/proton/trunk/proton-c/include/proton/link.h
    qpid/proton/trunk/proton-c/include/proton/message.h
    qpid/proton/trunk/proton-c/include/proton/object.h
    qpid/proton/trunk/proton-c/include/proton/sasl.h
    qpid/proton/trunk/proton-c/include/proton/selectable.h
    qpid/proton/trunk/proton-c/include/proton/selector.h
    qpid/proton/trunk/proton-c/include/proton/session.h
    qpid/proton/trunk/proton-c/include/proton/ssl.h
    qpid/proton/trunk/proton-c/include/proton/terminus.h
    qpid/proton/trunk/proton-c/include/proton/transport.h
    qpid/proton/trunk/proton-c/include/proton/type_compat.h
    qpid/proton/trunk/proton-c/include/proton/types.h
    qpid/proton/trunk/proton-c/src/tests/parse-url.c
    qpid/proton/trunk/proton-c/src/util.c

Modified: qpid/proton/trunk/proton-c/include/proton/codec.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/codec.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/codec.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/codec.h Fri Apr  4 14:52:38 2014
@@ -26,12 +26,7 @@
 #include <proton/object.h>
 #include <proton/types.h>
 #include <proton/error.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#include <stdint.h>
-#else
 #include <proton/type_compat.h>
-#endif
 #include <stdarg.h>
 
 #ifdef __cplusplus

Modified: qpid/proton/trunk/proton-c/include/proton/condition.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/condition.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/condition.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/condition.h Fri Apr  4 14:52:38 
2014
@@ -24,9 +24,7 @@
 
 #include <proton/import_export.h>
 #include <proton/codec.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/connection.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/connection.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/connection.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/connection.h Fri Apr  4 14:52:38 
2014
@@ -23,9 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/container.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/container.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/container.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/container.h Fri Apr  4 14:52:38 
2014
@@ -23,9 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/delivery.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/delivery.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/delivery.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/delivery.h Fri Apr  4 14:52:38 
2014
@@ -24,9 +24,7 @@
 
 #include <proton/import_export.h>
 #include <proton/disposition.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/disposition.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/disposition.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/disposition.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/disposition.h Fri Apr  4 14:52:38 
2014
@@ -23,9 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/event.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/event.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/event.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/event.h Fri Apr  4 14:52:38 2014
@@ -23,9 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/framing.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/framing.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/framing.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/framing.h Fri Apr  4 14:52:38 2014
@@ -23,11 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdint.h>
-#else
 #include <proton/type_compat.h>
-#endif
 #include <sys/types.h>
 
 #ifdef __cplusplus

Modified: qpid/proton/trunk/proton-c/include/proton/io.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/io.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/io.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/io.h Fri Apr  4 14:52:38 2014
@@ -26,9 +26,6 @@
 #include <proton/error.h>
 #include <sys/types.h>
 #include <proton/type_compat.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
 
 #ifdef __cplusplus
 extern "C" {

Modified: qpid/proton/trunk/proton-c/include/proton/link.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/link.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/link.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/link.h Fri Apr  4 14:52:38 2014
@@ -23,9 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/message.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/message.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/message.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/message.h Fri Apr  4 14:52:38 2014
@@ -27,9 +27,7 @@
 #include <proton/codec.h>
 #include <proton/error.h>
 #include <sys/types.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 
 #ifdef __cplusplus
 extern "C" {

Modified: qpid/proton/trunk/proton-c/include/proton/object.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/object.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/object.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/object.h Fri Apr  4 14:52:38 2014
@@ -24,12 +24,7 @@
 
 #include <proton/types.h>
 #include <stdarg.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#include <stdint.h>
-#else
 #include <proton/type_compat.h>
-#endif
 #include <stddef.h>
 #include <proton/import_export.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/sasl.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/sasl.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/sasl.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/sasl.h Fri Apr  4 14:52:38 2014
@@ -24,9 +24,7 @@
 
 #include <proton/import_export.h>
 #include <sys/types.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <proton/engine.h>
 
 #ifdef __cplusplus

Modified: qpid/proton/trunk/proton-c/include/proton/selectable.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/selectable.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/selectable.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/selectable.h Fri Apr  4 14:52:38 
2014
@@ -25,9 +25,7 @@
 #include <proton/import_export.h>
 #include <proton/object.h>
 #include <proton/io.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 
 #ifdef __cplusplus
 extern "C" {

Modified: qpid/proton/trunk/proton-c/include/proton/selector.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/selector.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/selector.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/selector.h Fri Apr  4 14:52:38 
2014
@@ -24,9 +24,7 @@
 
 #include <proton/import_export.h>
 #include <proton/selectable.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 
 #ifdef __cplusplus
 extern "C" {

Modified: qpid/proton/trunk/proton-c/include/proton/session.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/session.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/session.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/session.h Fri Apr  4 14:52:38 2014
@@ -23,9 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/ssl.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/ssl.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/ssl.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/ssl.h Fri Apr  4 14:52:38 2014
@@ -24,9 +24,7 @@
 
 #include <proton/import_export.h>
 #include <sys/types.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <proton/engine.h>
 
 #ifdef __cplusplus

Modified: qpid/proton/trunk/proton-c/include/proton/terminus.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/terminus.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/terminus.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/terminus.h Fri Apr  4 14:52:38 
2014
@@ -23,9 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/transport.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/transport.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/transport.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/transport.h Fri Apr  4 14:52:38 
2014
@@ -23,9 +23,7 @@
  */
 
 #include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
+#include <proton/type_compat.h>
 #include <stddef.h>
 #include <sys/types.h>
 

Modified: qpid/proton/trunk/proton-c/include/proton/type_compat.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/type_compat.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/type_compat.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/type_compat.h Fri Apr  4 14:52:38 
2014
@@ -22,6 +22,22 @@
  *
  */
 
+// Get Boolean
+#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined)
+# if __STDC_VERSION__ >= 199901L || __GNUC__ >= 3 || _MSC_VER >=1800
+#  include <stdbool.h>
+# else
+// Need to get bool/true/false manually
+#  if _MSC_VER
+#   define bool char
+#   define false 0
+#   define true 1
+#   define __bool_true_false_are_defined
+#  else
+#   error "No definitions for bool/true/false"
+#  endif
+# endif
+#endif
 /*
  * Handle special cases for stdint.h and the definition for ssize_t.
  * Third party libraries (e.g. Boost) may provide competing solutions.
@@ -34,70 +50,70 @@
 
 // Honor positive overrides
 #if defined(PN_DEFINE_STDINT)
-#define PNI_DEFINE_STDINT
+# define PNI_DEFINE_STDINT
 #endif
 #if defined(PN_INCLUDE_STDINT)
-#define PNI_INCLUDE_STDINT)
+# define PNI_INCLUDE_STDINT)
 #endif
 #if defined(PN_DEFINE_SSIZE_T)
-#define PNI_DEFINE_SSIZE_T
+# define PNI_DEFINE_SSIZE_T
 #endif
 
 // Determinine default action
 #ifndef _MSC_VER
 // Not Windows and not using Visual Studio
-#ifndef PNI_INCLUDE_STDINT
-#define PNI_INCLUDE_STDINT
-#endif
+# ifndef PNI_INCLUDE_STDINT
+#  define PNI_INCLUDE_STDINT
+# endif
 #else
 // all versions of Visual Studio
-#ifndef PNI_DEFINE_SSIZE_T
-// ssie_t def is needed, unless third party definition interferes, e.g. 
python/swig
-#ifndef Py_CONFIG_H
-#define PNI_DEFINE_SSIZE_T
-#endif
-#endif
+# ifndef PNI_DEFINE_SSIZE_T
+// ssize_t def is needed, unless third party definition interferes, e.g. 
python/swig
+#  ifndef Py_CONFIG_H
+#   define PNI_DEFINE_SSIZE_T
+#  endif
+# endif
 
-#if (_MSC_VER < 1600)
+# if (_MSC_VER < 1600)
 // VS 2008 and earlier
-#ifndef PNI_DEFINE_STDINT
-#define PNI_DEFINE_STDINT
-#endif
-#else
+#  ifndef PNI_DEFINE_STDINT
+#   define PNI_DEFINE_STDINT
+#  endif
+# else
 // VS 2010 and newer
-#ifndef PNI_INCLUDE_STDINT
-#define PNI_INCLUDE_STDINT
-#endif
+#  ifndef PNI_INCLUDE_STDINT
+#   define PNI_INCLUDE_STDINT
+#  endif
 
-#endif // (_MSC_VER < 1600)
+# endif // (_MSC_VER < 1600)
 #endif //_MSC_VER
 
 // Honor negative overrides
 #ifdef PN_NODEFINE_SSIZE_T
-#undef PNI_DEFINE_SSIZE_T
+# undef PNI_DEFINE_SSIZE_T
 #endif
 #ifdef PN_NODEFINE_STDINT
-#undef PNI_DEFINE_STDINT
+# undef PNI_DEFINE_STDINT
 #endif
 #ifdef PN_NOINCLUDE_STDINT
-#undef PNI_INCLUDE_STDINT
+# undef PNI_INCLUDE_STDINT
 #endif
 
 #ifdef PNI_INCLUDE_STDINT
-#include <stdint.h>
+# include <stdint.h>
 #endif
 
 #ifdef PNI_DEFINE_SSIZE_T
-#ifdef _MSC_VER
-#include <BaseTsd.h>
+# ifdef _MSC_VER
+#  include <BaseTsd.h>
 typedef SSIZE_T ssize_t;
-#else
-#error ssize_t definition not kown
-#endif
+# else
+#  error ssize_t definition not kown
+# endif
 #endif // PNI_DEFINE_SSIZE_T
 
 #ifdef PNI_DEFINE_STDINT
-#ifdef _MSC_VER
+# ifdef _MSC_VER
 
 typedef signed __int8 int8_t;
 typedef signed __int16 int16_t;
@@ -109,9 +125,9 @@ typedef unsigned __int16 uint16_t;
 typedef unsigned __int32 uint32_t;
 typedef unsigned __int64 uint64_t;
 
-#else // _MSC_VER
-#error stdint.h definitions not kown
-#endif
+# else // _MSC_VER
+#  error stdint.h definitions not kown
+# endif
 #endif // PNI_DEFINE_SSIZE_T
 
 #endif /* type_compat.h */

Modified: qpid/proton/trunk/proton-c/include/proton/types.h
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/types.h?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/types.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/types.h Fri Apr  4 14:52:38 2014
@@ -24,11 +24,7 @@
 
 #include <proton/import_export.h>
 #include <sys/types.h>
-#ifndef __cplusplus
-#include <stdint.h>
-#else
 #include <proton/type_compat.h>
-#endif
 
 /**
  * @file

Modified: qpid/proton/trunk/proton-c/src/tests/parse-url.c
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/tests/parse-url.c?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/tests/parse-url.c (original)
+++ qpid/proton/trunk/proton-c/src/tests/parse-url.c Fri Apr  4 14:52:38 2014
@@ -20,11 +20,7 @@
  */
 
 #include <stdarg.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#else
 #include <proton/type_compat.h>
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

Modified: qpid/proton/trunk/proton-c/src/util.c
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/util.c?rev=1584732&r1=1584731&r2=1584732&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/util.c (original)
+++ qpid/proton/trunk/proton-c/src/util.c Fri Apr  4 14:52:38 2014
@@ -23,12 +23,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#ifndef __cplusplus
-#include <stdint.h>
-#include <stdbool.h>
-#else
 #include <proton/type_compat.h>
-#endif
 #include <ctype.h>
 #include <string.h>
 #include <proton/error.h>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to