aboutsummaryrefslogtreecommitdiff
path: root/scripts/merge-abilist.awk
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-12-23 11:17:18 +0000
committerRoland McGrath <roland@gnu.org>2002-12-23 11:17:18 +0000
commitc823a4d21b76fbc6cf86503d23e3cd55384644ce (patch)
tree6a61fb4da98c47f12d37455776b30543b51d9a3e /scripts/merge-abilist.awk
parentb27b002d5b85b8628f19f65886d25a342c6cbc18 (diff)
downloadglibc-c823a4d21b76fbc6cf86503d23e3cd55384644ce.tar
glibc-c823a4d21b76fbc6cf86503d23e3cd55384644ce.tar.gz
glibc-c823a4d21b76fbc6cf86503d23e3cd55384644ce.tar.bz2
glibc-c823a4d21b76fbc6cf86503d23e3cd55384644ce.zip
* scripts/abilist.awk: Produce a more compact format, divided into
stanzas for each version set, the set name listed only once. * scripts/extract-abilist.awk: New file. * scripts/merge-abilist.awk: New file. * Makerules (check-abi-%, update-abi-%): New pattern rules. (update-abi, check-abi): New targets. * Makefile (+subdir_targets): Add subdir_{check,update}-abi. * Makerules (%.symlist): Use LC_ALL=C when running awk script.
Diffstat (limited to 'scripts/merge-abilist.awk')
-rw-r--r--scripts/merge-abilist.awk129
1 files changed, 129 insertions, 0 deletions
diff --git a/scripts/merge-abilist.awk b/scripts/merge-abilist.awk
new file mode 100644
index 0000000000..016debc628
--- /dev/null
+++ b/scripts/merge-abilist.awk
@@ -0,0 +1,129 @@
+# awk script to merge a config-specific .symlist file with others.
+# The input files should be an existing .abilist file, and a .symlist file.
+# This must be passed run with awk -v config=REGEXP to specify a regexp
+# matching configuration tuples for which the .symlist input defines an ABI.
+# The result merges all duplicate occurrences of any symbol in a version set
+# into a stanza listing the regexps matching configurations that contain it.
+
+/^[^ ]/ {
+ if (NF < 2 && config == "") {
+ print "BAD LINE:", $0 > "/dev/stderr";
+ exit 2;
+ }
+
+ if (NF < 2) {
+ current = $1 ":" config;
+ }
+ else {
+ current = $1 ":" $2;
+ for (i = 3; i <= NF; ++i) {
+ current = current "," $1 ":" $i;
+ }
+ }
+
+ next;
+}
+
+{
+ if ($0 in seen) {
+ seen[$0] = seen[$0] "\n" current;
+ }
+ else {
+ seen[$0] = current;
+ }
+
+ next;
+}
+
+END {
+ for (line in seen) {
+ split(seen[line], setlist, "\n");
+ for (i in setlist) {
+ split(setlist[i], configs, ",");
+ for (j in configs) {
+ split(configs[j], temp, ":");
+ version = temp[1];
+ conf = temp[2];
+
+ if ((version,conf) in have) continue;
+ have[version,conf] = 1;
+
+ if (version in confs) {
+ split(confs[version], c, " ");
+ if (conf < c[1]) {
+ confs[version] = conf;
+ for (k = 1; k <= nconfs[version]; ++k) {
+ confs[version] = confs[version] " " c[k];
+ }
+ }
+ else {
+ confs[version] = c[1];
+ for (k = 2; k <= nconfs[version]; ++k) {
+ if (conf < c[k]) break;
+ confs[version] = confs[version] " " c[k];
+ }
+ confs[version] = confs[version] " " conf;
+ for (; k <= nconfs[version]; ++k) {
+ confs[version] = confs[version] " " c[k];
+ }
+ }
+ ++nconfs[version];
+ }
+ else {
+ confs[version] = conf;
+ nconfs[version] = 1;
+ }
+ }
+ }
+ for (idx in have) delete have[idx];
+
+ for (version in confs) {
+ idx = version " " confs[version];
+ if (idx in final) {
+ final[idx] = final[idx] "\n" line;
+ }
+ else {
+ final[idx] = line;
+ }
+ delete confs[version];
+ delete nconfs[version];
+ }
+ }
+
+ nstanzas = 0;
+ for (stanza in final) {
+ if (nstanzas == 0) {
+ stanzas = stanza;
+ nstanzas = 1;
+ continue;
+ }
+ split(stanzas, s, "\n");
+ if (stanza < s[1]) {
+ stanzas = stanza;
+ for (i = 1; i <= nstanzas; ++i) {
+ stanzas = stanzas "\n" s[i];
+ }
+ }
+ else {
+ stanzas = s[1];
+ for (i = 2; i <= nstanzas; ++i) {
+ if (stanza < s[i]) break;
+ stanzas = stanzas "\n" s[i];
+ }
+ stanzas = stanzas "\n" stanza;
+ for (; i <= nstanzas; ++i) {
+ stanzas = stanzas "\n" s[i];
+ }
+ }
+ ++nstanzas;
+ }
+
+ split(stanzas, order, "\n");
+ for (i = 1; i <= nstanzas; ++i) {
+ stanza = order[i];
+ print stanza;
+ outpipe = "sort";
+ print final[stanza] | outpipe;
+ close(outpipe);
+ }
+}