This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: ensure binary objects opened in binary mode


> Date: Wed, 22 Feb 2006 00:30:46 -0500
> From: Charles Wilson <cygwin@cwilson.fastmail.fm>
> CC:  gdb-patches@sourceware.org
> 
> Okay, I've attached two patches that hopefully address all the issues 
> raised in this thread.

Thanks.

> (1) for every file that #includes both defs.h AND <fcntl.h>, remove the 
> <fcntl.h> inclusion.

I'm not sure this is a good idea.  What if tomorrow we remove fcntl.h
from defs.h--do we go through all these files again and add it back?
Why bother? fcntl.h should be idempotent, so including it several
times does no real harm.

I actually quite dislike source files that don't include standard
headers because they are included in defs.h and its ilk.  It makes me
wonder how come foo.c uses something defined in bar.h, but there's no
"#include <bar.h>" anywhere in sight.

> (2) Further, for every file that contains the #ifndef...#define 
> O_BINARY...#endif stanza (all of which #include defs.h), that stanza is 
> removed (3 line change to each of 5 files)

This is what I think we wanted.  We don't want O_BINARY defined
identically in several places.

So I'd prefer if you committed the 1st and the 3rd patch. but not the
second.  However, before you actually do that, let's wait and hear
what others think.

> +/* In case this is not defined in fcntl.h */
> +
> +#ifndef O_BINARY
> +#define O_BINARY 0
> +#endif

I'd change the comment to explain that O_BINARY has a meaning on
non-Posix platforms, while on Posix platforms it should be a no-op.
That is the _real_ reason we define O_BINARY.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]