ffi.include() breaks when both including and defining anonymous enum
Created originally on Bitbucket by Anonymous
minbug.h:
#!c
enum {
a = 1,
b = 2,
c = 3
}
enum {
d = 4,
e = 5,
f = 6
}
minbug1.py:
#!python
from cffi import FFI
ffi = FFI()
ffi.set_source("minbug1",
"""
#include "minbug.h"
""")
ffi.cdef("""
enum {
a = 1,
b = 2,
c = 3
};
""")
minbug2.py:
#!python
from cffi import FFI
from minbug1 import ffi as ffi1
ffi = FFI()
ffi.set_source("minbug2",
"""
#include "minbug.h"
""")
ffi.include(ffi1)
ffi.cdef("""
enum {
d = 4,
e = 5,
f = 6
};
""")
Running minbug2.py gives the error "multiple declarations of anonymous $enum_$1".
This bug also happens if the enums come from two different sources. Defining both enums inside of one cdef works fine.