public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3692] options: Avoid unused variable mask warning [PR97305]
@ 2020-10-07 8:54 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-10-07 8:54 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e91c34262d2dd06da4b9436744bff89007dee2c9
commit r11-3692-ge91c34262d2dd06da4b9436744bff89007dee2c9
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Oct 7 10:52:47 2020 +0200
options: Avoid unused variable mask warning [PR97305]
> options-save.c: In function 'void cl_target_option_save(cl_target_option*, gcc_options*, gcc_options*)':
> options-save.c:8526:26: error: unused variable 'mask' [-Werror=unused-variable]
> 8526 | unsigned HOST_WIDE_INT mask = 0;
> | ^~~~
> options-save.c: In function 'void cl_target_option_restore(gcc_options*, gcc_options*, cl_target_option*)':
> options-save.c:8537:26: error: unused variable 'mask' [-Werror=unused-variable]
> 8537 | unsigned HOST_WIDE_INT mask;
> | ^~~~
Oops, missed that, sorry.
The following patch should fix that, tested on x86_64-linux make
options-save.c (same file as before) and -> ia64-linux cross make
options-save.o (no warning anymore, just the unwanted declarations gone).
2020-10-07 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/97305
* optc-save-gen.awk: Don't declare mask variable if explicit_mask
array is not present.
Diff:
---
gcc/optc-save-gen.awk | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk
index 5169acd5f58..a756835230e 100644
--- a/gcc/optc-save-gen.awk
+++ b/gcc/optc-save-gen.awk
@@ -597,11 +597,13 @@ for (i = 0; i < n_target_string; i++) {
}
print "";
-print " unsigned HOST_WIDE_INT mask = 0;";
j = 0;
k = 0;
for (i = 0; i < n_extra_target_vars; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" extra_target_vars[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -617,6 +619,9 @@ for (i = 0; i < n_target_other; i++) {
print " ptr->explicit_mask_" var_target_other[i] " = opts_set->x_" var_target_other[i] ";";
continue;
}
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_other[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -628,6 +633,9 @@ for (i = 0; i < n_target_other; i++) {
}
for (i = 0; i < n_target_enum; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_enum[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -643,6 +651,9 @@ for (i = 0; i < n_target_int; i++) {
print " ptr->explicit_mask_" var_target_int[i] " = opts_set->x_" var_target_int[i] ";";
continue;
}
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_int[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -654,6 +665,9 @@ for (i = 0; i < n_target_int; i++) {
}
for (i = 0; i < n_target_short; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_short[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -665,6 +679,9 @@ for (i = 0; i < n_target_short; i++) {
}
for (i = 0; i < n_target_char; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_char[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -676,6 +693,9 @@ for (i = 0; i < n_target_char; i++) {
}
for (i = 0; i < n_target_string; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_string[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -732,7 +752,9 @@ for (i = 0; i < n_target_string; i++) {
}
print "";
-print " unsigned HOST_WIDE_INT mask;";
+if (has_target_explicit_mask) {
+ print " unsigned HOST_WIDE_INT mask;";
+}
j = 64;
k = 0;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-07 8:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 8:54 [gcc r11-3692] options: Avoid unused variable mask warning [PR97305] Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).