On Wed, 13 Nov 2013, Jed Brown wrote:

> Satish Balay <[email protected]> writes:
> 
> > On Wed, 13 Nov 2013, Jed Brown wrote:
> >
> >> Satish Balay <[email protected]> writes:
> >> > I don't understand why this would be needed. Thid code sets the
> >> > defaults for bopt='g' or 'O'. But if COPTFLAGS flags is set by user -
> >> > it routine should not be called. [so the above 2 lines appear to be
> >> > redundant]
> >> 
> >> How do you figure that the routine is not called when COPTFLAGS is set
> >> by the user?
> >
> > configureCompilerFlags() in compilerFlags.py does this magic..
> 
> For CFLAGS, but not for COPTFLAGS.
> 
> >>>>>>>>>>>>
> >         for bopt in bopts:
> >           if not bopt == '' and self.getOptionalFlagsName(language) in 
> > self.framework.argDB:
> >             # treat user supplied options as single option - as it could 
> > include options separated by spaces '-tp k8-64'                             
> >                                                               
> >             flags = 
> > [self.framework.argDB[self.getOptionalFlagsName(language)]]
> >           elif bopt == '' and self.getCompilerFlagsName(language) in 
> > self.framework.argDB:
> >             self.logPrint('Ignoring default options which were overridden 
> > using --'+self.getCompilerFlagsName(language)+ ' ' + 
> > self.framework.argDB[self.getCompilerFlagsName(language)])
> >             flags = []
> >           else:
> >             flags = options.getCompilerFlags(language, 
> > self.setCompilers.getCompiler(), bopt)
> 
> Notice how this one is always called, regardless of COPTFLAGS.

If COPTFLAGS is set in argDB [for either bopt= 'g' or 'O'] - the first
'if' statement is evaluated -so the 'else' block is never executed.

Similarly for CFLAGS - the second 'elif' block gets run.

You can put a print statement in getCFlags() to verify.

Satish

>  Are you are saying that we should instead add
> getCompilerOptFlagsName() and a similar guard here instead of
> putting it inside getCFlags?

Reply via email to