On Thu, Aug 12, 2010 at 6:47 PM, malc <av1...@comtv.ru> wrote:
> On Thu, 12 Aug 2010, Blue Swirl wrote:
>
>> Add preprocessor rules from libvirt HACKING.
>>
>> Signed-off-by: Blue Swirl <blauwir...@gmail.com>
>> ---
>>  CODING_STYLE |   13 +++++++++++++
>>  1 files changed, 13 insertions(+), 0 deletions(-)
>>
>> diff --git a/CODING_STYLE b/CODING_STYLE
>> index 92036f3..c4c09ab 100644
>> --- a/CODING_STYLE
>> +++ b/CODING_STYLE
>> @@ -79,3 +79,16 @@ and clarity it comes on a line by itself:
>>  Rationale: a consistent (except for functions...) bracing style reduces
>>  ambiguity and avoids needless churn when lines are added or removed.
>>  Furthermore, it is the QEMU coding style.
>> +
>> +5. Preprocessor
>> +
>> +For variadic macros, stick with C99 syntax:
>> +
>> +#define vshPrint(_ctl, ...)   fprintf(stdout, __VA_ARGS__)
>
> _ctl is not used inside the macro expansion, furthermore i'd avoid
> using leading underscore even for macro arguments.

Right. Moreover the macro name is too libvirt'ish.

>> +
>> +Use parenthesis when checking if a macro is defined, and use
>> +indentation to track nesting:
>> +
>> +#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
>> +# define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
>> +#endif

This one is new, current code doesn't use indentation. Maybe it's
better to drop it.

Reply via email to