diff options
author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2007-10-18 10:32:28 +0000 |
---|---|---|
committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2007-10-18 10:32:28 +0000 |
commit | 91fb7b9b1986b3759312be58dade40e133ad7676 (patch) | |
tree | 7b143b448e7f3ccd225d9da2388f1d971f6ea0e7 /share/mk/version_gen.awk | |
parent | e83df45f2797db5732f1f9df3c5d29595223b8d4 (diff) | |
download | src-test2-91fb7b9b1986b3759312be58dade40e133ad7676.tar.gz src-test2-91fb7b9b1986b3759312be58dade40e133ad7676.zip |
Notes
Diffstat (limited to 'share/mk/version_gen.awk')
-rw-r--r-- | share/mk/version_gen.awk | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/share/mk/version_gen.awk b/share/mk/version_gen.awk index b51d0b96af24..93fbc4fc9129 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. |