@ -49,6 +49,7 @@ from ..interpreter import Interpreter
from . . mesonmain import need_setup_vsenv
if T . TYPE_CHECKING :
from . . _typing import ImmutableListProtocol
from . . linkers import StaticLinker
from . . compilers . cs import CsCompiler
@ -2329,7 +2330,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
return ( rel_obj , rel_src )
@lru_cache ( maxsize = None )
def generate_inc_dir ( self , compiler , d , basedir , is_system ) :
def generate_inc_dir ( self , compiler : ' Compiler ' , d : str , basedir : str , is_system : bool ) - > \
T . Tuple [ ' ImmutableListProtocol[str] ' , ' ImmutableListProtocol[str] ' ] :
# Avoid superfluous '/.' at the end of paths when d is '.'
if d not in ( ' ' , ' . ' ) :
expdir = os . path . normpath ( os . path . join ( basedir , d ) )
@ -2349,12 +2351,13 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
bargs = [ ]
return ( sargs , bargs )
def _generate_single_compile ( self , target , compiler , is_generated = False ) :
commands = self . _generate_single_compile_base_args ( target , compiler , is_generated )
def _generate_single_compile ( self , target : build . BuildTarget , compiler : ' Compiler ' ,
is_generated : bool = False ) - > ' CompilerArgs ' :
commands = self . _generate_single_compile_base_args ( target , compiler )
commands + = self . _generate_single_compile_target_args ( target , compiler , is_generated )
return commands
def _generate_single_compile_base_args ( self , target , compiler , is_generated ) :
def _generate_single_compile_base_args ( self , target : build . BuildTarget , compiler : ' Compiler ' ) - > ' CompilerArgs ' :
base_proxy = self . get_base_options_for_target ( target )
# Create an empty commands list, and start adding arguments from
# various sources in the order in which they must override each other
@ -2369,7 +2372,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
return commands
@lru_cache ( maxsize = None )
def _generate_single_compile_target_args ( self , target , compiler , is_generated ) :
def _generate_single_compile_target_args ( self , target : build . BuildTarget , compiler : ' Compiler ' ,
is_generated : bool = False ) - > ' ImmutableListProtocol[str] ' :
# The code generated by valac is usually crap and has tons of unused
# variables and such, so disable warnings for Vala C sources.
no_warn_args = ( is_generated == ' vala ' )
@ -2439,7 +2443,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
raise AssertionError ( f ' BUG: sources should not contain headers { src !r} ' )
compiler = get_compiler_for_source ( target . compilers . values ( ) , src )
commands = self . _generate_single_compile_base_args ( target , compiler , is_generated )
commands = self . _generate_single_compile_base_args ( target , compiler )
# Include PCH header as first thing as it must be the first one or it will be
# ignored by gcc https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100462