[committed] RISC-V: Suppress build warnings
Commit Message
../../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<std::__cxx11::basic_string<char> >&)' 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.
---
gcc/common/config/riscv/riscv-common.cc | 36 ++++++++++++-------------
1 file changed, 18 insertions(+), 18 deletions(-)
@@ -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 (