[PR c++/84492] stmt expr ending with overload
[official-gcc.git] / gcc / config / avr / genmultilib.awk
blobb181135aa306f596e89b9d52b958b9c394aef328
1 # Copyright (C) 2011-2018 Free Software Foundation, Inc.
3 # This file is part of GCC.
5 # GCC is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free
7 # Software Foundation; either version 3, or (at your option) any later
8 # version.
10 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GCC; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>.
19 ##################################################################
21 # Transform Core/Device Information from avr-mcus.def to a
22 # Representation that is understood by GCC's multilib Machinery.
24 # The Script works as a Filter from STDIN to STDOUT.
25 # It generates a Makefile Snippet that sets some
26 # MULTILIB_* Variables as needed.
28 ##################################################################
30 BEGIN {
31 FS ="[(, \t]+"
32 option[""] = ""
33 comment = 1
35 dir_tiny = "tiny-stack"
36 opt_tiny = "msp8"
38 dir_rcall = "short-calls"
39 opt_rcall = "mshort-calls"
41 # awk Variable Makefile Variable
42 # ------------------------------------------
43 # m_options <-> MULTILIB_OPTIONS
44 # m_dirnames <-> MULTILIB_DIRNAMES
45 # m_required <-> MULTILIB_REQUIRED
46 m_sep = ""
47 m_options = "\nMULTILIB_OPTIONS = "
48 m_dirnames = "\nMULTILIB_DIRNAMES ="
49 m_required = "\nMULTILIB_REQUIRED ="
52 ##################################################################
53 # Add some Comments to the generated Files and copy-paste
54 # Copyright Notice from above.
55 ##################################################################
57 /^#/ {
58 if (!comment)
59 next
60 else if (comment == 1)
62 print "# Auto-generated Makefile Snip"
63 print "# Generated by : ./gcc/config/avr/genmultilib.awk"
64 print "# Generated from : ./gcc/config/avr/avr-mcus.def"
65 print "# Used by : tmake_file from Makefile and genmultilib"
66 print ""
69 comment = 2;
71 print
74 /^$/ {
75 # The first empty line stops copy-pasting the GPL comments
76 # from this file to the generated file.
78 comment = 0
81 ##################################################################
82 # Run over all AVR_MCU Lines. If we encounter a required multilib
83 # variant, add according combination of options to m_required,
84 # but onyl once. Add encountered cores to m_dirnames and
85 # according -mmcu= options to m_options.
86 ##################################################################
88 /^AVR_MCU/ {
89 name = $2
90 gsub ("\"", "", name)
92 if ($5 == "NULL")
94 core = name
96 # avr1 is supported for Assembler only: It gets no multilib
97 if (core == "avr1")
98 next
100 option[core] = "mmcu=" core
102 m_options = m_options m_sep option[core]
103 m_dirnames = m_dirnames " " core
104 m_sep = "/"
106 next
109 # avr1 is supported for Assembler only: Its Devices are ignored
110 if (core == "avr1")
111 next
113 opts = option[core]
115 # split device specific feature list
116 n = split($4,dev_attribute,"|")
118 for (i=1; i <= n; i++)
120 if (dev_attribute[i] == "AVR_SHORT_SP")
121 opts = opts "/" opt_tiny
122 if (dev_attribute[i] == "AVR_ISA_RCALL")
123 opts = opts "/" opt_rcall
126 if (!have[opts])
128 have[opts] = 1
129 # Some special handling for the default mmcu: Remove a
130 # leading "mmcu=avr2/" in order not to confuse genmultilib.
131 gsub (/^mmcu=avr2\//, "", opts)
132 if (opts != "mmcu=avr2")
133 m_required = m_required " \\\n\t" opts
137 ##################################################################
139 ##################################################################
141 END {
142 ############################################################
143 # Output that Stuff
144 ############################################################
146 # Intended Target: ./gcc/config/avr/t-multilib
148 print m_options " " opt_tiny " " opt_rcall
149 print m_dirnames " " dir_tiny " " dir_rcall
150 print m_required