On Tue, Nov 14, 2000 at 04:40:22PM +0000, Nick Ing-Simmons wrote: > Jarkko Hietaniemi <jhi@iki.fi> writes: > >> *** perlsdio.h.FCS Tue Nov 14 10:50:12 2000 > >> ! #define PerlIO_set_ptrcnt(f,p,c) STMT_START {FILE_ptr(f) = (p), PerlIO_set_cnt(f,c);} STMT_END > >> /* assert() may pre-process to ""; potential syntax error (FILE_ptr(), ) */ > >> ! #define PerlIO_set_ptrcnt(f,p,c) STMT_START {FILE_ptr(f) = (p); assert(FILE_cnt(f) == (c));} STMT_END > > > >Could you explain the reason for these added assert()s a little bit more...? > > I think he just started from something which had them. I started from APC 7680. The asserts were already defined. > I dislike the > > ! #if defined(sun) && !defined(_LP64) > > even more ! > > Sun in _LP64 mode should be handled by the Configure stuff - as I understand > it in _LP64 mode FILE * is opaque - and so FILE_ptr et. al. should > not be defined at all. > > What the patch is attempting to do is handle the fact that Configure > has mis-guessed STDCHAR because FILE is defined under another name > in file other than <stdio.h>. It would be better handled > with a hints file that set STDCHAR Solaris 8 defines the FILE type in /usr/include/stdio_impl.h as follows: /* * Copyright (c) 1998 by Sun Microsystems, Inc. * All rights reserved. */ #ifndef _STDIO_IMPL_H #define _STDIO_IMPL_H #pragma ident "@(#)stdio_impl.h 1.8 99/06/10 SMI" #include <sys/isa_defs.h> #ifdef __cplusplus extern "C" { #endif #ifndef _SSIZE_T #define _SSIZE_T #if defined(_LP64) || defined(_I32LPx) typedef long ssize_t; /* size of something in bytes or -1 */ #else typedef int ssize_t; /* (historical version) */ #endif #endif /* !_SSIZE_T */ #ifdef _LP64 #ifndef _FILE64_H struct __FILE_TAG { long __pad[16]; }; #endif /* _FILE64_H */ #else struct __FILE_TAG /* needs to be binary-compatible with old versions */ { #ifdef _STDIO_REVERSE unsigned char *_ptr; /* next character from/to here in buffer */ ssize_t _cnt; /* number of available characters in buffer */ #else ssize_t _cnt; /* number of available characters in buffer */ unsigned char *_ptr; /* next character from/to here in buffer */ #endif unsigned char *_base; /* the buffer */ unsigned char _flag; /* the state of the stream */ unsigned char _file; /* UNIX System file descriptor */ unsigned __orientation:2; /* the orientation of the stream */ unsigned __ionolock:1; /* turn off implicit locking */ unsigned __filler:5; }; #endif /* _LP64 */ #ifdef __cplusplus } #endif #endif /* _STDIO_IMPL_H */ so we have a full structure defined in 32 bit mode and some paddings in 64 bit mode. In Solaris 2.6 the same is defeined in /usr/include/stdio.h as typedef struct /* needs to be binary-compatible with old versions */ { #ifdef _STDIO_REVERSE unsigned char *_ptr; /* next character from/to here in buffer */ int _cnt; /* number of available characters in buffer */ #else int _cnt; /* number of available characters in buffer */ unsigned char *_ptr; /* next character from/to here in buffer */ #endif unsigned char *_base; /* the buffer */ unsigned char _flag; /* the state of the stream */ unsigned char _file; /* UNIX System file descriptor */ } FILE; So _ptr should be (unsigned char *) on a sun system unless _LP64 is defined ?!?! Regards -- Jens -------------------------------------------------------------------------------- / +##+|##+ STRAWBERRY Jens Hamisch +v#+v v##+ EDV-Systeme GmbH Managing director / v v\v | . . . | Brauneckweg 2 Car (Voice): (+49 172) 81 04 162 | . | D-82549 Koenigsdorf Voice: (+49 8179) 9305-50 | . | Fax: (+49 8179) 9305-38 \ . / Tel./Fax: (+49 8179) 9305-50 Email: jens@Strawberry.COM \____/ Strawberry@Strawberry.COMThread Previous | Thread Next