Open topolarity opened 5 months ago
NgSpice has a habit of establishing most enum-like constants with #define: https://github.com/imr/ngspice/blob/902a62d2f442a1d8322ae4fcad35c143c7a14561/src/include/ngspice/noisedef.h#L72-L74
#define
but then occasionally introducing an enum { ... } with the same names wrapped in an ifdef guard: https://github.com/imr/ngspice/blob/902a62d2f442a1d8322ae4fcad35c143c7a14561/src/include/ngspice/acdefs.h#L29-L35
enum { ... }
Example:
// test1.h #ifndef TEST_H_ #define TEST_H_ enum { DECADE = 1, OCTAVE, LINEAR, }; #endif // TEST_H_
// test2.h #ifndef TEST_H_ #define DECADE 1 #endif
result:
module TestModule const __JL_Ctag_1 = UInt32 const DECADE = 1 % UInt32 const OCTAVE = 2 % UInt32 const LINEAR = 3 % UInt32 const DECADE = 1 # ... end # module
It would be nice if Clang.jl either:
As a workaround, it does work if I use a wrapper header:
// wrapper.h #include "test1.h" #include "test2.h"
and translate only that
does it work if you pass a macro-define compiler flag to args?
args
NgSpice has a habit of establishing most enum-like constants with
#define
: https://github.com/imr/ngspice/blob/902a62d2f442a1d8322ae4fcad35c143c7a14561/src/include/ngspice/noisedef.h#L72-L74but then occasionally introducing an
enum { ... }
with the same names wrapped in an ifdef guard: https://github.com/imr/ngspice/blob/902a62d2f442a1d8322ae4fcad35c143c7a14561/src/include/ngspice/acdefs.h#L29-L35Example:
result:
It would be nice if Clang.jl either:
#define
across header files so that the duplicate enum definition is not parsed, OR#define
constants, since their definitions are compatible up to a difference of integer type