# New Ticket Created by  Ronald Blaschke 
# Please include the string:  [perl #52096]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=52096 >


I just noticed this warning on Windows.

src\io\io.c
src\io\io.c(180) : warning C4047: 'function' : 'int' differs in levels 
of indirection from 'PIOHANDLE'
src\io\io.c(180) : warning C4024: 'dup' : different types for formal and 
actual parameter 1
src\io\io.c(180) : warning C4047: 'initializing' : 'const PIOHANDLE' 
differs in levels of indirection from 'int'
         C:\Program Files\Microsoft Visual Studio 
9.0\VC\INCLUDE\io.h(308) : see declaration of 'dup'
src\io\io.c(189) : warning C4047: '==' : 'const PIOHANDLE' differs in 
levels of indirection from 'int'

The offending code in F<src/io/io.c> is:

     ParrotIO * const io   = PMC_data_typed(pmc, ParrotIO *);
     const PIOHANDLE newfd = dup(io->fd);

and

     if (newfd == -1) {
         real_exception(interp, NULL, 1, "could not dup an fd");
     }

With ParrotIO.fd declared as:

struct _ParrotIO {
     PIOHANDLE fd;               /* Low level OS descriptor      */
     ...
};

The code makes sense if C<PIOHANDLE> is a C<int> file descriptor, but it 
might be something else.

#ifdef PIO_OS_WIN32
typedef Parrot_WIN32_HANDLE PIOHANDLE;
typedef Parrot_OFF_T PIOOFF_T;
#endif
#ifdef PIO_OS_UNIX
/* Hopefully INTVAL_SIZE is enough for PTR_SIZE so that
  * the FILE* of pio_stdio_layers fit into a PIOHANDLE. */
typedef INTVAL PIOHANDLE;
typedef off_t PIOOFF_T;
#endif
#ifdef PIO_OS_STDIO
typedef FILE* PIOHANDLE;
typedef long PIOOFF_T;
#endif

C<dup> and comparison with C<-1> don't make sense if C<PIOHANDLE> is a 
Windows C<HANDLE> or a C<FILE *>.

Reply via email to