mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 13:19:54 +00:00
Fix R_PACKED() macro usage (#16571)
This commit is contained in:
parent
09cc1b670a
commit
69ad1aeffe
@ -331,6 +331,26 @@ You may use directory-local variables by putting
|
||||
|
||||
into `.dir-locals.el`.
|
||||
|
||||
## Packed structures
|
||||
|
||||
Due to the various differences between platforms and compilers radare2
|
||||
has a special helper macro - `R_PACKED()`. Instead of non-portable
|
||||
`#pragma pack` or `__attribute__((packed))` it is advised to use this macro
|
||||
instead. To wrap the code inside of it you just need to write:
|
||||
```c
|
||||
R_PACKED (union mystruct {
|
||||
int a;
|
||||
char b;
|
||||
})
|
||||
```
|
||||
or in case of typedef:
|
||||
```c
|
||||
R_PACKED (typedef structmystruct {
|
||||
int a;
|
||||
char b;
|
||||
})
|
||||
```
|
||||
|
||||
## Modules
|
||||
|
||||
The radare2 code base is modularized into different libraries that are
|
||||
|
@ -47,7 +47,7 @@ typedef struct LE_entry_bundle_header_s {
|
||||
#define ENTRY_EXPORTED 0x01
|
||||
#define ENTRY_PARAM_COUNT_MASK 0xF8
|
||||
|
||||
typedef R_PACKED (union LE_entry_bundle_entry_u {
|
||||
R_PACKED (typedef union LE_entry_bundle_entry_u {
|
||||
R_PACKED (struct {
|
||||
ut8 flags; // First bit set if exported, mask with 0xF8 to get parameters count
|
||||
ut16 offset; // This is the offset in the object for the entry point defined at this ordinal number.
|
||||
|
@ -13,7 +13,7 @@ typedef double ft64;
|
||||
#define WIRE_END_GRP 4 // groups (deprecated)
|
||||
#define WIRE_32_BIT 5 // fixed32, sfixed32, float
|
||||
|
||||
typedef R_PACKED (struct _proto_head {
|
||||
R_PACKED (typedef struct _proto_head {
|
||||
ut8 wire : 3;
|
||||
ut8 number : 5;
|
||||
}) proto_head_t;
|
||||
|
Loading…
Reference in New Issue
Block a user