aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2025-02-05 12:01:55 +0100
committerGeorg-Johann Lay <avr@gjlay.de>2025-02-06 15:06:18 +0100
commit5282e13a938404d7d4edc0ccfe6cbe9b4f980d7e (patch)
tree6408dec3a3b6f335d39475f772ab0d2c69d84512 /gcc
parent50d2bde68a097c2e9fb3bdd7e6664c8988889828 (diff)
downloadgcc-5282e13a938404d7d4edc0ccfe6cbe9b4f980d7e.zip
gcc-5282e13a938404d7d4edc0ccfe6cbe9b4f980d7e.tar.gz
gcc-5282e13a938404d7d4edc0ccfe6cbe9b4f980d7e.tar.bz2
AVR: genmultilib.awk - Use more robust parsing of spaces.
gcc/ PR target/118768 * config/avr/genmultilib.awk: Parse the AVR_MCU lines in a more robust way w.r.t. white spaces.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/avr/genmultilib.awk37
1 files changed, 32 insertions, 5 deletions
diff --git a/gcc/config/avr/genmultilib.awk b/gcc/config/avr/genmultilib.awk
index 71099e8..e824be6 100644
--- a/gcc/config/avr/genmultilib.awk
+++ b/gcc/config/avr/genmultilib.awk
@@ -31,6 +31,7 @@ BEGIN {
FS ="[(, \t]+"
option[""] = ""
comment = 1
+ cols_expected = -1
dir_tiny = "tiny-stack"
opt_tiny = "msp8"
@@ -136,10 +137,36 @@ BEGIN {
##################################################################
/^AVR_MCU/ {
- name = $2
- gsub ("\"", "", name)
+ line = $0
+ gsub (/\(/, ",", line)
+ gsub (/[ \t")]/, "", line)
+ n_cols = split (line, col, ",")
+
+ # Now we have col[] something like:
+ # col[1] = AVR_MCU
+ # col[2] = avr2 # Device name
+ # col[3] = ARCH_AVR2 # Core
+ # col[4] = AVR_ERRATA_SKIP # Device Attributes
+ # col[5] = NULL # Device Macro like __AVR_ATtiny22__
+ # col[6] = 0x0060 # Tdata
+ # col[7] = 0x0 # Ttext
+ # col[8] = 0x60000 # Flash Size
+ # col[9] = 0 # PM Offset
+
+ # Sanity check the number of columns.
+ if (cols_expected == -1)
+ cols_expected = n_cols
+ else if (n_cols != cols_expected)
+ {
+ msg = "genmultilib.awk: error: wrong number of columns"
+ print msg | "cat 1>&2"
+ print $0 | "cat 1>&2"
+ exit 1
+ }
+
+ name = col[2]
- if ($5 == "NULL")
+ if (col[5] == "NULL")
{
core = name
@@ -169,9 +196,9 @@ BEGIN {
opts = option[core]
# split device specific feature list
- n = split($4,dev_attribute,"|")
+ n = split (col[4], dev_attribute, "|")
- for (i=1; i <= n; i++)
+ for (i = 1; i <= n; i++)
{
if (dev_attribute[i] == "AVR_SHORT_SP")
opts = opts "/" opt_tiny