From d02f24688729c297c16fb0afb66dbf86526b7cfe Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Tue, 7 Dec 2010 14:42:04 -0600 Subject: [PATCH] [devel] Improved missing symbol handling in checksym.awk; symbols missing in both the old and new files can now be optionally ignored, treated as errors or warnings. --- ANNOUNCE | 3 +++ CHANGES | 3 +++ scripts/checksym.awk | 26 +++++++++++++++++++++----- scripts/pngwin.def | 6 ++++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 65780e60d..da18aaba5 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -462,6 +462,9 @@ Version 1.5.0beta56 [December 7, 2010] Version 1.5.0beta57 [December 7, 2010] Documented the pngvalid gamma error summary with additional comments and print statements. + Improved missing symbol handling in checksym.awk; symbols missing in both + the old and new files can now be optionally ignored, treated as errors + or warnings. Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index 5617f9426..c56ef300f 100644 --- a/CHANGES +++ b/CHANGES @@ -3100,6 +3100,9 @@ Version 1.5.0beta56 [December 7, 2010] Version 1.5.0beta57 [December 7, 2010] Documented the pngvalid gamma error summary with additional comments and print statements. + Improved missing symbol handling in checksym.awk; symbols missing in both + the old and new files can now be optionally ignored, treated as errors + or warnings. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/scripts/checksym.awk b/scripts/checksym.awk index a80fcd9d8..ba4c99b56 100755 --- a/scripts/checksym.awk +++ b/scripts/checksym.awk @@ -20,6 +20,7 @@ BEGIN{ lasto = 0 # last ordinal value from png.h mastero = 0 # highest ordinal in master file symbolo = 0 # highest ordinal in png.h + missing = "error"# log an error on missing symbols } # Read existing definitions from the master file (the first @@ -44,6 +45,13 @@ FILENAME==master && NF==2 && $2~/^@/ && $1!~/^;/ { print master ": bad export line format:", $0 err = 1 } +FILENAME==master && $1==";missing" && NF==2{ + # This allows the master file to control how missing symbols + # are handled; symbols that aren't in either the master or + # the new file. Valid values are 'ignore', 'warning' and + # 'error' + missing = $2 +} FILENAME==master { next } @@ -112,11 +120,19 @@ END{ } } if (unexported != 0) { - # Symbols in the .def but not in the new file are errors - if (o-1 > unexported) - print "png.h: warning: unexported symbol definitions:", unexported "-" o-1 - else - print "png.h: warning: unexported symbol definition:", unexported + # Symbols in the .def but not in the new file are errors, but + # the 'unexported' symbols aren't in either. By default this + # is an error too (see the setting of 'missing' at the start), + # but this can be reset on the command line or by stuff in the + # file - see the comments above. + if (missing != "ignore") { + if (o-1 > unexported) + print "png.h:", missing ": missing symbols:", unexported "-" o-1 + else + print "png.h:", missing ": missing symbol:", unexported + if (missing != "warning") + err = 1 + } unexported = 0 } if (symbol[o] != "" && removed[o] != "") { diff --git a/scripts/pngwin.def b/scripts/pngwin.def index 7e006a0c9..d2e5a7111 100644 --- a/scripts/pngwin.def +++ b/scripts/pngwin.def @@ -3,6 +3,12 @@ ; On OS/2 uncomment lines preceded by ;0S2 ;-------------------------------------------------------------- +; make scripts/pngwin.chk will validate this file against the +; build of libpng, the following line tells the check code to +; ignore symbols (ordinal values) that are missing in both +; files. +;missing ignore + ; If you give the library an explicit name one or other files ; may need modifying to support the new name on one or more ; systems.