[issue23644] g++ module compile fails with ‘_Atomic’ does not name a type

2015-03-16 Thread Leonardo Bianconi

Leonardo Bianconi added the comment:

@haypo

For adding compatibility for atomics based on @Joshua.J.Cogliati change, I 
propose:

#ifndef Py_LIMITED_API
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H

#include dynamic_annotations.h

#include pyconfig.h

#if defined(HAVE_STD_ATOMIC)
#ifdef __cplusplus
#include atomic
#define _Atomic(T) atomicT
using namespace std;
#else
#include stdatomic.h
#endif
#endif

#ifdef __cplusplus
extern C {
#endif


/* This is modeled after the atomics interface from C1x, according to
 * the draft at
 * http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf.
 * Operations and types are named the same except with a _Py_ prefix
 * and have the same semantics.
 *
 * Beware, the implementations here are deep magic.
 */

#if defined(HAVE_STD_ATOMIC)

typedef enum _Py_memory_order {
_Py_memory_order_relaxed = memory_order_relaxed,
_Py_memory_order_acquire = memory_order_acquire,
_Py_memory_order_release = memory_order_release,
_Py_memory_order_acq_rel = memory_order_acq_rel,
_Py_memory_order_seq_cst = memory_order_seq_cst
} _Py_memory_order;

typedef struct _Py_atomic_address {
_Atomic (void) *_value;
} _Py_atomic_address;

typedef struct _Py_atomic_int {
atomic_int _value;
} _Py_atomic_int;


... (rest same)

--
keywords: +patch
Added file: http://bugs.python.org/file38508/atomicfix.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23644
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23644] g++ module compile fails with ‘_Atomic’ does not name a type

2015-03-16 Thread Leonardo Bianconi

Leonardo Bianconi added the comment:

 #define _Atomic(T) std::atomicT
Does not work, since there are definitions like memory_order_relaxed that are 
in std.

I tested the other one, and it works fine:
#ifdef __cplusplus
extern C {
#if defined(HAVE_STD_ATOMIC)
using namespace std;
#endif
#endif

@haypo, what do you think?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23644
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22038] Implement atomic operations on non-x86 platforms

2015-03-12 Thread Leonardo Bianconi

Changes by Leonardo Bianconi leonardo.bianc...@eldorado.org.br:


--
nosy: +lbianc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22038
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23644] swig compile fails with ‘_Atomic’ does not name a type

2015-03-12 Thread Leonardo Bianconi

Changes by Leonardo Bianconi leonardo.bianc...@eldorado.org.br:


--
nosy: +lbianc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23644
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com