From b979bceed1f14619df7b3331e1a7247dcbe87815 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 20 Mar 2014 19:01:21 -0700 Subject: [PATCH 6/6] Remove unused rules, and add a check for this. * checktab.awk: Check for a Rule defined but never used. * antarctica (NZAQ): Remove unused rule. * NEWS: Document this. --- NEWS | 5 +++++ antarctica | 12 ------------ checktab.awk | 20 +++++++++++++++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index c33c214..4b53037 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,11 @@ Unreleased, experimental changes per year for the forseeable future. (Thanks to Andrew Main (Zefram).) Also, 'zic' avoids some unlikely failures due to integer overflow. + Changes affecting build procedure + + 'make check' now detects Rule lines defined but never used. + The NZAQ rules, an instance of this problem, have been removed. + Changes affecting commentary and documentation Add a commented-out entry for Troll station, Antarctica. diff --git a/antarctica b/antarctica index 2e0806c..06da875 100644 --- a/antarctica +++ b/antarctica @@ -230,18 +230,6 @@ Zone Antarctica/Syowa 0 - zzz 1957 Jan 29 # year-round base # Scott Base, Ross Island, since 1957-01. # See Pacific/Auckland. -# -# These rules for New Zealand are stolen from the 'australasia' file. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NZAQ 1974 only - Nov 3 2:00s 1:00 D -Rule NZAQ 1975 1988 - Oct lastSun 2:00s 1:00 D -Rule NZAQ 1989 only - Oct 8 2:00s 1:00 D -Rule NZAQ 1990 2006 - Oct Sun>=1 2:00s 1:00 D -Rule NZAQ 1975 only - Feb 23 2:00s 0 S -Rule NZAQ 1976 1989 - Mar Sun>=1 2:00s 0 S -Rule NZAQ 1990 2007 - Mar Sun>=15 2:00s 0 S -Rule NZAQ 2007 max - Sep lastSun 2:00s 1:00 D -Rule NZAQ 2008 max - Apr Sun>=1 2:00s 0 S # Norway - territories # Bouvet (never inhabited) diff --git a/checktab.awk b/checktab.awk index fec4f62..d78ba73 100644 --- a/checktab.awk +++ b/checktab.awk @@ -115,10 +115,14 @@ BEGIN { FS = " " } +$1 ~ /^#/ { next } + { - tz = "" - if ($1 == "Zone") tz = $2 - if ($1 == "Link") { + tz = rules = "" + if ($1 == "Zone") { + tz = $2 + ruleUsed[$4] = 1 + } else if ($1 == "Link") { # Ignore Link commands if source and destination basenames # are identical, e.g. Europe/Istanbul versus Asia/Istanbul. src = $2 @@ -126,6 +130,10 @@ BEGIN { while ((i = index(src, "/"))) src = substr(src, i+1) while ((i = index(dst, "/"))) dst = substr(dst, i+1) if (src != dst) tz = $3 + } else if ($1 == "Rule") { + ruleDefined[$2] = 1 + } else { + ruleUsed[$2] = 1 } if (tz && tz ~ /\//) { if (!tztab[tz]) { @@ -138,6 +146,12 @@ BEGIN { } END { + for (tz in ruleDefined) { + if (!ruleUsed[tz]) { + printf "%s: Rule never used\n", tz + status = 1 + } + } for (tz in tz2cc) { if (!zoneSeen[tz]) { printf "%s:%d: no Zone table for `%s'\n", \ -- 1.8.5.3