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 {
};
// Pyston change: hacks to allow C++ features
#ifndef __cplusplus
#ifndef _PYSTON_API
typedef struct _object PyObject;
typedef struct _varobject PyVarObject;
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
......@@ -323,7 +323,7 @@ typedef struct {
// Pyston change: hacks to allow C++ features
#ifndef __cplusplus
#ifndef _PYSTON_API
typedef struct _typeobject PyTypeObject;
#else
namespace pyston {
......@@ -826,7 +826,7 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force) PYSTON_NOEXCEPT;
#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
* and tp_dealloc implementatons.
......@@ -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: */
// Pyston change: made these noops as well
#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
......
......@@ -7,10 +7,21 @@
#include <stdint.h>
#ifdef __cplusplus
#if __cplusplus > 199711L
#define PYSTON_NOEXCEPT noexcept
#else
#define PYSTON_NOEXCEPT
#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
......
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