Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__attribute__((__packed__)); bitfields #188

Open
tmamic opened this issue Feb 27, 2020 · 2 comments
Open

__attribute__((__packed__)); bitfields #188

tmamic opened this issue Feb 27, 2020 · 2 comments

Comments

@tmamic
Copy link

tmamic commented Feb 27, 2020

Compiler options specified using attributes cause a parse error at parentheses after __attribute__. Cutout of code where problem occured:

typedef struct __attribute__ ((__packed__)) {
    symbol_func_type symbol_type    : 3;
    uint8_t unused                  : 1;
    symbol_data_type data_type      : 4;
}symbol_metadata;
@btj
Copy link
Member

btj commented Feb 27, 2020

Yes. VeriFast doesn't currently support the __attribute__(...) syntax. It also doesn't currently support bitfields. :-(

@btj btj changed the title Compiler options crash the parser __attribute__((__packed__)); bitfields Feb 27, 2020
@btj
Copy link
Member

btj commented Nov 27, 2020

BTW: You can (sort of) work around these issues using the preprocessor:

typedef struct VFIGNORE(__attribute__ ((__packed__))) {
    symbol_func_type symbol_type    VFIGNORE(: 3);
    uint8_t unused                  VFIGNORE(: 1);
    symbol_data_type data_type      VFIGNORE(: 4);
}symbol_metadata;

where you define VFIGNORE as

#define VFIGNORE(x) x

when compiling and

#define VFIGNORE(x)

when verifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants