qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
@ 2009-06-20  2:22 m a
  2009-06-20 14:31 ` Anthony Liguori
  2009-06-20 19:16 ` Christoph Hellwig
  0 siblings, 2 replies; 19+ messages in thread
From: m a @ 2009-06-20  2:22 UTC (permalink / raw)
  To: qemu-devel

This patch replaces O_SYNC with O_FSYNC. These two flags do the same 
thing, but only O_FSYNC is available in Mac OS 10.3 and under. It only 
replaces O_SYNC if it doesn't exist. This patch allows the file 
block-raw-posix.c to compile on Mac OS 10.3. This is my first time 
submitting a patch, so there might have been a few mistakes made.

--- block-raw-posix.c	Wed May 20 16:46:58 2009
+++ block-raw-posix (updated).c	Fri Jun 19 22:01:07 2009
@@ -73,6 +73,12 @@
  #define DEBUG_BLOCK_PRINT(formatCstr, args...)
  #endif

+// O_SYNC isn't available on Mac OS 10.3 and under
+// O_SYNC and O_FSYNC do the same thing
+#ifndef O_SYNC
+#define O_SYNC O_FSYNC
+#endif
+
  /* OS X does not have O_DSYNC */
  #ifndef O_DSYNC
  #define O_DSYNC O_SYNC

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20  2:22 [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC m a
@ 2009-06-20 14:31 ` Anthony Liguori
  2009-06-20 18:59   ` Avi Kivity
  2009-06-20 19:16 ` Christoph Hellwig
  1 sibling, 1 reply; 19+ messages in thread
From: Anthony Liguori @ 2009-06-20 14:31 UTC (permalink / raw)
  To: m a; +Cc: qemu-devel

Hi,

m a wrote:
> This patch replaces O_SYNC with O_FSYNC. These two flags do the same 
> thing, but only O_FSYNC is available in Mac OS 10.3 and under. It only 
> replaces O_SYNC if it doesn't exist. This patch allows the file 
> block-raw-posix.c to compile on Mac OS 10.3. This is my first time 
> submitting a patch, so there might have been a few mistakes made.

Please include a Signed-off-by line and use C-style comments instead of 
C++ style comments.  Otherwise, looks good.

Regards,

Anthony Liguori

> --- block-raw-posix.c    Wed May 20 16:46:58 2009
> +++ block-raw-posix (updated).c    Fri Jun 19 22:01:07 2009
> @@ -73,6 +73,12 @@
>  #define DEBUG_BLOCK_PRINT(formatCstr, args...)
>  #endif
>
> +// O_SYNC isn't available on Mac OS 10.3 and under
> +// O_SYNC and O_FSYNC do the same thing
> +#ifndef O_SYNC
> +#define O_SYNC O_FSYNC
> +#endif
> +
>  /* OS X does not have O_DSYNC */
>  #ifndef O_DSYNC
>  #define O_DSYNC O_SYNC
>
>
>
>

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 14:31 ` Anthony Liguori
@ 2009-06-20 18:59   ` Avi Kivity
  2009-06-20 19:03     ` François Revol
  2009-06-20 20:46     ` Anthony Liguori
  0 siblings, 2 replies; 19+ messages in thread
From: Avi Kivity @ 2009-06-20 18:59 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: m a, qemu-devel

On 06/20/2009 05:31 PM, Anthony Liguori wrote:
> Please include a Signed-off-by line and use C-style comments instead 
> of C++ style comments.  Otherwise, looks good.

What do we have against C++ style comments?

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 18:59   ` Avi Kivity
@ 2009-06-20 19:03     ` François Revol
  2009-06-20 19:15       ` Avi Kivity
  2009-06-20 23:25       ` Jamie Lokier
  2009-06-20 20:46     ` Anthony Liguori
  1 sibling, 2 replies; 19+ messages in thread
From: François Revol @ 2009-06-20 19:03 UTC (permalink / raw)
  To: Avi Kivity; +Cc: programmingkidx, qemu-devel

> On 06/20/2009 05:31 PM, Anthony Liguori wrote:
> > Please include a Signed-off-by line and use C-style comments
> > instead
> > of C++ style comments.  Otherwise, looks good.
>
> What do we have against C++ style comments?

They are not valid in C code :P

François.

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 19:03     ` François Revol
@ 2009-06-20 19:15       ` Avi Kivity
  2009-06-20 23:25       ` Jamie Lokier
  1 sibling, 0 replies; 19+ messages in thread
From: Avi Kivity @ 2009-06-20 19:15 UTC (permalink / raw)
  To: François Revol; +Cc: programmingkidx, qemu-devel

On 06/20/2009 10:03 PM, François Revol wrote:
>> On 06/20/2009 05:31 PM, Anthony Liguori wrote:
>>      
>>> Please include a Signed-off-by line and use C-style comments
>>> instead
>>> of C++ style comments.  Otherwise, looks good.
>>>        
>> What do we have against C++ style comments?
>>      
>
> They are not valid in C code :P
>    

I think C99 allows them.  Too bad date-related jokes are forbidden.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20  2:22 [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC m a
  2009-06-20 14:31 ` Anthony Liguori
@ 2009-06-20 19:16 ` Christoph Hellwig
  2009-06-20 23:30   ` Jamie Lokier
  1 sibling, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2009-06-20 19:16 UTC (permalink / raw)
  To: m a; +Cc: qemu-devel

On Fri, Jun 19, 2009 at 10:22:07PM -0400, m a wrote:
> This patch replaces O_SYNC with O_FSYNC. These two flags do the same 
> thing, but only O_FSYNC is available in Mac OS 10.3 and under. It only 
> replaces O_SYNC if it doesn't exist. This patch allows the file 
> block-raw-posix.c to compile on Mac OS 10.3. This is my first time 
> submitting a patch, so there might have been a few mistakes made.

But O_SYNC is a standard posix flag, while O_FSYNC appears to be
a BSD extension.  Also the actual code uses O_DSYNC anyway, which
also is in Posix but not actually natively supported by some OSes,
e.g. Linux (but still provided in libc there).


> --- block-raw-posix.c	Wed May 20 16:46:58 2009
> +++ block-raw-posix (updated).c	Fri Jun 19 22:01:07 2009
> @@ -73,6 +73,12 @@
> 
> +// O_SYNC isn't available on Mac OS 10.3 and under
> +// O_SYNC and O_FSYNC do the same thing
> +#ifndef O_SYNC
> +#define O_SYNC O_FSYNC
> +#endif
> +
>  /* OS X does not have O_DSYNC */
>  #ifndef O_DSYNC
>  #define O_DSYNC O_SYNC

So if the code here is correct and Darwin is the only supported OS where
O_DSYNC is missing we could just replace the O_SYNC in the last line
with O_FSYNC.

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 18:59   ` Avi Kivity
  2009-06-20 19:03     ` François Revol
@ 2009-06-20 20:46     ` Anthony Liguori
  2009-06-21  9:01       ` Avi Kivity
  1 sibling, 1 reply; 19+ messages in thread
From: Anthony Liguori @ 2009-06-20 20:46 UTC (permalink / raw)
  To: Avi Kivity; +Cc: m a, qemu-devel

Avi Kivity wrote:
> On 06/20/2009 05:31 PM, Anthony Liguori wrote:
>> Please include a Signed-off-by line and use C-style comments instead 
>> of C++ style comments.  Otherwise, looks good.
>
> What do we have against C++ style comments?

Just consistency:

anthony@squirrel:~/git/qemu$ grep '//' *.c | wc -l
163
anthony@squirrel:~/git/qemu$ grep '/\*' *.c | wc -l
5642

Nothing personal.  I think the kernel has a policy of C89 comments only.

Regards,

Anthony Liguori

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 19:03     ` François Revol
  2009-06-20 19:15       ` Avi Kivity
@ 2009-06-20 23:25       ` Jamie Lokier
  2009-06-21 10:01         ` Andreas Färber
  1 sibling, 1 reply; 19+ messages in thread
From: Jamie Lokier @ 2009-06-20 23:25 UTC (permalink / raw)
  To: François Revol; +Cc: programmingkidx, Avi Kivity, qemu-devel

François Revol wrote:
> > On 06/20/2009 05:31 PM, Anthony Liguori wrote:
> > > Please include a Signed-off-by line and use C-style comments
> > > instead
> > > of C++ style comments.  Otherwise, looks good.
> >
> > What do we have against C++ style comments?
> 
> They are not valid in C code :P

Wrong.

Valid in GNU C for about 14 years, and ANSI/ISO C for about 10 years...

I'll be surprised if any C compiler used on any open source operating
system, or any major commercial C compiler, doesn't accept them.

Of course I still forbid them in my code too - they look wrong :-)

-- Jamie

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 19:16 ` Christoph Hellwig
@ 2009-06-20 23:30   ` Jamie Lokier
  2009-06-20 23:37     ` Anthony Liguori
  2009-06-21  0:46     ` G 3
  0 siblings, 2 replies; 19+ messages in thread
From: Jamie Lokier @ 2009-06-20 23:30 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: m a, qemu-devel

Christoph Hellwig wrote:
> On Fri, Jun 19, 2009 at 10:22:07PM -0400, m a wrote:
> > This patch replaces O_SYNC with O_FSYNC. These two flags do the same 
> > thing, but only O_FSYNC is available in Mac OS 10.3 and under. It only 
> > replaces O_SYNC if it doesn't exist. This patch allows the file 
> > block-raw-posix.c to compile on Mac OS 10.3. This is my first time 
> > submitting a patch, so there might have been a few mistakes made.
> 
> But O_SYNC is a standard posix flag, while O_FSYNC appears to be
> a BSD extension.  Also the actual code uses O_DSYNC anyway, which
> also is in Posix but not actually natively supported by some OSes,
> e.g. Linux (but still provided in libc there).

If O_FSYNC and O_SYNC do the same thing, and O_SYNC is used anywhere,
there's no harm in this for portability:

    #if !defined(O_SYNC) && defined(O_FSYNC)
    #define O_SYNC O_FSYNC
    #endif

The patch assumes O_FSYNC is defined if O_SYNC isn't, which is wrong.

> >  /* OS X does not have O_DSYNC */
> >  #ifndef O_DSYNC
> >  #define O_DSYNC O_SYNC
> 
> So if the code here is correct and Darwin is the only supported OS where
> O_DSYNC is missing we could just replace the O_SYNC in the last line
> with O_FSYNC.

I agree, though the comment might be misleading, if there's another
supported OS without O_DSYNC.

-- Jamie

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 23:30   ` Jamie Lokier
@ 2009-06-20 23:37     ` Anthony Liguori
  2009-06-21  0:41       ` G 3
  2009-06-21  0:46     ` G 3
  1 sibling, 1 reply; 19+ messages in thread
From: Anthony Liguori @ 2009-06-20 23:37 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: m a, Christoph Hellwig, qemu-devel

Jamie Lokier wrote:
> If O_FSYNC and O_SYNC do the same thing, and O_SYNC is used anywhere,
> there's no harm in this for portability:
>
>     #if !defined(O_SYNC) && defined(O_FSYNC)
>     #define O_SYNC O_FSYNC
>     #endif
>
> The patch assumes O_FSYNC is defined if O_SYNC isn't, which is wrong.
>   

For what this patch is, it really isn't that important IMHO.

This is just a work around for a broken platform.

Regards,

Anthony Liguori

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 23:37     ` Anthony Liguori
@ 2009-06-21  0:41       ` G 3
  2009-06-24 18:27         ` Jamie Lokier
  0 siblings, 1 reply; 19+ messages in thread
From: G 3 @ 2009-06-21  0:41 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel


On Jun 20, 2009, at 7:37 PM, Anthony Liguori wrote:

> Jamie Lokier wrote:
>> If O_FSYNC and O_SYNC do the same thing, and O_SYNC is used anywhere,
>> there's no harm in this for portability:
>>
>>     #if !defined(O_SYNC) && defined(O_FSYNC)
>>     #define O_SYNC O_FSYNC
>>     #endif
>>
>> The patch assumes O_FSYNC is defined if O_SYNC isn't, which is wrong.
>>
>
> For what this patch is, it really isn't that important IMHO.
>
> This is just a work around for a broken platform.
>

Even though you are correct, did you have to add the 'broken platform' 
remark?

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 23:30   ` Jamie Lokier
  2009-06-20 23:37     ` Anthony Liguori
@ 2009-06-21  0:46     ` G 3
  1 sibling, 0 replies; 19+ messages in thread
From: G 3 @ 2009-06-21  0:46 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: qemu-devel


On Jun 20, 2009, at 7:30 PM, Jamie Lokier wrote:

> Christoph Hellwig wrote:
>> On Fri, Jun 19, 2009 at 10:22:07PM -0400, m a wrote:
>>> This patch replaces O_SYNC with O_FSYNC. These two flags do the same
>>> thing, but only O_FSYNC is available in Mac OS 10.3 and under. It 
>>> only
>>> replaces O_SYNC if it doesn't exist. This patch allows the file
>>> block-raw-posix.c to compile on Mac OS 10.3. This is my first time
>>> submitting a patch, so there might have been a few mistakes made.
>>
>> But O_SYNC is a standard posix flag, while O_FSYNC appears to be
>> a BSD extension.  Also the actual code uses O_DSYNC anyway, which
>> also is in Posix but not actually natively supported by some OSes,
>> e.g. Linux (but still provided in libc there).
>
> If O_FSYNC and O_SYNC do the same thing, and O_SYNC is used anywhere,
> there's no harm in this for portability:
>
>     #if !defined(O_SYNC) && defined(O_FSYNC)
>     #define O_SYNC O_FSYNC
>     #endif
>
> The patch assumes O_FSYNC is defined if O_SYNC isn't, which is wrong.
>
>>>  /* OS X does not have O_DSYNC */
>>>  #ifndef O_DSYNC
>>>  #define O_DSYNC O_SYNC
>>
>> So if the code here is correct and Darwin is the only supported OS 
>> where
>> O_DSYNC is missing we could just replace the O_SYNC in the last line
>> with O_FSYNC.
>
> I agree, though the comment might be misleading, if there's another
> supported OS without O_DSYNC.
>
> -- Jamie
>
>

Your logic does make sense. I guess I should have done this instead:

#ifndef O_SYNC
	#ifdef O_FSYNC
		#define O_SYNC 	O_FSYNC
	
	#else
		#define O_SYNC 	0
	
	#endif
#endif

Defining O_SYNC as zero is ok because this flag is 'ORed' with other 
flags. 

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 20:46     ` Anthony Liguori
@ 2009-06-21  9:01       ` Avi Kivity
  0 siblings, 0 replies; 19+ messages in thread
From: Avi Kivity @ 2009-06-21  9:01 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: m a, qemu-devel

On 06/20/2009 11:46 PM, Anthony Liguori wrote:
> Avi Kivity wrote:
>> On 06/20/2009 05:31 PM, Anthony Liguori wrote:
>>> Please include a Signed-off-by line and use C-style comments instead 
>>> of C++ style comments.  Otherwise, looks good.
>>
>> What do we have against C++ style comments?
>
> Just consistency:
>
> anthony@squirrel:~/git/qemu$ grep '//' *.c | wc -l
> 163
> anthony@squirrel:~/git/qemu$ grep '/\*' *.c | wc -l
> 5642
>

Well, consistency trumps convenience.

> Nothing personal.  I think the kernel has a policy of C89 comments only.

This isn't the kernel, we have our own coding style.  But if we don't 
want C++ comments, that's fine.

-- 
error compiling committee.c: too many arguments to function

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-20 23:25       ` Jamie Lokier
@ 2009-06-21 10:01         ` Andreas Färber
  2009-06-24 18:25           ` Jamie Lokier
  0 siblings, 1 reply; 19+ messages in thread
From: Andreas Färber @ 2009-06-21 10:01 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: programmingkidx, François Revol, Avi Kivity, qemu-devel


Am 21.06.2009 um 01:25 schrieb Jamie Lokier:

> François Revol wrote:
>>> On 06/20/2009 05:31 PM, Anthony Liguori wrote:
>>>> Please [...] use C-style comments instead
>>>> of C++ style comments. [...]
>>>
>>> What do we have against C++ style comments?
>>
>> They are not valid in C code :P
>
> Wrong.
>
> Valid in GNU C for about 14 years, and ANSI/ISO C for about 10  
> years...
>
> I'll be surprised if any C compiler used on any open source operating
> system, or any major commercial C compiler, doesn't accept them.

Gladly even ten-year-old GCC 2.95.x supports 'em. But even a recent  
GCC does not when compiled with -ansi, which is why system headers  
still mustn't use them.

Andreas

> Of course I still forbid them in my code too - they look wrong :-)
>
> -- Jamie

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-21 10:01         ` Andreas Färber
@ 2009-06-24 18:25           ` Jamie Lokier
  2009-06-24 18:54             ` Andreas Färber
  0 siblings, 1 reply; 19+ messages in thread
From: Jamie Lokier @ 2009-06-24 18:25 UTC (permalink / raw)
  To: Andreas Färber
  Cc: programmingkidx, François Revol, Avi Kivity, qemu-devel

Andreas Färber wrote:
> 
> Am 21.06.2009 um 01:25 schrieb Jamie Lokier:
> 
> >François Revol wrote:
> >>>On 06/20/2009 05:31 PM, Anthony Liguori wrote:
> >>>>Please [...] use C-style comments instead
> >>>>of C++ style comments. [...]
> >>>
> >>>What do we have against C++ style comments?
> >>
> >>They are not valid in C code :P
> >
> >Wrong.
> >
> >Valid in GNU C for about 14 years, and ANSI/ISO C for about 10  
> >years...
> >
> >I'll be surprised if any C compiler used on any open source operating
> >system, or any major commercial C compiler, doesn't accept them.
> 
> Gladly even ten-year-old GCC 2.95.x supports 'em. But even a recent  
> GCC does not when compiled with -ansi, which is why system headers  
> still mustn't use them.

This is wrong too.  They can be used in system headers.

"gcc -ansi -pedantic -Wall -Werror" accepts C99 comments in system
headers.

It just complains about them in your own code, since you asked it to. :-)

-- Jamie

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-21  0:41       ` G 3
@ 2009-06-24 18:27         ` Jamie Lokier
  0 siblings, 0 replies; 19+ messages in thread
From: Jamie Lokier @ 2009-06-24 18:27 UTC (permalink / raw)
  To: G 3; +Cc: qemu-devel

G 3 wrote:
> Even though you are correct, did you have to add the 'broken platform' 
> remark?

Well, O_SYNC is POSIX so anything which claims to be a unix and
doesn't have O_SYNC is broken :-)

-- Jamie

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-24 18:25           ` Jamie Lokier
@ 2009-06-24 18:54             ` Andreas Färber
  2009-06-24 18:59               ` Filip Navara
  0 siblings, 1 reply; 19+ messages in thread
From: Andreas Färber @ 2009-06-24 18:54 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: programmingkidx, François Revol, Avi Kivity, qemu-devel


Am 24.06.2009 um 20:25 schrieb Jamie Lokier:

> Andreas Färber wrote:
>>
>> Am 21.06.2009 um 01:25 schrieb Jamie Lokier:
>>
>>> François Revol wrote:
>>>>> On 06/20/2009 05:31 PM, Anthony Liguori wrote:
>>>>>> Please [...] use C-style comments instead
>>>>>> of C++ style comments. [...]
>>>>>
>>>>> What do we have against C++ style comments?
>>>>
>>>> They are not valid in C code :P
>>>
>>> Wrong.
>>>
>>> Valid in GNU C for about 14 years, and ANSI/ISO C for about 10
>>> years...
>>>
>>> I'll be surprised if any C compiler used on any open source  
>>> operating
>>> system, or any major commercial C compiler, doesn't accept them.
>>
>> Gladly even ten-year-old GCC 2.95.x supports 'em. But even a recent
>> GCC does not when compiled with -ansi, which is why system headers
>> still mustn't use them.
>
> This is wrong too.  They can be used in system headers.

No, that is wrong. freetype2 definitely complained when Haiku had C99  
comments in its POSIX system headers. ;)

Andreas

> "gcc -ansi -pedantic -Wall -Werror" accepts C99 comments in system
> headers.
>
> It just complains about them in your own code, since you asked it  
> to. :-)
>
> -- Jamie

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-24 18:54             ` Andreas Färber
@ 2009-06-24 18:59               ` Filip Navara
  2009-06-24 19:08                 ` Jamie Lokier
  0 siblings, 1 reply; 19+ messages in thread
From: Filip Navara @ 2009-06-24 18:59 UTC (permalink / raw)
  To: Andreas Färber
  Cc: programmingkidx, François Revol, Avi Kivity, qemu-devel

On Wed, Jun 24, 2009 at 8:54 PM, Andreas Färber<andreas.faerber@web.de> wrote:
>
> Am 24.06.2009 um 20:25 schrieb Jamie Lokier:
>
>> Andreas Färber wrote:
>>>
>>> Am 21.06.2009 um 01:25 schrieb Jamie Lokier:
>>>
>>>> François Revol wrote:
>>>>>>
>>>>>> On 06/20/2009 05:31 PM, Anthony Liguori wrote:
>>>>>>>
>>>>>>> Please [...] use C-style comments instead
>>>>>>> of C++ style comments. [...]
>>>>>>
>>>>>> What do we have against C++ style comments?
>>>>>
>>>>> They are not valid in C code :P
>>>>
>>>> Wrong.
>>>>
>>>> Valid in GNU C for about 14 years, and ANSI/ISO C for about 10
>>>> years...
>>>>
>>>> I'll be surprised if any C compiler used on any open source operating
>>>> system, or any major commercial C compiler, doesn't accept them.
>>>
>>> Gladly even ten-year-old GCC 2.95.x supports 'em. But even a recent
>>> GCC does not when compiled with -ansi, which is why system headers
>>> still mustn't use them.
>>
>> This is wrong too.  They can be used in system headers.
>
> No, that is wrong. freetype2 definitely complained when Haiku had C99
> comments in its POSIX system headers. ;)

#pragma GCC system_header

Best regards,
Filip Navara

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

* Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
  2009-06-24 18:59               ` Filip Navara
@ 2009-06-24 19:08                 ` Jamie Lokier
  0 siblings, 0 replies; 19+ messages in thread
From: Jamie Lokier @ 2009-06-24 19:08 UTC (permalink / raw)
  To: Filip Navara
  Cc: programmingkidx, Andreas Färber, François Revol,
	Avi Kivity, qemu-devel

Filip Navara wrote:
> On Wed, Jun 24, 2009 at 8:54 PM, Andreas Färber<andreas.faerber@web.de> wrote:
> >
> > Am 24.06.2009 um 20:25 schrieb Jamie Lokier:
> >
> >> Andreas Färber wrote:
> >>>
> >>> Am 21.06.2009 um 01:25 schrieb Jamie Lokier:
> >>>
> >>>> François Revol wrote:
> >>>>>>
> >>>>>> On 06/20/2009 05:31 PM, Anthony Liguori wrote:
> >>>>>>>
> >>>>>>> Please [...] use C-style comments instead
> >>>>>>> of C++ style comments. [...]
> >>>>>>
> >>>>>> What do we have against C++ style comments?
> >>>>>
> >>>>> They are not valid in C code :P
> >>>>
> >>>> Wrong.
> >>>>
> >>>> Valid in GNU C for about 14 years, and ANSI/ISO C for about 10
> >>>> years...
> >>>>
> >>>> I'll be surprised if any C compiler used on any open source operating
> >>>> system, or any major commercial C compiler, doesn't accept them.
> >>>
> >>> Gladly even ten-year-old GCC 2.95.x supports 'em. But even a recent
> >>> GCC does not when compiled with -ansi, which is why system headers
> >>> still mustn't use them.
> >>
> >> This is wrong too.  They can be used in system headers.
> >
> > No, that is wrong. freetype2 definitely complained when Haiku had C99
> > comments in its POSIX system headers. ;)
> 
> #pragma GCC system_header

GCC has a notion of certain directories being system header
directories.

So you don't need #pragma for headers in those, and if freetype2 was
installed in them, that should have worked.

But if you install those headers in other places, then it doesn't
treat them as system headers and becomes more strict about the
language.

You can add more system header directories, but of course (nearly)
everyone uses -Idir to add directories as that's well known and portable.

-- Jamie

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

end of thread, other threads:[~2009-06-24 19:08 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-20  2:22 [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC m a
2009-06-20 14:31 ` Anthony Liguori
2009-06-20 18:59   ` Avi Kivity
2009-06-20 19:03     ` François Revol
2009-06-20 19:15       ` Avi Kivity
2009-06-20 23:25       ` Jamie Lokier
2009-06-21 10:01         ` Andreas Färber
2009-06-24 18:25           ` Jamie Lokier
2009-06-24 18:54             ` Andreas Färber
2009-06-24 18:59               ` Filip Navara
2009-06-24 19:08                 ` Jamie Lokier
2009-06-20 20:46     ` Anthony Liguori
2009-06-21  9:01       ` Avi Kivity
2009-06-20 19:16 ` Christoph Hellwig
2009-06-20 23:30   ` Jamie Lokier
2009-06-20 23:37     ` Anthony Liguori
2009-06-21  0:41       ` G 3
2009-06-24 18:27         ` Jamie Lokier
2009-06-21  0:46     ` G 3

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).