summaryrefslogtreecommitdiffstats
path: root/share/mk/version_gen.awk
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2007-10-18 10:32:28 +0000
committeryar <yar@FreeBSD.org>2007-10-18 10:32:28 +0000
commitc8d051d8553d08c524e2cde89984caeff38c4483 (patch)
tree7b143b448e7f3ccd225d9da2388f1d971f6ea0e7 /share/mk/version_gen.awk
parent04367a31e7e354bda4cb5e35ca81e26173aaabbe (diff)
downloadFreeBSD-src-c8d051d8553d08c524e2cde89984caeff38c4483.zip
FreeBSD-src-c8d051d8553d08c524e2cde89984caeff38c4483.tar.gz
Distinguish the cases when a dup symbol is in different versions
(evil, needs a error) or in the same version (harmless, deserves a mere warning). Noticed by: grehan@, tinderbox
Diffstat (limited to 'share/mk/version_gen.awk')
-rw-r--r--share/mk/version_gen.awk30
1 files changed, 24 insertions, 6 deletions
diff --git a/share/mk/version_gen.awk b/share/mk/version_gen.awk
index b51d0b9..93fbc4f 100644
--- a/share/mk/version_gen.awk
+++ b/share/mk/version_gen.awk
@@ -34,12 +34,12 @@
# version name.
# symbols[][] - array index by [version name, symbol index], contains
# names of symbols defined for each version.
-# names[] - array index is symbol name and value is count,
+# names[] - array index is symbol name and value is its first version seen,
# used to check for duplicate symbols and warn about them.
#
BEGIN {
brackets = 0;
- errors = 0;
+ errors = warns = 0;
version_count = 0;
current_version = "";
stderr = "/dev/stderr";
@@ -148,12 +148,30 @@ BEGIN {
count = versions[current_version];
versions[current_version]++;
symbols[current_version, count] = $1;
- if (names[$1]++) {
- printf("File %s, line %d: Duplicated symbol `%s'. " \
+ if ($1 in names && names[$1] != current_version) {
+ #
+ # A graver case when a dup symbol appears under
+ # different versions in the map. That can result
+ # in subtle problems with the library later.
+ #
+ printf("File %s, line %d: Duplicated symbol `%s' " \
+ "in version `%s', first seen in `%s'. " \
"Did you forget to move it to ObsoleteVersions?\n",
- filename, FNR, $1) > stderr;
+ filename, FNR, $1,
+ current_version, names[$1]) > stderr;
errors++;
}
+ else if (names[$1] == current_version) {
+ #
+ # A harmless case: a dup symbol with the same version.
+ #
+ printf("File %s, line %d: warning: " \
+ "Duplicated symbol `%s' in version `%s'.\n",
+ filename, FNR, $1, current_version) > stderr;
+ warns++;
+ }
+ else
+ names[$1] = current_version;
}
else {
printf("File %s, line %d: Symbol `%s' outside version scope.\n",
@@ -221,7 +239,7 @@ function print_version(v)
END {
if (errors) {
- printf("%d errors total.\n", errors) > stderr;
+ printf("%d error(s) total.\n", errors) > stderr;
exit(1);
}
# OK, no errors.
OpenPOWER on IntegriCloud