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

2015-03-12 Thread Joshua J Cogliati

New submission from Joshua J Cogliati:

The attached example works fine with Python 3.4.2, but fails with Python 
3.5.0a1 and 3.5.0a2

I am using:
$ g++ --version
g++ (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
$ swig -version

SWIG Version 3.0.5

Compiled with g++ [x86_64-redhat-linux-gnu]

Configured options: +pcre
$ python3 --version
Python 3.5.0a2



The output of trying the makefile with Python 3.5.0a2 is:

$ make
swig -c++ -python -py3 example.i
g++ -g -fPIC -c example.cxx example_wrap.cxx 
-I/local/python350a2/include/python3.5m -I/local/python350a2/include/python3.5m
In file included from /local/python350a2/include/python3.5m/pyatomic.h:10:0,
 from /local/python350a2/include/python3.5m/Python.h:53,
 from example_wrap.cxx:154:
/usr/include/c++/4.9.2/exception:161:34: error: missing binary operator before 
token (
 #if (__cplusplus = 201103L)  (ATOMIC_INT_LOCK_FREE  1)
  ^
In file included from /local/python350a2/include/python3.5m/pyatomic.h:10:0,
 from /local/python350a2/include/python3.5m/Python.h:53,
 from example_wrap.cxx:154:
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:40:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic _Bool atomic_bool;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:41:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic char atomic_char;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:42:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic signed char atomic_schar;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:43:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic unsigned char atomic_uchar;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:44:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic short atomic_short;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:45:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic unsigned short atomic_ushort;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:46:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic int atomic_int;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:47:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic unsigned int atomic_uint;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:48:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic long atomic_long;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:49:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic unsigned long atomic_ulong;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:50:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic long long atomic_llong;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:51:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic unsigned long long atomic_ullong;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:52:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __CHAR16_TYPE__ atomic_char16_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:53:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __CHAR32_TYPE__ atomic_char32_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:54:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __WCHAR_TYPE__ atomic_wchar_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:55:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __INT_LEAST8_TYPE__ atomic_int_least8_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:56:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __UINT_LEAST8_TYPE__ atomic_uint_least8_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:57:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __INT_LEAST16_TYPE__ atomic_int_least16_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:58:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __UINT_LEAST16_TYPE__ atomic_uint_least16_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:59:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __INT_LEAST32_TYPE__ atomic_int_least32_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:60:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __UINT_LEAST32_TYPE__ atomic_uint_least32_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:61:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __INT_LEAST64_TYPE__ atomic_int_least64_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:62:9: error: 
‘_Atomic’ does not name a type
 typedef _Atomic __UINT_LEAST64_TYPE__ atomic_uint_least64_t;
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stdatomic.h:63:9: error: 
‘_Atomic’ 

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

2015-03-12 Thread STINNER Victor

STINNER Victor added the comment:

The problem is more general than Python: #include stdatomic.h fails in C++. 
Try to compiled atomic.cpp with g++, you will get the same error.

The following bug report in the glibc has been closed as WONTFIX:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932

It suggests to use the following code:

#ifdef __cplusplus
#include atomic
using namespace std;
#else
#include stdatomic.h
#endif

I don't know if it works.

--
Added file: http://bugs.python.org/file38458/atomic.cpp

___
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] swig compile fails with ‘_Atomic’ does not name a type

2015-03-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset eb48295e1f8b by Victor Stinner in branch 'default':
Issue #23644, #22038: Move #include stdatomic.c inside the extern C { ... }
https://hg.python.org/cpython/rev/eb48295e1f8b

--
nosy: +python-dev

___
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] swig compile fails with ‘_Atomic’ does not name a type

2015-03-12 Thread Joshua J Cogliati

Joshua J Cogliati added the comment:

I have:
/local/python_fix/include/python3.5m/pyatomic.h
#ifndef Py_LIMITED_API
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H

#include dynamic_annotations.h

#include pyconfig.h

#ifdef __cplusplus
extern C {
#endif

#if defined(HAVE_STD_ATOMIC)
#include stdatomic.h
#endif

...

and still get:
In file included from /local/python_fix/include/python3.5m/pyatomic.h:14:0,
 from /local/python_fix/include/python3.5m/Python.h:53,
 from example_wrap.cxx:154:
/usr/include/c++/4.9.2/exception:161:34: error: missing binary operator before 
token (
 #if (__cplusplus = 201103L)  (ATOMIC_INT_LOCK_FREE  1)


So the bug still seems to be there.

--

___
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] swig compile fails with ‘_Atomic’ does not name a type

2015-03-12 Thread STINNER Victor

STINNER Victor added the comment:

_Atomic was added by the issue #22038.

--
nosy: +gustavotemple, haypo

___
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] swig compile fails with ‘_Atomic’ does not name a type

2015-03-12 Thread STINNER Victor

STINNER Victor added the comment:

Can you please try with the latest development version?

--

___
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] swig compile fails with ‘_Atomic’ does not name a type

2015-03-12 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +Vitor.de.Lima

___
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] swig compile fails with ‘_Atomic’ does not name a type

2015-03-12 Thread Gustavo Frederico Temple Pedrosa

Gustavo Frederico Temple Pedrosa added the comment:

@haypo, @lbianc will investigate this issue.

--

___
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] 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