public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/43738]  New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
@ 2010-04-12 23:33 sherpya at netfarm dot it
  2010-04-12 23:34 ` [Bug libstdc++/43738] " pinskia at gcc dot gnu dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: sherpya at netfarm dot it @ 2010-04-12 23:33 UTC (permalink / raw)
  To: gcc-bugs

basic_file_stdio.cc in __basic_file<char>::showmanyc()
uses ioctl with FIONREAD, but the equivalent on win32 is ioctlsocket,
perhaps not usable here, because I think there is not support for socket here
in gcc (I'm wrong?)

anyway it does not compiles
I solve this by commenting out that part

    int __r = ioctl(this->fd(), FIONREAD, &__num);
    if (!__r && __num >= 0)
      return __num;

the problem still there since 4.3 iirc, I'm the only that noticed it?
there is something wrong in my setup?

my configure options:

../gcc/configure                            \
    --prefix=/mingw                         \
    --disable-bootstrap                     \
    --with-gnu-ld                           \
    --target=i686-pc-mingw32                \
    --with-tune=generic                     \
    --with-cpu=i686                         \
    --disable-cpp                           \
    --disable-win32-registry                \
    --disable-shared                        \
    --enable-static                         \
    --program-suffix=-4.6                   \
    --enable-version-specific-runtime-libs  \
    --enable-languages=c,c++                \
    --enable-cld                            \
    --enable-__cxa_atexit                   \
    --disable-werror                        \
    --disable-checking                      \
    --enable-multilib                       \
    --enable-threads=posix                  \
    --disable-libssp                        \
    --with-dwarf2                           \
    --disable-nls                           \
    --with-ppl                              \
    --disable-cloog                         \
    --enable-libgomp


-- 
           Summary: basic_file_stdio.cc uses ioctl on a fd, but not
                    available on mingw32
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sherpya at netfarm dot it
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
@ 2010-04-12 23:34 ` pinskia at gcc dot gnu dot org
  2010-04-12 23:36 ` sherpya at netfarm dot it
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-04-12 23:34 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal
            Version|unknown                     |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
  2010-04-12 23:34 ` [Bug libstdc++/43738] " pinskia at gcc dot gnu dot org
@ 2010-04-12 23:36 ` sherpya at netfarm dot it
  2010-04-15  0:55 ` paolo dot carlini at oracle dot com
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sherpya at netfarm dot it @ 2010-04-12 23:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sherpya at netfarm dot it  2010-04-12 23:36 -------
FIONREAD is defined by winsock header


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
  2010-04-12 23:34 ` [Bug libstdc++/43738] " pinskia at gcc dot gnu dot org
  2010-04-12 23:36 ` sherpya at netfarm dot it
@ 2010-04-15  0:55 ` paolo dot carlini at oracle dot com
  2010-04-15  1:03 ` davek at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-04-15  0:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2010-04-15 00:55 -------
Dave, any idea? For sure nobody reported build problems so far, and that code
is *very* old...


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|sherpya at netfarm dot it   |dave dot korn dot cygwin at
                   |                            |gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (2 preceding siblings ...)
  2010-04-15  0:55 ` paolo dot carlini at oracle dot com
@ 2010-04-15  1:03 ` davek at gcc dot gnu dot org
  2010-04-15  1:17 ` davek at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: davek at gcc dot gnu dot org @ 2010-04-15  1:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from davek at gcc dot gnu dot org  2010-04-15 01:03 -------
Is this a combined-tree build?  Sounds like:

http://www.mail-archive.com/gcc@gcc.gnu.org/msg27284.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (3 preceding siblings ...)
  2010-04-15  1:03 ` davek at gcc dot gnu dot org
@ 2010-04-15  1:17 ` davek at gcc dot gnu dot org
  2010-04-15  3:10 ` paolo dot carlini at oracle dot com
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: davek at gcc dot gnu dot org @ 2010-04-15  1:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from davek at gcc dot gnu dot org  2010-04-15 01:17 -------
So the ideal fix would be to change "#ifdef FIONREAD" to something more like
"#if HAVE_IOCTL && defined (FIONREAD)".  But that runs into the need-link-test
vs. cross-configure problem.

