Adding -fwrapv is not enough: h2ph gets confused by some newer CPP symbols.
The attached patch (which I'm pretty sure can be safely applied regardless of gcc version) is needed for 5.14, 5.16, 5.18.
--- utils/h2ph.PL 2017-11-15 11:25:51.553006000 +0000
+++ utils/h2ph.PL 2017-11-15 11:26:30.161006000 +0000
@@ -797,7 +797,7 @@
# parenthesized value: d=(v)
$define{$_} = $1;
}
- if (/^(\w+)\((\w)\)$/) {
+ if (/^(\w+)\((\w+)\)$/) {
my($macro, $arg) = ($1, $2);
my $def = $define{$_};
$def =~ s/$arg/\$\{$arg\}/g;
@@ -814,6 +814,18 @@
# integer:
print PREAMBLE
"unless (defined &$_) { sub $_() { $1 } }\n\n";
+ } elsif ($define{$_} =~ /^([+-]?0x[\da-f]+)U?L{0,2}$/i) {
+ # hex integer
+ # Special cased, since perl warns on hex integers
+ # that can't be represented in a UV.
+ #
+ # This way we get the warning at time of use, so the user
+ # only gets the warning if they happen to use this
+ # platform-specific definition.
+ my $code = $1;
+ $code = "hex('$code')" if length $code > 10;
+ print PREAMBLE
+ "unless (defined &$_) { sub $_() { $code } }\n\n";
} elsif ($define{$_} =~ /^\w+$/) {
my $def = $define{$_};
if ($isatype{$def}) {