/cp
[official-gcc.git] / gcc / config / vms / make-crtlmap.awk
blobab9d609337734ae870f1fc391f55c1da6750be9f
1 # Generate the VMS crtl map
2 # Copyright (C) 2011-2018 Free Software Foundation, Inc.
4 BEGIN {
5 is_first = 1;
6 maxlen=1;
7 maxlen_name="??"
8 prev=""
9 ORS=""
12 # Remove comment and blank lines.
13 /^ *#/ || /^ *$/ {
14 next;
18 # Handle comma
19 if (!is_first)
20 print ",\n"
21 else
22 is_first = 0;
24 # Check the map is sorted
25 if ($0 <= prev)
27 print "Map not sorted!! (with name " $0 ")\n"
28 exit 1
30 prev = $0
32 # Compute the max of the identifier len.
33 l=length($1)
34 if (l > maxlen)
36 maxlen = l
37 maxlen_name = $1
40 print "{ \"" $1 "\", "
41 if (NF == 1)
42 print "0 }"
43 else
45 printf "VMS_CRTL_" $2
46 for (i = 3; i <= NF; i++)
47 printf " | VMS_CRTL_" $i
48 printf " }"
52 END {
53 print "\n\n"
54 print "#define VMS_CRTL_MAXLEN " maxlen " /*" maxlen_name " */\n"