Fix xfail for 32-bit hppa*-*-* in gcc.dg/pr84877.c
[official-gcc.git] / gcc / options-urls-cc-gen.awk
bloba2933233abef231f5b8f214bdbef16b2115ce307
1 # Copyright (C) 2023-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify it
4 # under the terms of the GNU General Public License as published by the
5 # Free Software Foundation; either version 3, or (at your option) any
6 # later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 # This Awk script reads in the option records generated from
18 # opt-gather.awk, and generates a C++ file containing an array
19 # of URL suffixes (possibly NULL), one per option.
21 # This program uses functions from opt-functions.awk and code from
22 # opt-read.awk.
24 # Usage: awk -f opt-functions.awk -f opt-read.awk -f options-urls-cc-gen.awk \
25 # [-v header_name=header.h] < inputfile > options-urls.cc
27 END {
30 print "/* This file is auto-generated by options-urls-cc-gen.awk. */"
31 print ""
32 n_headers = split(header_name, headers, " ")
33 for (i = 1; i <= n_headers; i++)
34 print "#include " quote headers[i] quote
35 print "#include " quote "opts.h" quote
36 print "#include " quote "intl.h" quote
37 print "#include " quote "insn-attr-common.h" quote
38 print ""
40 if (n_extra_c_includes > 0) {
41 for (i = 0; i < n_extra_c_includes; i++) {
42 print "#include " quote extra_c_includes[i] quote
44 print ""
47 print "const char *"
48 print "get_opt_url_suffix (int option_index, unsigned lang_mask)"
49 print "{"
50 print " switch (option_index)"
51 print " {"
54 optindex = 0
55 for (i = 0; i < n_opts; i++) {
56 # Combine the flags of identical switches. Switches
57 # appear many times if they are handled by many front
58 # ends, for example.
59 while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
60 flags[i + 1] = flags[i] " " flags[i + 1];
61 i++;
64 len = length (opts[i]);
65 enum = opt_enum(opts[i])
67 # Aliases do not get enumeration names.
68 if ((flag_set_p("Alias.*", flags[i]) \
69 && !flag_set_p("SeparateAlias", flags[i])) \
70 || flag_set_p("Ignore", flags[i])) {
71 show_case = 0;
72 } else {
73 show_case = 1;
76 if (show_case) {
77 printf(" case %s:\n", opt_enum(opts[i]))
79 # Handle any lang-specific LangUrlSuffix directives:
80 for (lang_idx = 0; lang_idx < n_langs; lang_idx++) {
81 lang_name = lang_sanitized_name(langs[lang_idx])
82 u = lang_url_suffix(flags[i], lang_name)
83 if (u != "") {
84 printf(" if (lang_mask & CL_%s)\n", lang_name)
85 printf(" return \"%s\";\n", u)
89 # Use any language-independent UrlSuffix directive:
90 u = url_suffix(flags[i])
91 if (u != "") {
92 printf(" return \"%s\";\n", u)
93 } else {
94 printf(" break;\n")
98 # Bump up the informational option index.
99 ++optindex
102 print " }"
103 print " return nullptr;"
104 print "}"