c, c++: attribute format on a ctor with a vbase [PR101833, PR47634]
[official-gcc.git] / gcc / opt-gather.awk
blob1a4c66ceb7356782eba015f9aeb4759239ebae73
1 # Copyright (C) 2003-2022 Free Software Foundation, Inc.
2 # Contributed by Kelley Cook, June 2004.
3 # Original code from Neil Booth, May 2003.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 3, or (at your option) any
8 # later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>.
19 # This Awk script takes a list of *.opt files and combines them into
20 # a three-field sorted list suitable for input into opt[ch]-gen.awk.
22 # Usage: awk -f opt-gather.awk file1.opt [...] > outputfile
24 function sort(ARRAY, ELEMENTS)
26 for (i = 2; i <= ELEMENTS; ++i) {
27 for (j = i; ARRAY[j-1] > ARRAY[j]; --j) {
28 temp = ARRAY[j]
29 ARRAY[j] = ARRAY[j-1]
30 ARRAY[j-1] = temp
33 return
36 BEGIN { numrec = 0 }
38 # Ignore comments and blank lines
39 /^[ \t]*(;|$)/ { flag = 0; next }
40 /^[^ \t]/ { if (flag == 0) {
41 record[++numrec] = $0
42 flag = 1 }
43 else {
44 record[numrec] = record[numrec] SUBSEP $0
48 # Sort it and output it
49 END {
50 sort(record,numrec)
52 for (i = 1; i <= numrec; i++) {
53 print record[i] }