mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
import-from-c: add more tests
This commit is contained in:
committed by
Pietro Fezzardi
parent
bbb0a00f46
commit
24de1435ff
@@ -13,10 +13,12 @@ sources:
|
||||
- cft-with-complex-arguments
|
||||
- cft-with-no-abi
|
||||
- enum
|
||||
- enum-type-change
|
||||
- enum-with-a-broken-annotation
|
||||
- enum-with-a-non-primitive-underlying-type
|
||||
- enum-with-a-void-underlying-type
|
||||
- enum-without-an-annotation
|
||||
- oversized-field
|
||||
- primitives
|
||||
- rft
|
||||
- rft-with-a-misplaced-stack-argument
|
||||
@@ -45,6 +47,8 @@ sources:
|
||||
- struct-without-the-packed-attribute
|
||||
- struct-with-overlapping-fields
|
||||
- typedef
|
||||
- typedef-to-pointer
|
||||
- typedef-to-value
|
||||
- union
|
||||
|
||||
commands:
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
TypeDefinitions:
|
||||
- Kind: TypedefDefinition
|
||||
ID: 0
|
||||
Name: typedef_a
|
||||
UnderlyingType:
|
||||
Kind: PrimitiveType
|
||||
PrimitiveKind: Signed
|
||||
Size: 2
|
||||
|
||||
- Kind: EnumDefinition
|
||||
ID: 1
|
||||
Name: "my_enum"
|
||||
UnderlyingType:
|
||||
Kind: PrimitiveType
|
||||
PrimitiveKind: Unsigned
|
||||
Size: 8
|
||||
Entries:
|
||||
- Value: 0
|
||||
Name: "none"
|
||||
- Value: 1
|
||||
Name: "positive"
|
||||
- Value: 2
|
||||
Name: "negative"
|
||||
- Value: 3
|
||||
Name: "neutral"
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
//
|
||||
|
||||
enum _ENUM_UNDERLYING(uint64_t) _PACKED my_enum{
|
||||
none = 0x0U,
|
||||
positive = 0x1U,
|
||||
negative = 0x2U,
|
||||
neutral = 0x3U,
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
---
|
||||
Architecture: x86_64
|
||||
DefaultABI: SystemV_x86_64
|
||||
TypeDefinitions:
|
||||
- Kind: TypedefDefinition
|
||||
ID: 0
|
||||
Name: typedef_a
|
||||
UnderlyingType:
|
||||
Kind: PrimitiveType
|
||||
PrimitiveKind: Signed
|
||||
Size: 2
|
||||
|
||||
- Kind: EnumDefinition
|
||||
ID: 1
|
||||
UnderlyingType:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/0-TypedefDefinition"
|
||||
Entries:
|
||||
- Value: 0
|
||||
Name: none
|
||||
- Value: 1
|
||||
Name: positive
|
||||
- Value: 2
|
||||
Name: negative
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
/type-definition/1-EnumDefinition
|
||||
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
//
|
||||
|
||||
struct _PACKED _SIZE(24) my_struct {
|
||||
_STARTS_AT(8)
|
||||
typedef_a field;
|
||||
};
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
New model does not verify: Last field ends outside the struct
|
||||
---
|
||||
ID: 2
|
||||
Kind: StructDefinition
|
||||
Name: my_struct
|
||||
Size: 24
|
||||
Fields:
|
||||
- Offset: 8
|
||||
Name: field
|
||||
Type:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/0-StructDefinition"
|
||||
...
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
TypeDefinitions:
|
||||
- Kind: StructDefinition
|
||||
ID: 0
|
||||
Fields: []
|
||||
Size: 24
|
||||
|
||||
- Kind: TypedefDefinition
|
||||
ID: 1
|
||||
Name: typedef_a
|
||||
UnderlyingType:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/0-StructDefinition"
|
||||
|
||||
- Kind: StructDefinition
|
||||
ID: 2
|
||||
Fields: []
|
||||
Size: 24
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
/type-definition/2-StructDefinition
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
TypeDefinitions:
|
||||
- Kind: StructDefinition
|
||||
ID: 2
|
||||
Name: "my_struct"
|
||||
Size: 24
|
||||
# The leading $ means that the size of the Fields list must match
|
||||
$Fields:
|
||||
- Offset: 8
|
||||
Name: "field"
|
||||
Type:
|
||||
Kind: PointerType
|
||||
PointerSize: 8
|
||||
PointeeType:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/0-StructDefinition"
|
||||
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
//
|
||||
|
||||
struct _PACKED _SIZE(24) my_struct {
|
||||
_STARTS_AT(8)
|
||||
typedef_a field;
|
||||
};
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
Architecture: x86_64
|
||||
DefaultABI: SystemV_x86_64
|
||||
TypeDefinitions:
|
||||
- Kind: StructDefinition
|
||||
ID: 0
|
||||
Size: 8
|
||||
Fields:
|
||||
- Offset: 0
|
||||
Name: pointer
|
||||
Type:
|
||||
Kind: PointerType
|
||||
PointerSize: 8
|
||||
PointeeType:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/2-StructDefinition"
|
||||
|
||||
- Kind: TypedefDefinition
|
||||
ID: 1
|
||||
Name: typedef_a
|
||||
UnderlyingType:
|
||||
Kind: PointerType
|
||||
PointerSize: 8
|
||||
PointeeType:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/0-StructDefinition"
|
||||
|
||||
- Kind: StructDefinition
|
||||
ID: 2
|
||||
Fields: []
|
||||
Size: 24
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
/type-definition/2-StructDefinition
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
TypeDefinitions:
|
||||
- Kind: StructDefinition
|
||||
ID: 2
|
||||
Name: "my_struct"
|
||||
Size: 24
|
||||
# The leading $ means that the size of the Fields list must match
|
||||
$Fields:
|
||||
- Offset: 8
|
||||
Name: "field"
|
||||
Type:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/1-TypedefDefinition"
|
||||
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
//
|
||||
|
||||
struct _PACKED _SIZE(24) my_struct {
|
||||
_STARTS_AT(8)
|
||||
typedef_a field;
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
Architecture: x86_64
|
||||
DefaultABI: SystemV_x86_64
|
||||
TypeDefinitions:
|
||||
- Kind: StructDefinition
|
||||
ID: 0
|
||||
Size: 8
|
||||
Fields:
|
||||
- Offset: 0
|
||||
Name: pointer
|
||||
Type:
|
||||
Kind: PointerType
|
||||
PointerSize: 8
|
||||
PointeeType:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/2-StructDefinition"
|
||||
|
||||
- Kind: TypedefDefinition
|
||||
ID: 1
|
||||
Name: typedef_a
|
||||
UnderlyingType:
|
||||
Kind: DefinedType
|
||||
Definition: "/TypeDefinitions/0-StructDefinition"
|
||||
|
||||
- Kind: StructDefinition
|
||||
ID: 2
|
||||
Fields: []
|
||||
Size: 24
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
|
||||
/type-definition/2-StructDefinition
|
||||
Reference in New Issue
Block a user