Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 127612
Status: new
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: CAC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 804.034
Fixed in: (no value)



Subject: Tk::MakeDepend: errors/warnings parsing pngconf.h from libpng 1.6.0+
As mentioned by the reporter of RT #87016, as well as in MacPorts ticket #43463, there are a number of messages (errors? warnings?) that appear regarding pngconf.h from libpng:

Test Compile/Run config/has_png.c
Using system's -lpng
Finding dependencies for PNG.xs
Finding dependencies for imgPNG.c
Invalid term: -32768 && INT_MAX == 32767 at …/Tk/MakeDepend.pm line 55, </opt/local/include/pngconf.h> line 486.
trailing:  -32768 && INT_MAX == 32767 at …/Tk/MakeDepend.pm line 104, </opt/local/include/pngconf.h> line 486.
ignore 'error "libpng requires a signed 16-bit type"'
ignore 'error "libpng requires an unsigned 16-bit type"'
Invalid term: -2147483646 && INT_MAX > 2147483646 at …/Tk/MakeDepend.pm line 55, </opt/local/include/pngconf.h> line 502.
trailing:  -2147483646 && INT_MAX > 2147483646 at …/Tk/MakeDepend.pm line 104, </opt/local/include/pngconf.h> line 502.
Invalid term: -2147483646 && LONG_MAX > 2147483646 at …/Tk/MakeDepend.pm line 55, </opt/local/include/pngconf.h> line 504.
trailing:  -2147483646 && LONG_MAX > 2147483646 at …/Tk/MakeDepend.pm line 104, </opt/local/include/pngconf.h> line 504.
ignore 'error "libpng requires a signed 32-bit (or more) type"'
trailing: U at …/Tk/MakeDepend.pm line 104, </opt/local/include/pngconf.h> line 510.
trailing: U at …/Tk/MakeDepend.pm line 104, </opt/local/include/pngconf.h> line 512.
ignore 'error "libpng requires an unsigned 32-bit (or more) type"'

This looks as if Tk::MakeDepend::term() is not correctly parsing "negative" integer constants and integer constant suffixes used in pngconf.h, which were introduced by libpng 1.6.0.

I have attached a patch that appears to eliminate the "Invalid term" and "trailing" messages, though not the "ignore 'error …'" messages. It also seems to have no effect on libpng behavior at runtime. However, I think the approach used isn't completely correct; I'm inclined to think such handling of negative terms (unary minus '-' operator) might break expressions using subtraction (binary minus). At the moment I don't know of a better way to test for suffixes other than (ULL|LLU|UL|LU|LL|U|L)? (longest to shortest).
Subject: patch-MakeDepend.pm.diff
Parse pngconf.h correctly on libpng 1.6.0+ Detect negative integer constants, more suffixes diff --git a/Tk/MakeDepend.pm b/Tk/MakeDepend.pm index b15b9969..d470e773 100644 --- Tk/MakeDepend.pm +++ Tk/MakeDepend.pm @@ -43,8 +43,8 @@ sub term return !term() if s/^\s*!//; return exists($define{$1}) if s/^\s*defined\s*\(([_A-Za-z][_\w]*)\s*\)//; return exists($define{$1}) if s/^\s*defined\s*([_A-Za-z][_\w]*)//; - return eval "$1" if s/^\s*(0x[0-9a-f]+)L?//i; - return $1 if s/^\s*(\d+)L?//; + return eval "$1" if s/^\s*(\-?0x[0-9a-f]+)(ULL|LLU|UL|LU|LL|U|L)?//i; + return $1 if s/^\s*(\-?\d+)(ULL|LLU|UL|LU|LL|U|L)?//i; return $define{$1} || 0 if s/^\s*([_A-Za-z][_\w]*)//; if (s/^\s*\(//) {