tile: Check for pointer add overflow in memchr
[glibc.git] / scripts / soversions.awk
blob247f061bc37b2a859aa0b2964baf0028c079730b
1 # awk script for shlib-versions.v -> soversions.i; see Makeconfig.
3 # Obey the first matching DEFAULT line.
4 $1 == "DEFAULT" {
5 $1 = "";
6 default_set[++ndefault_set] = $0;
7 next
10 # Collect all lib lines before emitting anything, so DEFAULT
11 # can be interspersed.
13 lib = number = $1;
14 sub(/=.*$/, "", lib);
15 sub(/^.*=/, "", number);
16 if (lib in numbers) next;
17 numbers[lib] = number;
18 order[lib] = ++order_n;
19 if (NF > 1) {
20 $1 = "";
21 versions[lib] = $0
25 END {
26 for (lib in numbers) {
27 if (lib in versions)
28 set = versions[lib];
29 else {
30 set = "";
31 if (ndefault_set >= 1)
32 set = default_set[1];
34 line = set ? (lib FS numbers[lib] FS set) : (lib FS numbers[lib]);
35 if (!(lib in lineorder) || order[lib] < lineorder[lib]) {
36 lineorder[lib] = order[lib];
37 lines[lib] = "DEFAULT" FS line;
40 for (c in lines) {
41 print lines[c]