(compiler: T.List[str])
return defines
Get the list of Clang pre-processor defines
Get the list of Clang pre-processor defines
Get the list of Clang pre - processor defines
def _get_clang_compiler_defines(compiler: T.List[str]) -> T.Dict[str, str]:
    """
    Get the list of Clang pre-processor defines
    """
    args = compiler + ['-E', '-dM', '-']
    p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE)
    if p.returncode != 0:
        raise EnvironmentException('Unable to get clang pre-processor defines:\n' + output + error)
    defines: T.Dict[str, str] = {}
    for line in output.split('\n'):
        if not line:
            continue
        d, *rest = line.split(' ', 2)
        if d != '#define':
            continue
        if len(rest) == 1:
            defines[rest[0]] = ''
        if len(rest) == 2:
            defines[rest[0]] = rest[1]
    return defines
def _get_clang_compiler_defines ( compiler : T . List [ str ] ) -> T . Dict [ str , str ] : args = compiler + [ '-E' , '-dM' , '-' ] p , output , error = Popen_safe ( args , write = '' , stdin = subprocess . PIPE ) if p . returncode != 0 : raise EnvironmentException ( 'Unable to get clang pre-processor defines:\n' + output + error ) defines : T . Dict [ str , str ] = { } for line in output . split ( '\n' ) : if not line : continue d , * rest = line . split ( ' ' , 2 ) if d != '#define' : continue if len ( rest ) == 1 : defines [ rest [ 0 ] ] = '' if len ( rest ) == 2 : defines [ rest [ 0 ] ] = rest [ 1 ] return defines