develooper Front page | perl.perl5.porters | Postings from November 2005

[PATCH] Configure: stdio char (un)signedness

Thread Next
From:
Jarkko Hietaniemi
Date:
November 26, 2005 01:25
Subject:
[PATCH] Configure: stdio char (un)signedness
Message ID:
438829FE.8070202@gmail.com
Not that the detection of the stdio char signedness is all that
important these days, but I grew bored by these warnings in Tru64:

cc: Warning: sv.c, line 6548: In this statement, the referenced type of
the pointer value "((char ...)ptr)" is "char", which is not compatible
with "unsigned char" because they differ by signed/unsigned attribute.
(ptrmismatch1)
        PerlIO_set_ptrcnt(fp, (STDCHAR*)ptr, cnt); /* deregisterize cnt
and ptr */
--------^
cc: Warning: sv.c, line 6593: In this statement, the referenced type of
the pointer value "((char ...)ptr)" is "char", which is not compatible
with "unsigned char" because they differ by signed/unsigned attribute.
(ptrmismatch1)
    PerlIO_set_ptrcnt(fp, (STDCHAR*)ptr, cnt);  /* put these back or
we're in trouble */
----^

But for some reason I can't right now figure out, the detection of
the stdio char (un)signedness (grepping for 'unsigned.*char.*_ptr;'
in cpp-expanded <stdio.h>) as it is now implemented doesn't work in
Tru64.  In other words, this:

	echo '#include <stdio.h>' | $cppstdin $cppminus > stdio.h

is not end-result-equivalent to

	echo '#include <stdio.h>' > stdio.c
	$cppstdin $cppminus < stdio.c > stdioh

In the first case the stdioh ends up being an empty file!
In the second case the stdioh ends up being what it should be.
(The second way is how $cppstdin $cppminus is mostly used elsewhere
in Configure.)

From Bourne shell command line both work the same, but inside Configure
the first one doesn't. (In Tru64 the stdio char is unsigned, but since
that cannot quite be found from the empty stdioh, Configure guesses
signed.) (The "non-workingness" of the first case almost makes me
suspect a bug in the Tru64 /bin/sh.)

But I boldly suggest that everyone using Configure will start
doing the grep the second way since that would suit Tru64 :-)
(Another option, explicitly hinting dec_osf.sh would be more of a cheat,
methinks.)  The attached patch implements the bold option.





Thread Next


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