This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More paranoid _r protochecking. At least Tru64 and
[perl5.git] / reentr.pl
index 3c529b6..971fc58 100644 (file)
--- a/reentr.pl
+++ b/reentr.pl
@@ -172,7 +172,7 @@ while (<DATA>) {
 ?RCS:
 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
 ?RCS:
-?MAKE:d_${f}_r ${f}_r_proto: Inlibc Protochk i_systypes $prereqh
+?MAKE:d_${f}_r ${f}_r_proto: Inlibc Protochk Hasproto i_systypes $prereqh
 ?MAKE: -pick add \$@ %<
 ?S:d_${f}_r:
 ?S:    This variable conditionally defines the HAS_${F}_R symbol,
@@ -192,7 +192,7 @@ while (<DATA>) {
 ?H:#\$d_${f}_r HAS_${F}_R         /**/
 ?H:#define ${F}_R_PROTO \$${f}_r_proto    /**/
 ?H:.
-?T:try hdrs
+?T:try hdrs d_${f}_r_proto
 ?LINT:set d_${f}_r
 ?LINT:set ${f}_r_proto
 : see if ${f}_r exists
@@ -201,6 +201,14 @@ eval \$inlibc
 case "\$d_${f}_r" in
 "\$define")
        hdrs="\$i_systypes sys/types.h define stdio.h \$i_${h} $h.h"
+       case "\$d_${f}_r_proto" in
+       '')     d_${f}_r_proto=define
+               set d_${f}_r_proto ${f}_r \$hdrs
+               eval \$hasproto ;;
+       *)      ;;
+       esac
+       case "\$d_${f}_r_proto" in
+       define)
 EOF
        for my $p (@p) {
            my ($r, $a) = ($p =~ /^(.)_(.+)/);
@@ -225,7 +233,7 @@ EOF
        case "\$${f}_r_proto" in
        '')     d_${f}_r=undef
                ${f}_r_proto=0
-               echo "Disabling ${f}_r, cannot determine prototype." ;;
+               echo "Disabling ${f}_r, cannot determine prototype." >&4 ;;
        * )     case "\$${f}_r_proto" in
                REENTRANT_PROTO*) ;;
                *) ${f}_r_proto="REENTRANT_PROTO_\$${f}_r_proto" ;;
@@ -233,6 +241,9 @@ EOF
                echo "Prototype: \$try" ;;
        esac
        ;;
+       *)      echo "You have ${f}_r but no prototype, not using it." >&4 ;;
+       esac
+       ;;
 *)     ${f}_r_proto=0
        ;;
 esac