Email List: Xaustin-group-lX
[All Lists]

Re: c99 -I option and GCC

To: austin-group-l@xxxxxxxxxxxxx
Subject: Re: c99 -I option and GCC
From: Geoff Clare <gwc@xxxxxxxxxxxxx>
Date: Thu, 6 Aug 2009 11:48:31 +0100
References: <4a76fb43.lbC4QjMxLz0GOnAz%Joerg.Schilling@fokus.fraunhofer.de> <200908031526.n73FQ0M7002876@aragorn.savarese.org> <20090804003819.GE3746@prunille.vinc17.org> <20090804083311.GA29260@squonk.masqnet> <20090804115624.GD1239@prunille.vinc17.org> <20090805145911.GA7443@squonk.masqnet> <20090805193045.GN18655@prunille.vinc17.org>
Vincent Lefevre <vincent-opgr@vinc17.org> wrote, on 05 Aug 2009:
>
> On 2009-08-05 15:59:11 +0100, Geoff Clare wrote:
> > The default behaviour when an option that has option-arguments is
> > repeated is stated in Syntax Guideline 11:
> > 
> >     If an option that has option-arguments is repeated, the option and
> >     option-argument combinations should [shall for standard utilities]
> >     be interpreted in the order specified on the command line.
> > 
> > In cases where one overrides the other, it would need to be stated
> > explicitly in the utility description.
> 
> But this is just a default behavior. Because of the rule concerning
> -U vs -D, the status of this guideline here is not clear.

On the contrary, it is perfectly clear.  That part of guideline 11
is about repeating the same option; it has nothing to do with
interactions between different options.  Therefore statements
about interactions between different options have no bearing on
whether guideline 11 applies.

> Even
> without that rule. For instance, if you assume that there is no
> override, then with -DFOO=1 -DFOO=2, should this be like
> 
> #define FOO 1
> #define FOO 2
> 
> or
> 
> #define FOO 2
> #define FOO 1
> 
> (as the #define are seen as being preprended to the source)?
> 
> Even though both forms will yield undefined behavior, the
> specification comes first. And if you assume that the spec is not
> clear enough to determine the order, one can also assume that it is
> not clear enough to determine whether one can consider that -DFOO=2
> overrides -DFOO=1, and this is left to the implementation.

I'll grant that there is enough wriggle room to allow the -D
options to be implemented by "prepending" #define directives; thus
the diagnostic could indicate that the -DFOO=1 is where the error
occurs rather than the -DFOO=2.  However, I can see no reasonable
interpretation that allows one to override the other.

-- 
Geoff Clare <g.clare@opengroup.org>
The Open Group, Thames Tower, Station Road, Reading, RG1 1LX, England

<Prev in Thread] Current Thread [Next in Thread>