Document UNIVERSAL->import deprecation in perldelta
[p5sagit/p5-mst-13.2.git] / utils / h2ph.PL
index a3ff285..8f56db4 100644 (file)
@@ -123,7 +123,7 @@ while (defined (my $file = next_file())) {
 
     print OUT
         "require '_h2ph_pre.ph';\n\n",
-        "no warnings 'redefine';\n\n";
+        "no warnings qw(redefine misc);\n\n";
 
     while (defined (local $_ = next_line($file))) {
        if (s/^\s*\#\s*//) {
@@ -509,7 +509,7 @@ sub expr {
                s/^\s*\((\w),/("$1",/ if $id =~ /^_IO[WR]*$/i;  # cheat
                $new .= " &$id";
            } elsif ($isatype{$id}) {
-               if ($new =~ /{\s*$/) {
+               if ($new =~ /\{\s*$/) {
                    $new .= "'$id'";
                } elsif ($new =~ /\(\s*$/ && /^[\s*]*\)/) {
                    $new =~ s/\(\s*$//;
@@ -518,8 +518,14 @@ sub expr {
                    $new .= q(').$id.q(');
                }
            } else {
-               if ($inif && $new !~ /defined\s*\($/) {
-                   $new .= '(defined(&' . $id . ') ? &' . $id . ' : undef)';
+               if ($inif) {
+                   if ($new =~ /defined\s*$/) {
+                       $new .= '(&' . $id . ')';
+                   } elsif ($new =~ /defined\s*\($/) {
+                       $new .= '&' . $id;
+                   } else {
+                       $new .= '(defined(&' . $id . ') ? &' . $id . ' : undef)';
+                   }
                } elsif (/^\[/) {
                    $new .= " \$$id";
                } else {
@@ -743,7 +749,7 @@ sub queue_includes_from
 
 
 # Determine include directories; $Config{usrinc} should be enough for (all
-# non-GCC?) C compilers, but gcc uses an additional include directory.
+# non-GCC?) C compilers, but gcc uses additional include directories.
 sub inc_dirs
 {
     my $from_gcc    = `LC_ALL=C $Config{cc} -v 2>&1`;
@@ -755,7 +761,7 @@ sub inc_dirs
            $from_gcc = '';
        };
     };
-    length($from_gcc) ? ($from_gcc, $Config{usrinc}) : ($Config{usrinc});
+    length($from_gcc) ? ($from_gcc, $from_gcc . "-fixed", $Config{usrinc}) : ($Config{usrinc});
 }
 
 
@@ -809,6 +815,7 @@ sub build_preamble_if_necessary
                    quotemeta($define{$_}), "\" } }\n\n";
            }
        }
+       print PREAMBLE "\n1;\n";  # avoid 'did not return a true value' when empty
     close PREAMBLE               or die "Cannot close $preamble:  $!";
 }