From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2093) id 0CAAC38582BF; Fri, 9 Sep 2022 09:53:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CAAC38582BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662717225; bh=5Ale1EvTTok4PqB8YGDgjjVDN2LyxSPJLckarQd6wj8=; h=From:To:Subject:Date:From; b=qTG5krEh8iC3ZHh9eOVzFmEw/+8g6kWhI46EXH9BNRYumGLTH4qcsRfWBlNyOPMVB QFXtIjn0DMBgbZos2335T9L94QJdxbex1jPzZ8ql2/1bqC2rmgpNX3J/SjByHSUADP QuFk+XTEkO1zJxWgrDQuLE6YpsextxxJReZ1fA14= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Kito Cheng To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2558] RISC-V: Suppress build warnings X-Act-Checkin: gcc X-Git-Author: Kito Cheng X-Git-Refname: refs/heads/master X-Git-Oldrev: 923da63e0f69b091014df5cc91498756053b1a46 X-Git-Newrev: 6aafd6b797d823fa4e888c36e08f9577137809c6 Message-Id: <20220909095345.0CAAC38582BF@sourceware.org> Date: Fri, 9 Sep 2022 09:53:45 +0000 (GMT) List-Id: https://gcc.gnu.org/g:6aafd6b797d823fa4e888c36e08f9577137809c6 commit r13-2558-g6aafd6b797d823fa4e888c36e08f9577137809c6 Author: Kito Cheng Date: Fri Sep 9 16:39:08 2022 +0800 RISC-V: Suppress build warnings ../../gcc/common/config/riscv/riscv-common.cc: In function 'const char* riscv_multi_lib_check(int, const char**)': ../../gcc/common/config/riscv/riscv-common.cc:1451:11: error: bare apostrophe ''' in format [-Werror=format-diag] 1451 | "Can't find suitable multilib set for %<-march=%s%>/%<-mabi=%s%>", | ^ ../../gcc/common/config/riscv/riscv-common.cc:1451:7: note: if avoiding the apostrophe is not feasible, enclose it in a pair of '%<' and '%>' directives instead 1451 | "Can't find suitable multilib set for %<-march=%s%>/%<-mabi=%s%>", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../gcc/common/config/riscv/riscv-common.cc: At global scope: ../../gcc/common/config/riscv/riscv-common.cc:1492:1: error: 'int riscv_check_conds(const switchstr*, int, int, const std::vector >&)' defined but not used [-Werror=unused-function] 1492 | riscv_check_conds ( | ^~~~~~~~~~~~~~~~~ ../../gcc/common/config/riscv/riscv-common.cc:1374:1: error: 'const char* find_last_appear_switch(const switchstr*, int, const char*)' defined but not used [-Werror=unused-function] 1374 | find_last_appear_switch ( | ^~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors make[3]: *** [Makefile:2442: riscv-common.o] Error 1 gcc/ChangeLog: * common/config/riscv/riscv-common.cc (RISCV_USE_CUSTOMISED_MULTI_LIB): Move forward for cover all all necessary functions for suppress unused function warnings. (riscv_multi_lib_check): Move forward, and tweak message to suppress -Werror=format-diag warning. Diff: --- gcc/common/config/riscv/riscv-common.cc | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 120a0384686..77219162eeb 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -1366,6 +1366,24 @@ riscv_expand_arch_from_cpu (int argc ATTRIBUTE_UNUSED, return xasprintf ("-march=%s", arch.c_str()); } +/* Report error if not found suitable multilib. */ +const char * +riscv_multi_lib_check (int argc ATTRIBUTE_UNUSED, + const char **argv ATTRIBUTE_UNUSED) +{ + if (riscv_no_matched_multi_lib) + fatal_error ( + input_location, + "Cannot find suitable multilib set for %<-march=%s%>/%<-mabi=%s%>", + riscv_current_arch_str.c_str (), + riscv_current_abi_str.c_str ()); + + return ""; +} + +/* We only override this in bare-metal toolchain. */ +#ifdef RISCV_USE_CUSTOMISED_MULTI_LIB + /* Find last switch with the prefix, options are take last one in general, return NULL if not found, and return the option value if found, it could return empty string if the option has no value. */ @@ -1440,21 +1458,6 @@ riscv_multi_lib_info_t::parse ( return true; } -/* Report error if not found suitable multilib. */ -const char * -riscv_multi_lib_check (int argc ATTRIBUTE_UNUSED, - const char **argv ATTRIBUTE_UNUSED) -{ - if (riscv_no_matched_multi_lib) - fatal_error ( - input_location, - "Can't find suitable multilib set for %<-march=%s%>/%<-mabi=%s%>", - riscv_current_arch_str.c_str (), - riscv_current_abi_str.c_str ()); - - return ""; -} - /* Checking ARG is not appeared in SWITCHES if NOT_ARG is set or ARG is appeared if NOT_ARG is not set. */ @@ -1534,9 +1537,6 @@ riscv_check_conds ( return match_score + ok_count * 100; } -/* We only override this in bare-metal toolchain. */ -#ifdef RISCV_USE_CUSTOMISED_MULTI_LIB - /* Implement TARGET_COMPUTE_MULTILIB. */ static const char * riscv_compute_multilib (