summary refs log tree commit diff
path: root/scripts/merge-abilist.awk
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-03 02:38:36 +0000
committerRoland McGrath <roland@gnu.org>2003-03-03 02:38:36 +0000
commit8f3846a978212ebfb1c3bbaa436bd0b1668afa27 (patch)
tree2096bcfa69a0bb8e77f8c736f561ae673ceb4cc4 /scripts/merge-abilist.awk
parent44aeb4868c93ed6981869a5b933d76d7d55800c2 (diff)
downloadglibc-8f3846a978212ebfb1c3bbaa436bd0b1668afa27.tar.gz
glibc-8f3846a978212ebfb1c3bbaa436bd0b1668afa27.tar.xz
glibc-8f3846a978212ebfb1c3bbaa436bd0b1668afa27.zip
* scripts/merge-abilist.awk: More checks for bogus input.
	Uniquify duplicate config names.

	* scripts/abilist.awk: Don't distinguish weak symbols in normal output.
Diffstat (limited to 'scripts/merge-abilist.awk')
-rw-r--r--scripts/merge-abilist.awk25
1 files changed, 19 insertions, 6 deletions
diff --git a/scripts/merge-abilist.awk b/scripts/merge-abilist.awk
index 03675f299f..88ca0b08ea 100644
--- a/scripts/merge-abilist.awk
+++ b/scripts/merge-abilist.awk
@@ -12,9 +12,11 @@
 #	 function F
 #	 variable D 0x4
 
+BEGIN { current = "UNSET" }
+
 /^[^| ]/ {
   if (NF < 2 && config == "") {
-    print "BAD LINE:", $0 > "/dev/stderr";
+    print FILENAME ":" FNR ": BAD SET LINE:", $0 > "/dev/stderr";
     exit 2;
   }
 
@@ -44,8 +46,8 @@
 }
 
 /^\| / {
-  if (NF < 3) {
-    print "BAD LINE:", $0 > "/dev/stderr";
+  if (NF < 3 || current == "UNSET") {
+    print FILENAME ":" FNR ": BAD | LINE:", $0 > "/dev/stderr";
     exit 2;
   }
 
@@ -61,12 +63,20 @@
 
 {
   if (current == "") next;
+  if (current == "UNSET") {
+    print FILENAME ":" FNR ": IGNORED LINE:", $0 > "/dev/stderr";
+    next;
+  }
 
   ns = split(seen[$0], s, ",");
   nc = split(current, c, ",");
   for (i = 1; i <= nc; ++i) {
+    if (c[i] == "")
+      continue;
     # Sorted insert.
     for (j = 1; j <= ns; ++j) {
+      if (c[i] == s[j])
+        break;
       if (c[i] < s[j]) {
 	for (k = ns; k >= j; --k)
 	  s[k + 1] = s[k];
@@ -75,7 +85,7 @@
 	break;
       }
     }
-    if (j >= ns)
+    if (j > ns)
       s[++ns] = c[i];
   }
 
@@ -97,7 +107,9 @@ END {
   ns = split("", s);
   for (configs in stanzas) {
     # Sorted insert.
-    for (j = 1; j <= ns; ++j)
+    for (j = 1; j <= ns; ++j) {
+      if (configs == s[j])
+        break;
       if (configs < s[j]) {
 	for (k = ns; k >= j; --k)
 	  s[k + 1] = s[k];
@@ -105,7 +117,8 @@ END {
 	++ns;
 	break;
       }
-    if (j >= ns)
+    }
+    if (j > ns)
       s[++ns] = configs;
   }