File: abi-versions.awk

package info (click to toggle)
glibc 2.19-18+deb8u7
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 204,748 kB
  • sloc: ansic: 970,427; asm: 241,207; sh: 10,069; makefile: 8,476; cpp: 3,595; perl: 2,077; pascal: 1,839; awk: 1,704; yacc: 317; sed: 73
file content (55 lines) | stat: -rw-r--r-- 1,327 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Script to generate <abi-versions.h> header file from Versions.all list.
# See include/shlib-compat.h comments for explanation.

# This script expects the following variables to be defined:
# oldest_abi		the oldest ABI supported

BEGIN {
  print "/* This file is automatically generated by abi-versions.awk.";
  print "   It defines symbols used by shlib-compat.h, which see.  */";
  print "\n#ifndef _ABI_VERSIONS_H\n#define _ABI_VERSIONS_H";
}

NF == 2 && $2 == "{" {
  thislib = $1;
  gsub(/[^A-Za-z0-9_ 	]/, "_"); libid = $1;
  printf "\n/* start %s */\n", thislib;
  n = 0;
  start = 0;
  next;
}
$1 == "}" {
  printf "/* end %s */\n", thislib;
  next;
}

$2 == "=" {
  old = $1; new = $3;
  gsub(/[^A-Za-z0-9_ 	]/, "_");
  oldid = $1; newid = $3;

  printf "#define ABI_%s_%s\tABI_%s_%s\n", libid, oldid, libid, newid;
  printf "#define VERSION_%s_%s\t%s\n", libid, oldid, new;

  if ("GLIBC_" oldest_abi == old)
    oldest_abi = "default";
  next;
}

{
  vers = $1;
  gsub(/[^A-Za-z0-9_ 	]/, "_");
  versid = $1;

  printf "#define ABI_%s_%s\t%d\t/* support %s */\n", libid, versid, ++n, vers;
  printf "#define VERSION_%s_%s\t%s\n", libid, versid, vers;
  if ("GLIBC_" oldest_abi == vers)
    start = 1;
  if (start == 0 && oldest_abi != "default")
    --n;
  next;
}

END {
  print "\n#endif /* abi-versions.h */";
}