]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Attribute parser: Use alloca() instead of new + std::unique_ptr
authorChristoph Müllner <christoph.muellner@vrull.eu>
Fri, 5 Jul 2024 02:48:15 +0000 (04:48 +0200)
committerChristoph Müllner <christoph.muellner@vrull.eu>
Mon, 15 Jul 2024 17:03:07 +0000 (19:03 +0200)
commit5040c273484d7123a40a99cdeb434cecbd17a2e9
treed82b87e165454c8bd1d35c7131327e5b4984cf4b
parentbf8e80f9d164f8778d86a3dc50e501cf19a9eff1
RISC-V: Attribute parser: Use alloca() instead of new + std::unique_ptr

Allocating an object on the heap with new, wrapping it in a
std::unique_ptr and finally getting the buffer via buf.get()
is a correct way to allocate a buffer that is automatically
freed on return.  However, a simple invocation of alloca()
does the same with less overhead.

gcc/ChangeLog:

* config/riscv/riscv-target-attr.cc (riscv_target_attr_parser::parse_arch):
Replace new + std::unique_ptr by alloca().
(riscv_process_one_target_attr): Likewise.
(riscv_process_target_attr): Likewise.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
gcc/config/riscv/riscv-target-attr.cc