RISC-V: Fix compilation failed for frflags builtin in C++ mode
authorKito Cheng <kito.cheng@sifive.com>
Fri, 19 Jun 2020 06:07:39 +0000 (14:07 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Mon, 22 Jun 2020 02:44:44 +0000 (10:44 +0800)
commit33d9794b7277a64543914bfbbfd567505e72da6c
treee226a515d5d0b4b4daa03006a7891d3f44f0628f
parentf86e11a267aa70c56b300cfe60cfe3a27111b204
RISC-V: Fix compilation failed for frflags builtin in C++ mode

  - g++ will complain too few arguments for frflags builtin like bellow
    message:

    error: too few arguments to function 'unsigned int __builtin_riscv_frflags(void)'

  - However it's no arguments needed, it because we declare the function
    type with VOID arguments, that seems like require a VOID argument
    in the c++ front-end when GCC tried to resolve the function.

gcc/ChangeLog

* config/riscv/riscv-builtins.c (RISCV_FTYPE_NAME0): New.
(RISCV_FTYPE_ATYPES0): New.
(riscv_builtins): Using RISCV_USI_FTYPE for frflags.
* config/riscv/riscv-ftypes.def: Remove VOID argument.

gcc/testsuite/ChangeLog

* g++.target/riscv/frflags.C: New.
gcc/config/riscv/riscv-builtins.c
gcc/config/riscv/riscv-ftypes.def
gcc/testsuite/g++.target/riscv/frflags.C [new file with mode: 0644]