On Mon, Oct 27, 2014 at 12:37 PM, Anton Lundin <[email protected]> wrote:
>
> -#define READ_SETTING(_OSTC3_SETTING, _DEVICE_DETAIL) \
> +#define READ_SETTING(_OSTC3_SETTING, _DEVICE_DETAIL); \

That extra ';' as the first token in the macro definition seems entirely broken.

>                         rc = hw_ostc3_device_config_read(m_data->device, 
> _OSTC3_SETTING, uData, sizeof(uData)); \
>                         if (rc == DC_STATUS_SUCCESS) \
>                                 m_deviceDetails->_DEVICE_DETAIL(uData[0]);

I'd also suggest enclosing it all in a "do { } while (0)" (*without* a
semicolon at the end - the final semicolon should come from the user),
because otherwise

    if (x)
        READ_SETTING(..)
    else
        READ_SETTING(..);

ends up parsing cleanly by the compiler, but doing completely bogus
crap (the "else" ends up pairing with the "if" inside the macro,
instead of the "if" in the code).

                 Linus
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to