Add tests for expressions like (0 << SHIFT) | BOOL
Fixes https://github.com/eqrion/cbindgen/issues/412
This commit is contained in:
parent
df347d984a
commit
e0fe4e4c44
@ -21,8 +21,16 @@
|
||||
|
||||
#define QUOTE '\''
|
||||
|
||||
#define SHIFT 3
|
||||
|
||||
#define TAB '\t'
|
||||
|
||||
#define XBOOL 1
|
||||
|
||||
#define XFALSE ((0 << SHIFT) | XBOOL)
|
||||
|
||||
#define XTRUE (1 << (SHIFT | XBOOL))
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
typedef struct Foo {
|
||||
|
@ -21,8 +21,16 @@
|
||||
|
||||
#define QUOTE '\''
|
||||
|
||||
#define SHIFT 3
|
||||
|
||||
#define TAB '\t'
|
||||
|
||||
#define XBOOL 1
|
||||
|
||||
#define XFALSE ((0 << SHIFT) | XBOOL)
|
||||
|
||||
#define XTRUE (1 << (SHIFT | XBOOL))
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
typedef struct Foo {
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#define PREFIX_LEN 42
|
||||
|
||||
#define PREFIX_X (42 << 42)
|
||||
|
||||
#define PREFIX_Y (PREFIX_X + PREFIX_X)
|
||||
|
||||
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
|
||||
|
||||
typedef int32_t PREFIX_ValuedLenArray[42];
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#define PREFIX_LEN 42
|
||||
|
||||
#define PREFIX_X (42 << 42)
|
||||
|
||||
#define PREFIX_Y (PREFIX_X + PREFIX_X)
|
||||
|
||||
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
|
||||
|
||||
typedef int32_t PREFIX_ValuedLenArray[42];
|
||||
|
@ -21,8 +21,16 @@
|
||||
|
||||
#define QUOTE '\''
|
||||
|
||||
#define SHIFT 3
|
||||
|
||||
#define TAB '\t'
|
||||
|
||||
#define XBOOL 1
|
||||
|
||||
#define XFALSE ((0 << SHIFT) | XBOOL)
|
||||
|
||||
#define XTRUE (1 << (SHIFT | XBOOL))
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
typedef struct {
|
||||
|
@ -21,8 +21,16 @@
|
||||
|
||||
#define QUOTE '\''
|
||||
|
||||
#define SHIFT 3
|
||||
|
||||
#define TAB '\t'
|
||||
|
||||
#define XBOOL 1
|
||||
|
||||
#define XFALSE ((0 << SHIFT) | XBOOL)
|
||||
|
||||
#define XTRUE (1 << (SHIFT | XBOOL))
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
typedef struct {
|
||||
|
@ -21,8 +21,16 @@ static const int8_t POS_ONE = 1;
|
||||
|
||||
static const uint32_t QUOTE = '\'';
|
||||
|
||||
static const int64_t SHIFT = 3;
|
||||
|
||||
static const uint32_t TAB = '\t';
|
||||
|
||||
static const int64_t XBOOL = 1;
|
||||
|
||||
static const int64_t XFALSE = ((0 << SHIFT) | XBOOL);
|
||||
|
||||
static const int64_t XTRUE = (1 << (SHIFT | XBOOL));
|
||||
|
||||
static const float ZOM = 3.14;
|
||||
|
||||
struct Foo {
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#define PREFIX_LEN 42
|
||||
|
||||
#define PREFIX_X (42 << 42)
|
||||
|
||||
#define PREFIX_Y (PREFIX_X + PREFIX_X)
|
||||
|
||||
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
|
||||
|
||||
typedef int32_t PREFIX_ValuedLenArray[42];
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#define PREFIX_LEN 42
|
||||
|
||||
#define PREFIX_X (42 << 42)
|
||||
|
||||
#define PREFIX_Y (PREFIX_X + PREFIX_X)
|
||||
|
||||
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
|
||||
|
||||
typedef int32_t PREFIX_ValuedLenArray[42];
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
static const int32_t PREFIX_LEN = 42;
|
||||
|
||||
static const int64_t PREFIX_X = (42 << 42);
|
||||
|
||||
static const int64_t PREFIX_Y = (PREFIX_X + PREFIX_X);
|
||||
|
||||
using PREFIX_NamedLenArray = int32_t[PREFIX_LEN];
|
||||
|
||||
using PREFIX_ValuedLenArray = int32_t[42];
|
||||
|
@ -21,8 +21,16 @@
|
||||
|
||||
#define QUOTE '\''
|
||||
|
||||
#define SHIFT 3
|
||||
|
||||
#define TAB '\t'
|
||||
|
||||
#define XBOOL 1
|
||||
|
||||
#define XFALSE ((0 << SHIFT) | XBOOL)
|
||||
|
||||
#define XTRUE (1 << (SHIFT | XBOOL))
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
struct Foo {
|
||||
|
@ -21,8 +21,16 @@
|
||||
|
||||
#define QUOTE '\''
|
||||
|
||||
#define SHIFT 3
|
||||
|
||||
#define TAB '\t'
|
||||
|
||||
#define XBOOL 1
|
||||
|
||||
#define XFALSE ((0 << SHIFT) | XBOOL)
|
||||
|
||||
#define XTRUE (1 << (SHIFT | XBOOL))
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
struct Foo {
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#define PREFIX_LEN 42
|
||||
|
||||
#define PREFIX_X (42 << 42)
|
||||
|
||||
#define PREFIX_Y (PREFIX_X + PREFIX_X)
|
||||
|
||||
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
|
||||
|
||||
typedef int32_t PREFIX_ValuedLenArray[42];
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#define PREFIX_LEN 42
|
||||
|
||||
#define PREFIX_X (42 << 42)
|
||||
|
||||
#define PREFIX_Y (PREFIX_X + PREFIX_X)
|
||||
|
||||
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
|
||||
|
||||
typedef int32_t PREFIX_ValuedLenArray[42];
|
||||
|
@ -15,6 +15,12 @@ const DONT_EXPORT_PRIV: i32 = 30;
|
||||
pub const POS_ONE: i8 = 1;
|
||||
pub const NEG_ONE: i8 = -1;
|
||||
|
||||
// Some doc for shifting //
|
||||
pub const SHIFT: i64 = 3;
|
||||
pub const XBOOL: i64 = 1;
|
||||
pub const XFALSE: i64 = (0 << SHIFT) | XBOOL;
|
||||
pub const XTRUE: i64 = 1 << (SHIFT | XBOOL);
|
||||
|
||||
#[repr(C)]
|
||||
struct Foo {
|
||||
x: [i32; FOO],
|
||||
|
@ -12,3 +12,9 @@ pub enum AbsoluteFontWeight {
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn root(x: NamedLenArray, y: ValuedLenArray, z: AbsoluteFontWeight) { }
|
||||
|
||||
#[no_mangle]
|
||||
pub const X: i64 = 42 << 42;
|
||||
|
||||
#[no_mangle]
|
||||
pub const Y: i64 = X + X;
|
||||
|
Loading…
x
Reference in New Issue
Block a user