Re: [PATCH] Avoid suspicious -Wduplicate-branches warning in lto-wrapper.c (PR lto/92972)
On December 17, 2019 9:43:26 PM GMT+01:00, Jakub Jelinek wrote: >Hi! > >big ? "-fno-pie" : "-fno-pie" doesn't make much sense, either we want >to >use big ? "-fno-PIE" : "-fno-pie", but as both mean the same thing, I >think >just using "-fno-pie" is good enough. + a few formatting nits and one >comment typo. > >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Ok. Richard. >2019-12-17 Jakub Jelinek > > PR lto/92972 > * lto-wrapper.c (merge_and_complain): Use just "-fno-pie" instead of > big ? "-fno-pie" : "-fno-pie". Formatting fixes. Fix comment typo. > >--- gcc/lto-wrapper.c.jj 2019-09-11 13:36:14.057264373 +0200 >+++ gcc/lto-wrapper.c 2019-12-17 12:28:36.135056568 +0100 >@@ -408,7 +408,7 @@ merge_and_complain (struct cl_decoded_op > /* Merge PIC options: > -fPIC + -fpic = -fpic > -fPIC + -fno-pic = -fno-pic >- -fpic/-fPIC + nothin = nothing. >+ -fpic/-fPIC + nothing = nothing. >It is a common mistake to mix few -fPIC compiled objects into otherwise > non-PIC code. We do not want to build everything with PIC then. > >@@ -438,9 +438,10 @@ merge_and_complain (struct cl_decoded_op > && pie_option->opt_index == OPT_fPIE; > (*decoded_options)[j].opt_index = big ? OPT_fPIE : OPT_fpie; > if (pie_option->value) >-(*decoded_options)[j].canonical_option[0] = big ? "-fPIE" : >"-fpie"; >+(*decoded_options)[j].canonical_option[0] >+ = big ? "-fPIE" : "-fpie"; > else >-(*decoded_options)[j].canonical_option[0] = big ? >"-fno-pie" : "-fno-pie"; >+(*decoded_options)[j].canonical_option[0] = "-fno-pie"; > (*decoded_options)[j].value = pie_option->value; > j++; > } >@@ -482,7 +483,7 @@ merge_and_complain (struct cl_decoded_op > { > (*decoded_options)[j].opt_index = OPT_fpie; > (*decoded_options)[j].canonical_option[0] >- = pic_option->value ? "-fpie" : "-fno-pie"; >+= pic_option->value ? "-fpie" : "-fno-pie"; > } > else if (!pic_option->value) > (*decoded_options)[j].canonical_option[0] = "-fno-pie"; > > Jakub
[PATCH] Avoid suspicious -Wduplicate-branches warning in lto-wrapper.c (PR lto/92972)
Hi! big ? "-fno-pie" : "-fno-pie" doesn't make much sense, either we want to use big ? "-fno-PIE" : "-fno-pie", but as both mean the same thing, I think just using "-fno-pie" is good enough. + a few formatting nits and one comment typo. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2019-12-17 Jakub Jelinek PR lto/92972 * lto-wrapper.c (merge_and_complain): Use just "-fno-pie" instead of big ? "-fno-pie" : "-fno-pie". Formatting fixes. Fix comment typo. --- gcc/lto-wrapper.c.jj2019-09-11 13:36:14.057264373 +0200 +++ gcc/lto-wrapper.c 2019-12-17 12:28:36.135056568 +0100 @@ -408,7 +408,7 @@ merge_and_complain (struct cl_decoded_op /* Merge PIC options: -fPIC + -fpic = -fpic -fPIC + -fno-pic = -fno-pic - -fpic/-fPIC + nothin = nothing. + -fpic/-fPIC + nothing = nothing. It is a common mistake to mix few -fPIC compiled objects into otherwise non-PIC code. We do not want to build everything with PIC then. @@ -438,9 +438,10 @@ merge_and_complain (struct cl_decoded_op && pie_option->opt_index == OPT_fPIE; (*decoded_options)[j].opt_index = big ? OPT_fPIE : OPT_fpie; if (pie_option->value) - (*decoded_options)[j].canonical_option[0] = big ? "-fPIE" : "-fpie"; + (*decoded_options)[j].canonical_option[0] + = big ? "-fPIE" : "-fpie"; else - (*decoded_options)[j].canonical_option[0] = big ? "-fno-pie" : "-fno-pie"; + (*decoded_options)[j].canonical_option[0] = "-fno-pie"; (*decoded_options)[j].value = pie_option->value; j++; } @@ -482,7 +483,7 @@ merge_and_complain (struct cl_decoded_op { (*decoded_options)[j].opt_index = OPT_fpie; (*decoded_options)[j].canonical_option[0] -= pic_option->value ? "-fpie" : "-fno-pie"; + = pic_option->value ? "-fpie" : "-fno-pie"; } else if (!pic_option->value) (*decoded_options)[j].canonical_option[0] = "-fno-pie"; Jakub