qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/5] HACKING: add preprocessor rules
@ 2010-08-15 17:50 Blue Swirl
  2010-08-15 21:27 ` [Qemu-devel] " Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2010-08-15 17:50 UTC (permalink / raw)
  To: qemu-devel

Add a new file, HACKING, in order to collect recurring
issues with submitted patches.

Start with preprocessor rules, adapted from libvirt HACKING.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 HACKING |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
 create mode 100644 HACKING

diff --git a/HACKING b/HACKING
new file mode 100644
index 0000000..e60aa48
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,6 @@
+1. Preprocessor
+
+For variadic macros, stick with C99 syntax:
+
+#define DPRINTF(fmt, ...)                                       \
+    do { printf("IRQ: " fmt, ## __VA_ARGS__); } while (0)
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] Re: [PATCH 1/5] HACKING: add preprocessor rules
  2010-08-15 17:50 [Qemu-devel] [PATCH 1/5] HACKING: add preprocessor rules Blue Swirl
@ 2010-08-15 21:27 ` Andreas Schwab
  2010-08-16 18:05   ` Blue Swirl
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2010-08-15 21:27 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

Blue Swirl <blauwirbel@gmail.com> writes:

> +For variadic macros, stick with C99 syntax:
> +
> +#define DPRINTF(fmt, ...)                                       \
> +    do { printf("IRQ: " fmt, ## __VA_ARGS__); } while (0)

That's not C99 syntax, the combination with ## is a gcc extension.  In
C99 you cannot have an empty __VA_ARGS__.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] Re: [PATCH 1/5] HACKING: add preprocessor rules
  2010-08-15 21:27 ` [Qemu-devel] " Andreas Schwab
@ 2010-08-16 18:05   ` Blue Swirl
  2010-08-16 18:32     ` Anthony Liguori
  0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2010-08-16 18:05 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: qemu-devel

On Sun, Aug 15, 2010 at 9:27 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Blue Swirl <blauwirbel@gmail.com> writes:
>
>> +For variadic macros, stick with C99 syntax:
>> +
>> +#define DPRINTF(fmt, ...)                                       \
>> +    do { printf("IRQ: " fmt, ## __VA_ARGS__); } while (0)
>
> That's not C99 syntax, the combination with ## is a gcc extension.  In
> C99 you cannot have an empty __VA_ARGS__.

That's too bad, I picked the example from one of our current macros.
Maybe just s/C99/this/ or perhaps we shouldn't specify any
non-standard syntax.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Re: [PATCH 1/5] HACKING: add preprocessor rules
  2010-08-16 18:05   ` Blue Swirl
@ 2010-08-16 18:32     ` Anthony Liguori
  2010-08-17 17:40       ` Blue Swirl
  0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2010-08-16 18:32 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Andreas Schwab, qemu-devel

On 08/16/2010 01:05 PM, Blue Swirl wrote:
> On Sun, Aug 15, 2010 at 9:27 PM, Andreas Schwab<schwab@linux-m68k.org>  wrote:
>    
>> Blue Swirl<blauwirbel@gmail.com>  writes:
>>
>>      
>>> +For variadic macros, stick with C99 syntax:
>>> +
>>> +#define DPRINTF(fmt, ...)                                       \
>>> +    do { printf("IRQ: " fmt, ## __VA_ARGS__); } while (0)
>>>        
>> That's not C99 syntax, the combination with ## is a gcc extension.  In
>> C99 you cannot have an empty __VA_ARGS__.
>>      
> That's too bad, I picked the example from one of our current macros.
> Maybe just s/C99/this/ or perhaps we shouldn't specify any
> non-standard syntax.
>    

We definitely should discourage the GCC syntax [#define fn(arg...)] as 
it's deprecated by the new C99 syntax.  Very specifically, only the '##' 
is an extension and it's a widely adopted one.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Re: [PATCH 1/5] HACKING: add preprocessor rules
  2010-08-16 18:32     ` Anthony Liguori
@ 2010-08-17 17:40       ` Blue Swirl
  0 siblings, 0 replies; 5+ messages in thread
From: Blue Swirl @ 2010-08-17 17:40 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Andreas Schwab, qemu-devel

On Mon, Aug 16, 2010 at 6:32 PM, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 08/16/2010 01:05 PM, Blue Swirl wrote:
>>
>> On Sun, Aug 15, 2010 at 9:27 PM, Andreas Schwab<schwab@linux-m68k.org>
>>  wrote:
>>
>>>
>>> Blue Swirl<blauwirbel@gmail.com>  writes:
>>>
>>>
>>>>
>>>> +For variadic macros, stick with C99 syntax:
>>>> +
>>>> +#define DPRINTF(fmt, ...)                                       \
>>>> +    do { printf("IRQ: " fmt, ## __VA_ARGS__); } while (0)
>>>>
>>>
>>> That's not C99 syntax, the combination with ## is a gcc extension.  In
>>> C99 you cannot have an empty __VA_ARGS__.
>>>
>>
>> That's too bad, I picked the example from one of our current macros.
>> Maybe just s/C99/this/ or perhaps we shouldn't specify any
>> non-standard syntax.
>>
>
> We definitely should discourage the GCC syntax [#define fn(arg...)] as it's
> deprecated by the new C99 syntax.  Very specifically, only the '##' is an
> extension and it's a widely adopted one.

I'll do s/C99/this C99-like/.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-17 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-15 17:50 [Qemu-devel] [PATCH 1/5] HACKING: add preprocessor rules Blue Swirl
2010-08-15 21:27 ` [Qemu-devel] " Andreas Schwab
2010-08-16 18:05   ` Blue Swirl
2010-08-16 18:32     ` Anthony Liguori
2010-08-17 17:40       ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).