PING^1: [PATCH] driver: Also prune joined switches with negation

Jakub Jelinek jakub@redhat.com
Wed Feb 13 08:02:00 GMT 2019


On Wed, Feb 13, 2019 at 08:43:45AM +0100, Jakub Jelinek wrote:
> > It seems right in the march= case to handle that combination as 
> > -march=foobar - but it's less clear if that must always be the case for 
> > Joined options with negative versions (at least, the semantics would need 
> > defining more carefully in options.texi, with an analysis of existing 
> > affected options).
> 
> We have only a few Joined/JoinedOrMissing options with Negative:
> find . -name \*.opt | xargs grep -B1 'Joined.*[[:blank:]]Negative\|[[:blank:]]Negative.*Joined\|^Negative.*Joined'
> ./config/s390/s390.opt-mstack-guard=
> ./config/s390/s390.opt:Target RejectNegative Negative(mno-stack-guard) Joined UInteger Var(s390_stack_guard) Save
> ./common.opt-gdwarf
> ./common.opt:Common Driver JoinedOrMissing Negative(gdwarf-)
> ./common.opt-gdwarf-
> ./common.opt:Common Driver Joined UInteger Var(dwarf_version) Init(4) Negative(gstabs)
> ./common.opt-gstabs
> ./common.opt:Common Driver JoinedOrMissing Negative(gstabs+)
> ./common.opt-gstabs+
> ./common.opt:Common Driver JoinedOrMissing Negative(gvms)
> ./common.opt-gvms
> ./common.opt:Common Driver JoinedOrMissing Negative(gxcoff)
> ./common.opt-gxcoff
> ./common.opt:Common Driver JoinedOrMissing Negative(gxcoff+)
> ./common.opt-gxcoff+
> ./common.opt:Common Driver JoinedOrMissing Negative(gdwarf)
> ./fortran/lang.opt-cpp=
> ./fortran/lang.opt:Fortran Joined Negative(nocpp) Undocumented NoDWARFRecord
> 
> The patch indeed does change behavior for say:
> gcc -c test.s -gstabs2 -gdwarf-4 -gstabs3
> gcc: error: debug format ‘dwarf-2’ conflicts with prior selection
> gcc: error: debug format ‘stabs’ conflicts with prior selection
> (previously the above errors, now accepted as -gstabs3)
> but wouldn't that be an advantage here (use the latest option win)?
> 
> For s390 (which has it weird, as there is no Negative(mno-stack-size) on
> very similar mstack-size= option), I believe it shouldn't change end result,
> while the driver will not pass 3 options for
> -mno-stack-guard -mstack-guard=64 -mno-stack-guard
> but just the last one (similarly for other combinations), the option
> handling in cc1 etc. will handle it the same anyway (last option wins)
> it seems.
> 
> And finally Fortran -cpp= option is internally generated from -cpp which
> should have normal Negative processing with -nocpp.

On the other side, the reason this Skip Joined stuff has been added to
opts-common.c is PR28437 r115780, and the patch as posted indeed does break
-fno-builtin-free -fno-builtin-malloc -fno-builtin-calloc - only the last of
the options is passed in with the patch, all before.  If this didn't show up
during regtest, guess we want a testcase that will pass multiple
-fno-builtin- options and verify e.g. through bogus warnings that all of
them are in effect.
fbuiltin- is
C ObjC C++ ObjC++ Joined
and so neg_index is not -1, but the option index itself, but that is what
the patch wants to use for march= etc. too.
So, do we want a new *.opt flag that would enable this behavior, or key
that on cl_reject_negative?

	Jakub



More information about the Gcc-patches mailing list