Commit 09b408ac authored by Kevin Modzelewski's avatar Kevin Modzelewski

Support C++ extensions that are not C++11

parent 45c15d87
...@@ -117,7 +117,7 @@ struct _varobject { ...@@ -117,7 +117,7 @@ struct _varobject {
}; };
// Pyston change: hacks to allow C++ features // Pyston change: hacks to allow C++ features
#ifndef __cplusplus #ifndef _PYSTON_API
typedef struct _object PyObject; typedef struct _object PyObject;
typedef struct _varobject PyVarObject; typedef struct _varobject PyVarObject;
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
...@@ -323,7 +323,7 @@ typedef struct { ...@@ -323,7 +323,7 @@ typedef struct {
// Pyston change: hacks to allow C++ features // Pyston change: hacks to allow C++ features
#ifndef __cplusplus #ifndef _PYSTON_API
typedef struct _typeobject PyTypeObject; typedef struct _typeobject PyTypeObject;
#else #else
namespace pyston { namespace pyston {
...@@ -826,7 +826,7 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force) PYSTON_NOEXCEPT; ...@@ -826,7 +826,7 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force) PYSTON_NOEXCEPT;
#define Py_INCREF(op) ((void)(op)) #define Py_INCREF(op) ((void)(op))
#define Py_DECREF(op) asm volatile("" : : "X"(op)) #define Py_DECREF(op) __asm volatile("" : : "X"(op))
/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear /* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
* and tp_dealloc implementatons. * and tp_dealloc implementatons.
...@@ -874,7 +874,7 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force) PYSTON_NOEXCEPT; ...@@ -874,7 +874,7 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force) PYSTON_NOEXCEPT;
/* Macros to use in case the object pointer may be NULL: */ /* Macros to use in case the object pointer may be NULL: */
// Pyston change: made these noops as well // Pyston change: made these noops as well
#define Py_XINCREF(op) ((void)(op)) #define Py_XINCREF(op) ((void)(op))
#define Py_XDECREF(op) asm volatile("" : : "X"(op)) #define Py_XDECREF(op) __asm volatile("" : : "X"(op))
/* /*
These are provided as conveniences to Python runtime embedders, so that These are provided as conveniences to Python runtime embedders, so that
......
...@@ -7,10 +7,21 @@ ...@@ -7,10 +7,21 @@
#include <stdint.h> #include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus > 199711L
#define PYSTON_NOEXCEPT noexcept #define PYSTON_NOEXCEPT noexcept
#else #else
#define PYSTON_NOEXCEPT #define PYSTON_NOEXCEPT
#endif #endif
#else
#define PYSTON_NOEXCEPT
#endif
// HACK: we should set this manually rather than cluing off of the C++ version
#ifdef __cplusplus
#if __cplusplus > 199711L
#define _PYSTON_API
#endif
#endif
#define Py_PROTO(x) x #define Py_PROTO(x) x
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment