]> git.ipfire.org Git - thirdparty/gcc.git/commit
gensupport: validate compact constraint modifiers
authorRichard Earnshaw <rearnsha@arm.com>
Mon, 14 Apr 2025 14:46:54 +0000 (15:46 +0100)
committerRichard Earnshaw <rearnsha@arm.com>
Thu, 8 May 2025 12:22:35 +0000 (13:22 +0100)
commit62dec5d9f60a0207c3c9147ceb8d4f7281e3fa80
tree7120d153b47d4e8d0558d5e90933ea326f6f994e
parentf260146bc05f6fba7b2a67a62063c770588b769d
gensupport: validate compact constraint modifiers

For constraints there are operand modifiers and constraint qualifiers.
Operand modifiers apply to all alternatives and must appear, in
traditional syntax before the first alternative.  Constraint
qualifiers, on the other hand must appear in each alternative to which
they apply.

There's no easy way to validate the distinction in the traditional md
format, but when using the new compact format we can enforce some
semantic checking of these characters to avoid some potentially
surprising code generation.

gcc/

* gensupport.cc (conlist::conlist): Pass a location to the constructor.
Only allow skipping of non-alpha-numeric characters when parsing a
number and only allow '=', '+' or '%'.  Add some error checking when
parsing an operand number.
(parse_section_layout): Pass the location to the conlist constructor.
(parse_section): Allow an optional list of forbidden characters.
If specified, reject strings containing them.
(convert_syntax): Reject '=', '+' or '%' in an alternative.
gcc/gensupport.cc