public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* CPP warnings under DJGPP
@ 2000-05-30 11:36 Laurynas Biveinis
  2000-05-30 12:07 ` Per Bothner
  0 siblings, 1 reply; 2+ messages in thread
From: Laurynas Biveinis @ 2000-05-30 11:36 UTC (permalink / raw)
  To: GNU Compiler

Current code in cppfiles.c (read_with_read()) assumes that 
read() asked to read whole file at once would return the
size of file as a number of bytes read. However, if file
is opened as text under DJGPP and newline conversion takes
place, this is not true - read() returns smaller number.
This leads to harmless but confusing warnings 
'file.h is shorter than expected' everywhere.

read() can be made to behave as code expects under DJGPP by
passing additional flag O_BINARY to it:

  return open (filename, O_RDONLY|O_NOCTTY
#ifdef DJGPP
|O_BINARY
#endif
), 0666);

However, if other DOS-based platforms have different ways to
do this or GCC maintainers want a cleanier fix, another
solution is required?

Laurynas

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

* Re: CPP warnings under DJGPP
  2000-05-30 11:36 CPP warnings under DJGPP Laurynas Biveinis
@ 2000-05-30 12:07 ` Per Bothner
  0 siblings, 0 replies; 2+ messages in thread
From: Per Bothner @ 2000-05-30 12:07 UTC (permalink / raw)
  To: Laurynas Biveinis; +Cc: GNU Compiler

Laurynas Biveinis <lauras@softhome.net> writes:

>   return open (filename, O_RDONLY|O_NOCTTY
> #ifdef DJGPP
> |O_BINARY
> #endif
> ), 0666);
> 
> However, if other DOS-based platforms have different ways to
> do this or GCC maintainers want a cleanier fix, another
> solution is required?

I've used
        #ifndef O_BINARY
        #define O_BINARY 0
        #endif
as a relatively clean solution to this DOS brain-damage.

(By brain-damage I don't mean using crlf, though in retrospect that
was a mistake.  Nor do I complain that files do crlf-conversion
by default.  The big mistate, which we now have to live with, was
having posix (open'd) files do crlf-conversion by default, since
it forces extra buffering.)
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

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

end of thread, other threads:[~2000-05-30 12:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-30 11:36 CPP warnings under DJGPP Laurynas Biveinis
2000-05-30 12:07 ` Per Bothner

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 read-only IMAP folder(s) and NNTP newsgroup(s).