MinGW doesn't have sys/ioctl.h; could we test HAVE_SYS_IOCTL_H?  Are there
likely to be any platforms we support that define FIONREAD but don't have
sys/ioctl.h?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (4 preceding siblings ...)
  2010-04-15  1:17 ` davek at gcc dot gnu dot org
@ 2010-04-15  3:10 ` paolo dot carlini at oracle dot com
  2010-04-15  7:54 ` dannysmith at users dot sourceforge dot net
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-04-15  3:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from paolo dot carlini at oracle dot com  2010-04-15 03:09 -------
(In reply to comment #4)
> MinGW doesn't have sys/ioctl.h; could we test HAVE_SYS_IOCTL_H?  Are there
> likely to be any platforms we support that define FIONREAD but don't have
> sys/ioctl.h?

Dave, if you look at the beginning of the file, it looks like Solaris 2.5 is
one such case. Now, leaving aside for the moment that likely clean-ups are
possible (because Rainer is removing support for some old Solaris* versions, if
I remember correctly), I wonder whether we should simply special case mingw32
and conditional to the macro being defined (don't remember: _MINGW32?) just
include the required headers, and use ioctlsocket in place of ioctl. I think
that in such kind of low level .cc file it's all the elegance we can hope for
;)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (5 preceding siblings ...)
  2010-04-15  3:10 ` paolo dot carlini at oracle dot com
@ 2010-04-15  7:54 ` dannysmith at users dot sourceforge dot net
  2010-04-15 10:04 ` sherpya at netfarm dot it
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2010-04-15  7:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dannysmith at users dot sourceforge dot net  2010-04-15 07:54 -------
(In reply to comment #1)
> FIONREAD is defined by winsock header
> 

How come your build of basic_file_stdio includes  winsock api headers? 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (6 preceding siblings ...)
  2010-04-15  7:54 ` dannysmith at users dot sourceforge dot net
@ 2010-04-15 10:04 ` sherpya at netfarm dot it
  2010-04-15 10:13 ` davek at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sherpya at netfarm dot it @ 2010-04-15 10:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from sherpya at netfarm dot it  2010-04-15 10:03 -------
the correct way should be
#if defined(FIONREAD) && !defined(_WIN32)

or if you prefer __MINGW32__

(note _WIN32 is not defined on cygwin)

ioctlsocket is not suitable because it does not work on file descriptors
also it will need ws2_32 library at link time


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (7 preceding siblings ...)
  2010-04-15 10:04 ` sherpya at netfarm dot it
@ 2010-04-15 10:13 ` davek at gcc dot gnu dot org
  2010-04-15 16:04 ` paolo dot carlini at oracle dot com
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: davek at gcc dot gnu dot org @ 2010-04-15 10:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from davek at gcc dot gnu dot org  2010-04-15 10:13 -------
Mid-air collision!
Mid-air collision detected!

  :)

(In reply to comment #5)

> I remember correctly), I wonder whether we should simply special case mingw32
> and conditional to the macro being defined 

  Yeah, that seems like the reasonable answer.

