develooper Front page | perl.perl6.internals | Postings from September 2005

Re: [perl #24381] Parrot doesn't build with PIO_OS_STDIO defined

From:
Simon Glover
Date:
September 21, 2005 12:55
Subject:
Re: [perl #24381] Parrot doesn't build with PIO_OS_STDIO defined
Message ID:
Pine.LNX.4.61.0509211546150.31382@nevis.internal.amnh.org

On Wed, 21 Sep 2005, Joshua Hoblitt via RT wrote:

>> [scog@amnh.org - Fri Oct 31 12:58:45 2003]:
>>
>>
>>  An attempt to build Parrot with PIO_OS_STDIO defined (as is the case
>>  when you're trying to build miniparrot) dies in core_ops.c with the error
>>  message:
>>
>>   ops/io.ops: In function `Parrot_sockaddr_s_i_s':
>>   ops/io.ops:497: parse error before `;'
>>   [etc...]
>>
>>  The reason is the interaction between the sockaddr op definition:
>>
>>   op sockaddr(out STR, in INT, in STR) {
>>     $1 = PIO_sockaddr_in(interpreter, (unsigned short)$2, $3);
>>     goto NEXT();
>>   }
>>
>>  and this ifdef in io.h:
>>
>> #ifdef PIO_OS_STDIO
>> extern INTVAL           PIO_stdio_isatty(PIOHANDLE fd);
>> extern INTVAL           PIO_stdio_getblksize(PIOHANDLE fd);
>> #  define PIO_isatty(x)   PIO_stdio_isatty(x)
>> #  define PIO_sockaddr_in(i,p,a)
>> #  define PIO_getblksize(x)   PIO_stdio_getblksize(x)
>> #endif
>>
>>  The preprocessor turns the op definition into:
>>
>>    op sockaddr(out STR, in INT, in STR) {
>>     $1 = ;
>>     goto NEXT();
>>   }
>>
>>  which is clearly a syntax error.
>>
>>  An easy fix is to wrap the offending line in #ifndef PIO_OS_STDIO ..
>>  #endif, but there may be a better solution.
>>

  This bug still exists, in a slightly modified form. If PIO_OS_STDIO is
  defined, then the build fails as described above. For PIO_OS_STDIO to
  be defined, then either MINIPARROT must be defined, or
  PARROT_HAS_HEADER_UNISTD must be undefined, since PIO_OS_STDIO is set by
  the following bit of io.h:

#ifdef MINIPARROT
#  define PIO_OS_STDIO
#else
#  ifdef _WIN32
#    define PIO_OS_WIN32
#  else
#    ifdef PARROT_HAS_HEADER_UNISTD
#      define PIO_OS_UNIX
#    else
#      define PIO_OS_STDIO
#    endif
#  endif
#endif

  However, it seems like MINIPARROT isn't actually #defined by anything any
  longer; in particular, running Configure with the --miniparrot option no
  longer adds -DMINIPARROT to the CFLAGS line. Therefore, it doesn't seem
  possible to hit this problem unless we build on a system without
  unistd.h, or unless we trigger it deliberately (as I did while checking
  that the problem still existed).

  Simon



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About