On Mon, Oct 27, 2014 at 02:13:54PM -0700, Linus Torvalds wrote: > On Mon, Oct 27, 2014 at 12:37 PM, Anton Lundin <gla...@acc.umu.se> 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).
Needless to say, I agree with both statements. What the heck is that first semicolon for, Anton? /D _______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface