@@ -1017,6 +1017,7 @@ def add_compiler_options(self, options: 'MutableKeyedOptionDictType', lang: str,
10171017 value = env .options .get (k )
10181018 if value is not None :
10191019 o .set_value (value )
1020+ self .options [k ] = o # override compiler option on reconfigure
10201021 self .options .setdefault (k , o )
10211022
10221023 def add_lang_args (self , lang : str , comp : T .Type ['Compiler' ],
@@ -1028,20 +1029,20 @@ def add_lang_args(self, lang: str, comp: T.Type['Compiler'],
10281029 # `self.options.update()`` is perfectly safe.
10291030 self .options .update (compilers .get_global_options (lang , comp , for_machine , env ))
10301031
1031- def process_new_compiler (self , lang : str , comp : 'Compiler' , env : 'Environment' ) -> None :
1032+ def process_compiler_options (self , lang : str , comp : 'Compiler' , env : 'Environment' ) -> None :
10321033 from . import compilers
10331034
10341035 self .add_compiler_options (comp .get_options (), lang , comp .for_machine , env )
10351036
10361037 enabled_opts : T .List [OptionKey ] = []
10371038 for key in comp .base_options :
1038- if key in self .options :
1039- continue
1040- oobj = copy . deepcopy ( compilers . base_options [ key ])
1041- if key in env .options :
1042- oobj . set_value ( env . options [ key ] )
1043- enabled_opts . append ( key )
1044- self .options [key ] = oobj
1039+ if key not in self .options :
1040+ self . options [ key ] = copy . deepcopy ( compilers . base_options [ key ])
1041+ if key in env . options :
1042+ self . options [ key ]. set_value ( env .options [ key ])
1043+ enabled_opts . append ( key )
1044+ elif key in env . options :
1045+ self .options [key ]. set_value ( env . options [ key ])
10451046 self .emit_base_options_warnings (enabled_opts )
10461047
10471048 def emit_base_options_warnings (self , enabled_opts : T .List [OptionKey ]) -> None :
0 commit comments