diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-05-04 12:01:56 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-05-04 12:02:57 +0200 |
commit | 8afcd148103b0467126483151b6fb5ac68920e72 (patch) | |
tree | 3fac7cbbe6d12c0047d4212d5d3e0441901fc8a0 /gcc/cp/constexpr.cc | |
parent | 7499c13ce3bf510a6244c1840348f305b66a2513 (diff) | |
download | gcc-8afcd148103b0467126483151b6fb5ac68920e72.zip gcc-8afcd148103b0467126483151b6fb5ac68920e72.tar.gz gcc-8afcd148103b0467126483151b6fb5ac68920e72.tar.bz2 |
genconditions: Add support for targets without non-trivial insn conditions
Somebody complained on IRC that when writing a new backend one can get
an error while compiling build/gencondmd.cc.
The problem is that when host compiler is g++ 3 or later (or when
bootstrapping), we compile it with g++ -std=c++11 -pedantic and
the generated insn_conditions array contains pairs
{ "cond", __builtin_constant_p (cond) ? (int) (cond) : -1 },
where cond is some non-trivial instruction condition. Now if a target
uses "" for all the conditions (admittedly unlikely for non-trivial
target), the initializer for insn_conditions[] is {} and that is
pedantically rejected because C++ doesn't support zero-sized arrays.
The following patch fixes that by adding an artificial termination
element and skips that during the walk.
2022-05-04 Jakub Jelinek <jakub@redhat.com>
* genconditions.cc (write_conditions): Append a { nullptr, -1 }
element at the end of insn_conditions.
(write_writer): Use ARRAY_SIZE (insn_conditions) - 1 instead of
ARRAY_SIZE (insn_conditions).
Diffstat (limited to 'gcc/cp/constexpr.cc')
0 files changed, 0 insertions, 0 deletions