[Xorp-hackers] [PATCH 1/3] SConstruct fixes

Igor Maravić igorm at etf.rs
Wed Sep 28 05:39:36 PDT 2011


Yes that check will be false when optimize is set to override.

override without options CFLAGS and CXXFLAGS is same as option none.

Without my patch, there is no point for the line that I marked with
<===, because that flag will never be appended to CFLAGS/CXXFLAGS in
if statement that I proposed to change.

bigodict = { 'no': '-O0', <===
                 # 'minimal' denotes only those optimizations
                 # necessary to force gcc to perform the tree_sink
                 # pass, to elide most STL template instantiations.
                 'minimal': "-O1 -fno-defer-pop -fno-delayed-branch \
-fno-guess-branch-probability -fno-cprop-registers -fno-if-conversion \
-fno-if-conversion2 -fno-tree-ccp -fno-tree-dce -fno-tree-dominator-opts \
-fno-tree-dse -fno-tree-ter -fno-tree-lrs -fno-tree-sra \
-fno-tree-copyrename -fno-tree-fre -fno-tree-ch -fno-unit-at-a-time \
-fno-merge-constants",
                 'yes': '-O1',
                 'full': '-O2',
                 'highest': '-O3',
                 'size': '-Os' }

Also if someone compiles with the command

scons optimize=override CFLAGS=-01 CXXFLAGS=-O0

there is no need to to append something to CFLAGS/CXXFLAGS, when we
want to override there behavior.
I marked the lines with <==, and that is the if statement that I want to change.

if not env['optimize'] == 'no':
        env.AppendUnique(CFLAGS = [ bigoflag ]) <==
        env.AppendUnique(CXXFLAGS = [ bigoflag ]) <==

That's why I think that my patch should be applied.
BR
Igor Maravic

2011/9/27 Ben Greear <greearb at candelatech.com>:
> On 09/27/2011 04:30 AM, Igor Maravic wrote:
>>
>> Signed-off-by: Igor Maravic<igorm at etf.rs>
>> ---
>> :100644 100644 955e743... 9f5dd79... M  xorp/SConstruct
>>  xorp/SConstruct |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/xorp/SConstruct b/xorp/SConstruct
>> index 955e743..9f5dd79 100644
>> --- a/xorp/SConstruct
>> +++ b/xorp/SConstruct
>> @@ -713,7 +713,7 @@ if not env['optimize'] == 'override':
>>                   'highest': '-O3',
>>                   'size': '-Os' }
>>      bigoflag = bigodict[env['optimize']]
>> -    if not env['optimize'] == 'no':
>> +    if not env['optimize'] == 'override':
>>          env.AppendUnique(CFLAGS = [ bigoflag ])
>>          env.AppendUnique(CXXFLAGS = [ bigoflag ])
>
> Can that check ever be false?  I think it cannot.  And if it cannot,
> then I do not want to apply this patch.
>
> The reason I suggested adding none is if someone wants to use the
> compiler default and not use any -O option (which supports the
> current optimize=no behaviour in case someone finds that useful).
>
> Thanks,
> Ben
>
>
> --
> Ben Greear <greearb at candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
>
>



More information about the Xorp-hackers mailing list