JuliaInterop / Clang.jl

C binding generator and Julia interface to libclang
https://juliainterop.github.io/Clang.jl/
MIT License
217 stars 68 forks source link

Add support for function-like macros in the auditors sanity checks #500

Closed JamesWrigley closed 3 weeks ago

JamesWrigley commented 3 weeks ago

Fixes #499. The problem is that in one of the headers there are macros with the same names as struct types, e.g.:

// Line 29
#define lxb_css_syntax_token_delim(token) ((lxb_css_syntax_token_delim_t *) (token))

// Line 139
typedef struct lxb_css_syntax_token_delim {
    lxb_css_syntax_token_base_t base;
    lxb_char_t                  character;
}
lxb_css_syntax_token_delim_t;

We already check for these kinds of conflicts between structs and functions, but not structs and macro-like functions so the auditor failed. I think this ought to be fixed upstream by changing the struct definitions to use untagged structs like so:

typedef struct {
    lxb_css_syntax_token_base_t base;
    lxb_char_t                  character;
}
lxb_css_syntax_token_delim_t;
Gnimuc commented 3 weeks ago

LGTM.

Gnimuc commented 3 weeks ago

cc @MichaelHatherly

MichaelHatherly commented 3 weeks ago

Thanks @JamesWrigley.