On Thu Jul 12 02:41:04 2007, GAAL wrote:
Show quoted text> On Wed Jul 11 09:47:35 2007, SMPETERS wrote:
> > - STDCHAR *p, *eol_w = NULL, *eol_r = NULL;
> > + char *p, *eol_w = NULL, *eol_r = NULL;
>
> I'm not sure this is correct. According to config_h.SH in the Perl
> distro, "This symbol is defined to be the type of char used in stdio.h.
> It has the values "unsigned char" or 'char'."
>
> So I think your perl may be misconfigured?
On Solaris, I get the following in a config.h
/* STDCHAR:
* This symbol is defined to be the type of char used in stdio.h.
* It has the values "unsigned char" or "char".
*/
#define STDCHAR unsigned char /**/
Here are the warnings that are coming up during the compile.
/opt/SUNWspro/bin/cc -c -D_REENTRANT -DPTR_IS_LONG -DDEBUGGING
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-DPERL_USE_SAFE_PUTENV -g -DVERSION=\"0.14\" -DXS_VERSION=\"0.14\"
-KPIC
"-I/tmp/bleadperl/lib/5.10.0/i86pc-solaris-thread-multi-64int-ld/CORE"
eol.c
"eol.xs", line 29: warning: assignment type mismatch:
pointer to unsigned char "=" pointer to char
"eol.xs", line 32: warning: assignment type mismatch:
pointer to unsigned char "=" pointer to char
"eol.xs", line 50: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 89
argument : pointer to unsigned char
"eol.xs", line 50: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 89
argument : pointer to unsigned char
"eol.xs", line 50: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 89
argument : pointer to unsigned char
"eol.xs", line 50: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 89
argument : pointer to unsigned char
"eol.xs", line 50: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 148
argument : pointer to unsigned char
"eol.xs", line 50: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 148
argument : pointer to unsigned char
"eol.xs", line 51: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 89
argument : pointer to unsigned char
"eol.xs", line 51: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 89
argument : pointer to unsigned char
"eol.xs", line 51: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 89
argument : pointer to unsigned char
"eol.xs", line 51: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 89
argument : pointer to unsigned char
"eol.xs", line 51: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 148
argument : pointer to unsigned char
"eol.xs", line 51: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 148
argument : pointer to unsigned char
"eol.xs", line 157: warning: assignment type mismatch:
pointer to unsigned char "=" pointer to char
These are the prototypes for the following functions....
extern int strncmp(const char *, const char *, size_t);
extern char *strchr(const char *, int);
Since STDCHAR on Solaris is an unsigned char, the automatic converions
from unsigned char * to const char * causes the warnings to appear.
The second problem occurs when the return from savepv() is stored as an
unsigned char *. According to proto.h...
proto.h:PERL_CALLCONV char* Perl_savepv(pTHX_ const char* pv)
...so instead of what I have sent, the patch should be
if (f) {
PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL);
- s->name = savepv( SvPV_nolen(arg) );
+ s->name = (STDCHAR *)savepv( SvPV_nolen(arg) );
}
so its right across environments.