> (don't remember: _MINGW32?) 

  Nearly: __MINGW32__

> just include the required headers, and use ioctlsocket in place of ioctl. 

Not quite, I think: the correct thing to do would be just #if out the clause
altogether.  In 'doze, file handles and sockets aren't interchangeable, and
FIONREAD is only valid using ioctlsocket on a socket handle.  All the C++ stuff
will only be using underlying C stdio FILEs, I think, and won't work with
sockets at all, so we'll not actually ever have a real socket here.  Cygwin
goes to great trouble to simulate unix-style fds behind the scenes, but on
MinGW you get the raw Windows API which has separate file fds and socket
handles, so we'll only ever encounter real files here.

Gonna be AFK for most of today I'm afraid but will look at this more tomorrow.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (8 preceding siblings ...)
  2010-04-15 10:13 ` davek at gcc dot gnu dot org
@ 2010-04-15 16:04 ` paolo dot carlini at oracle dot com
  2010-04-20 21:27 ` paolo dot carlini at oracle dot com
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-04-15 16:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from paolo dot carlini at oracle dot com  2010-04-15 16:04 -------
Agreed, if ioctlsocket can't really replace ioctl, let's just explicitly #if
out the affected targets for now. We can still improve it later.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (9 preceding siblings ...)
  2010-04-15 16:04 ` paolo dot carlini at oracle dot com
@ 2010-04-20 21:27 ` paolo dot carlini at oracle dot com
  2010-04-21  2:17 ` davek at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-04-20 21:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from paolo dot carlini at oracle dot com  2010-04-20 21:26 -------
Dave, can I assign this to you?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (10 preceding siblings ...)
  2010-04-20 21:27 ` paolo dot carlini at oracle dot com
@ 2010-04-21  2:17 ` davek at gcc dot gnu dot org
  2010-04-21  3:36 ` paolo dot carlini at oracle dot com
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: davek at gcc dot gnu dot org @ 2010-04-21  2:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from davek at gcc dot gnu dot org  2010-04-21 02:17 -------
(In reply to comment #10)
> Dave, can I assign this to you?
> 

Probably not now I beat you to it!  Will take me a day or three to get round
to.


-- 

davek at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |davek at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-04-21 02:17:43
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (11 preceding siblings ...)
  2010-04-21  2:17 ` davek at gcc dot gnu dot org
@ 2010-04-21  3:36 ` paolo dot carlini at oracle dot com
  2010-04-22 15:32 ` sherpya at netfarm dot it
  2010-08-13 18:00 ` paolo dot carlini at oracle dot com
  14 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-04-21  3:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from paolo dot carlini at oracle dot com  2010-04-21 03:36 -------
Many thanks.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (12 preceding siblings ...)
  2010-04-21  3:36 ` paolo dot carlini at oracle dot com
@ 2010-04-22 15:32 ` sherpya at netfarm dot it
  2010-08-13 18:00 ` paolo dot carlini at oracle dot com
  14 siblings, 0 replies; 16+ messages in thread
From: sherpya at netfarm dot it @ 2010-04-22 15:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from sherpya at netfarm dot it  2010-04-22 15:31 -------
I can build 4.5.0 without problems, I think here no source is pulling in
winsock header


-- 

sherpya at netfarm dot it changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sherpya at netfarm dot it


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

* [Bug libstdc++/43738] basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32
  2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
                   ` (13 preceding siblings ...)
  2010-04-22 15:32 ` sherpya at netfarm dot it
@ 2010-08-13 18:00 ` paolo dot carlini at oracle dot com
  14 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-08-13 18:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from paolo dot carlini at oracle dot com  2010-08-13 18:00 -------
Dave, any news on this? Thanks.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43738


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

end of thread, other threads:[~2010-08-13 18:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-12 23:33 [Bug libstdc++/43738] New: basic_file_stdio.cc uses ioctl on a fd, but not available on mingw32 sherpya at netfarm dot it
2010-04-12 23:34 ` [Bug libstdc++/43738] " pinskia at gcc dot gnu dot org
2010-04-12 23:36 ` sherpya at netfarm dot it
2010-04-15  0:55 ` paolo dot carlini at oracle dot com
2010-04-15  1:03 ` davek at gcc dot gnu dot org
2010-04-15  1:17 ` davek at gcc dot gnu dot org
2010-04-15  3:10 ` paolo dot carlini at oracle dot com
2010-04-15  7:54 ` dannysmith at users dot sourceforge dot net
2010-04-15 10:04 ` sherpya at netfarm dot it
2010-04-15 10:13 ` davek at gcc dot gnu dot org
2010-04-15 16:04 ` paolo dot carlini at oracle dot com
2010-04-20 21:27 ` paolo dot carlini at oracle dot com
2010-04-21  2:17 ` davek at gcc dot gnu dot org
2010-04-21  3:36 ` paolo dot carlini at oracle dot com
2010-04-22 15:32 ` sherpya at netfarm dot it
2010-08-13 18:00 ` paolo dot carlini at oracle dot com

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