(lang: str,
                       comp: T.Type[Compiler],
                       for_machine: MachineChoice,
                       env: 'Environment')
return opts
Retrieve options that apply to all compilers for a given language.
Retrieve options that apply to all compilers for a given language.
Retrieve options that apply to all compilers for a given language .
def get_global_options(lang: str,
                       comp: T.Type[Compiler],
                       for_machine: MachineChoice,
                       env: 'Environment') -> 'KeyedOptionDictType':
    """Retrieve options that apply to all compilers for a given language."""
    description = f'Extra arguments passed to the {lang}'
    argkey = OptionKey('args', lang=lang, machine=for_machine)
    largkey = argkey.evolve('link_args')
    envkey = argkey.evolve('env_args')

    comp_key = argkey if argkey in env.options else envkey

    comp_options = env.options.get(comp_key, [])
    link_options = env.options.get(largkey, [])

    cargs = coredata.UserArrayOption(
        description + ' compiler',
        comp_options, split_args=True, user_input=True, allow_dups=True)

    largs = coredata.UserArrayOption(
        description + ' linker',
        link_options, split_args=True, user_input=True, allow_dups=True)

    if comp.INVOKES_LINKER and comp_key == envkey:
        # If the compiler acts as a linker driver, and we're using the
        # environment variable flags for both the compiler and linker
        # arguments, then put the compiler flags in the linker flags as well.
        # This is how autotools works, and the env vars freature is for
        # autotools compatibility.
        largs.extend_value(comp_options)

    opts: 'KeyedOptionDictType' = {argkey: cargs, largkey: largs}

    return opts
def get_global_options ( lang : str , comp : T . Type [ Compiler ] , for_machine : MachineChoice , env : 'Environment' ) -> 'KeyedOptionDictType' : description = f'Extra arguments passed to the {lang}' argkey = OptionKey ( 'args' , lang = lang , machine = for_machine ) largkey = argkey . evolve ( 'link_args' ) envkey = argkey . evolve ( 'env_args' ) comp_key = argkey if argkey in env . options else envkey comp_options = env . options . get ( comp_key , [ ] ) link_options = env . options . get ( largkey , [ ] ) cargs = coredata . UserArrayOption ( description + ' compiler' , comp_options , split_args = True , user_input = True , allow_dups = True ) largs = coredata . UserArrayOption ( description + ' linker' , link_options , split_args = True , user_input = True , allow_dups = True ) if comp . INVOKES_LINKER and comp_key == envkey : # If the compiler acts as a linker driver, and we're using the # environment variable flags for both the compiler and linker # arguments, then put the compiler flags in the linker flags as well. # This is how autotools works, and the env vars freature is for # autotools compatibility. largs . extend_value ( comp_options ) opts : 'KeyedOptionDictType' = { argkey : cargs , largkey : largs } return opts