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

alignof applied to an expression is a GNU extension #5

Closed
alexpacini opened this issue Feb 4, 2020 · 2 comments
Closed

alignof applied to an expression is a GNU extension #5

alexpacini opened this issue Feb 4, 2020 · 2 comments

Comments

@alexpacini
Copy link

My gcc compiler gives me this warning:

'_Alignof' applied to an expression is a GNU extension [-Wgnu-alignof-expression]

The alignof is used for example in:

void pbtools_decoder_read_string(struct pbtools_decoder_t *self_p,
                                 int wire_type,
                                 char **value_pp)
{
    uint64_t size;

    size = decoder_read_length_delimited(self_p, wire_type);
    *value_pp = decoder_heap_alloc(self_p,
                                   size + 1,
                                   alignof(**value_pp) );

    if (*value_pp == NULL) {
        return;
    }

    decoder_read(self_p, (uint8_t *)*value_pp, size);
    (*value_pp)[size] = '\0';
}

If I change it to __alignof__ (https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzarg/alignof.htm) this warning disappears.

@eerimoq
Copy link
Owner

eerimoq commented Feb 4, 2020

Try release 0.29.1, available on PyPI. Clang no longer warns about using the GNU extension. Let me know if your compiler still complains.

@alexpacini
Copy link
Author

Fixed, gcc stopped complaining.

Thanks!

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