
    -Ph                       d dl mZ 	 d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Zd dlmZ ddlmZ ddlmZ ddlmZ ddlmZmZmZ dd	lmZ d
dlmZ d
dlmZ ddlmZ ej        rddlmZ ddlmZ ddl m!Z! ddl"m#Z# ne$Z# ej%        dej&                  Z' G d dej(                  Z) G d de#          Z*dS )    )annotationsN)Path   )arglist)mesonlib)mlog)GnuLikeDynamicLinkerMixinSolarisDynamicLinkerCompCertDynamicLinker)LibType   )	compilers)CompileCheckMode   )VisualStudioLikeCompiler)
Dependency)ImmutableListProtocol)Environment)Compilerz^(?!-Wl,) .*\.so (?:\.[0-9]+)? (?:\.[0-9]+)? (?:\.[0-9]+)?$ |
                             ^(?:-Wl,)?-l |
                             \.a$c                  z    e Zd ZdZdZdZdZdZdddZe	 e
j        d          dd                        ZddZdS )CLikeCompilerArgs)-I-L)r   -isystemr   z-Dz-U)-lz-Wl,-lz-Wl,-rpath,z-Wl,-rpath-link,)z.libz.dll.soz.dylibz.a)-cz-S-Ez-pipe-pthreadz-Wl,--export-dynamicFcopyboolreturnT.List[str]c                    t           j        t          j                  s
J d                                              |r                                 }n }t           j        j        t          t          t          f          r}d}d}t          |          D ]*\  }}t                              |          s |}|dk     r|}+||cxk    rdk    r2n n/|                    |dz   d           |                    |d            j                                        }|r	 fd|D             }g }	t          |          D ]\  }}|                    d          s|dk    rA|t!          |          dz
  k     r*                     ||dz                      |v r
|	||dz   gz  }	b|                    d	          r&                     |d
d                    |v r|	|gz  }	                     |dd                    |v r|	|gz  }	t%          |	          D ]}|                    |            j                            |j                  S )NzHow did you get herer   r   z-Wl,--end-groupz-Wl,--start-groupc                :    g | ]}                     |          S  )_cached_realpath).0iselfs     a/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mesonbuild/compilers/mixins/clike.py
<listcomp>z/CLikeCompilerArgs.to_native.<locals>.<listcomp>^   s'     P P Pa!6!6q!9!9 P P P    r   z	-isystem=	      )
isinstancecompilerr   r   flush_pre_postr    linkerr	   r
   r   	enumerateGROUP_FLAGSsearchinsertget_default_include_dirs
startswithlenr(   reversedpopunix_args_to_native
_container)
r+   r    newgroup_start	group_endr*   eachdefault_dirsreal_default_dirsbad_idx_lists
   `         r,   	to_nativezCLikeCompilerArgs.to_native<   s   $-);<<TT>TTTT 	 	))++CCC dm*-FH\^s,tuu 	=KI$S>> $ $4"))$// 	??"#K;++++!+++++

9q=*;<<<

;(;<<<}==?? 	 P P P P< P P P(*L$S>> ( (4z22  :%%CHHqL))d.C.CCAJ.O.OSd.d.d$AE
2__[11 (,,T!""X66:KKK$+**48448III QC'Ll++  



}00@@@r.   Nmaxsizeargstrc                @    t           j                            |           S N)ospathrealpath)rJ   s    r,   r(   z"CLikeCompilerArgs._cached_realpathq   s     w$$$r.   c                P    |                                   d| j        d| j        dS )NzCLikeCompilerArgs(z, ))r3   r2   r?   r+   s    r,   __repr__zCLikeCompilerArgs.__repr__v   s1    KDMKKtKKKKr.   F)r    r!   r"   r#   )rJ   rK   r"   rK   r"   rK   )__name__
__module____qualname__prepend_prefixesdedup2_prefixesdedup1_prefixesdedup1_suffixesdedup1_argsrG   staticmethod	functools	lru_cacher(   rT   r'   r.   r,   r   r   2   s        #:O JO=OQK3A 3A 3A 3A 3Aj Y&&&% % % '& \%L L L L L Lr.   r   c                  p    e Zd ZU dZej        ri Zded<   i Zded<   i Z	ded<   e
j        Zdd
ZdddZddZddZddZddZddZddZddZddZddZddZddZdd"Zdd&Z ej                    	 ddd*            Z	 ddd+Z ej                    dd,            Z dd-Z!dd.Z"dd1Z#dd2Z$dd3Z%dd4Z&dd6Z'dd;Z(dd<Z)ddd=ddEZ*dddFdGddIZ+ddd=ddLZ,ddPZ-e.j/        fddSZ0ddUZ1	 	 dddZZ2dd[dd\Z3ddd=dd^Z4ddd=dd`Z5ddd=ddbZ6ddd=ddcZ7	 dddgZ8ddkZ9e:ddm            Z;e:ddn            Z<ddd=ddpZ=ddd=ddrZ>dd[ddsZ?ddtZ@ddvZAddwZBddxZCddd|ZDdddZEe:dd            ZFeGdd            ZHe:dd            ZI ej                    dd            ZJddZKddZLeMjN        dfddZOddZPddZQddZR	 dddZSddZTddZUddZVddZWddZXddZYddZZddZ[ddZ\e:dd            Z]ddZ^ddZ_ddZ` ej        d          d fd            ZaddZb xZcS )CLikeCompilerz(Shared bits for the C and CPP Compilers.zT.Dict[str, T.List[str]]	warn_argszaT.Dict[T.Tuple[T.Tuple[str, ...], str, T.Tuple[str, ...], str, LibType], T.Optional[T.List[str]]]find_library_cachezYT.Dict[T.Tuple[T.Tuple[str, ...], str, T.Tuple[str, ...], bool], T.Optional[T.List[str]]]find_framework_cacher"   Nonec                H    | j                             d           d | _        d S )Nh)can_compile_suffixesaddpreprocessorrS   s    r,   __init__zCLikeCompiler.__init__   s'    !%%c***26r.   NargsT.Optional[T.Iterable[str]]r   c                "    t          | |          S rM   )r   r+   rn   s     r,   compiler_argszCLikeCompiler.compiler_args   s     t,,,r.   r!   c                    dS )NTr'   rS   s    r,   needs_static_linkerz!CLikeCompiler.needs_static_linker   s    tr.   r#   c                *    |                                  S )zM
        Args that are always-on for all C compilers other than MSVC
        )get_largefile_argsrS   s    r,   get_always_argszCLikeCompiler.get_always_args   s     &&(((r.   c                    dgS )Nz	-nostdincr'   rS   s    r,   get_no_stdinc_argsz CLikeCompiler.get_no_stdinc_args   
    }r.   c                    dgS )Nz	-nostdlibr'   rS   s    r,   get_no_stdlib_link_argsz%CLikeCompiler.get_no_stdlib_link_args   rz   r.   levelrK   c                    | j         |         S rM   )rd   )r+   r}   s     r,   get_warn_argszCLikeCompiler.get_warn_args   s    ~e$$r.   c                    dS )Ndr'   rS   s    r,   get_depfile_suffixz CLikeCompiler.get_depfile_suffix   s    sr.   c                
    ddgS )Nr   z-Pr'   rS   s    r,   get_preprocess_only_argsz&CLikeCompiler.get_preprocess_only_args   s    d|r.   c                    dgS )Nr   r'   rS   s    r,   get_compile_only_argsz#CLikeCompiler.get_compile_only_args   s	    vr.   c                    dgS )Nz-O0r'   rS   s    r,   get_no_optimization_argsz&CLikeCompiler.get_no_optimization_args   s	    wr.   
outputnamec                
    d|gS )Nz-or'   )r+   r   s     r,   get_output_argszCLikeCompiler.get_output_args   s    j!!r.   c                    dgS Nz-Werrorr'   rS   s    r,   get_werror_argszCLikeCompiler.get_werror_args   s
    {r.   rO   	is_systemc                *    |dk    rd}|rd|gS d|z   gS )N .r   r   r'   )r+   rO   r   s      r,   get_include_argszCLikeCompiler.get_include_args   s/    2::D 	&%%t}r.   env'Environment'namec                    g S )zP
        Get dirs from the compiler, either `libraries:` or `programs:`
        r'   )r+   r   r   s      r,   get_compiler_dirszCLikeCompiler.get_compiler_dirs   s	     	r.   	elf_classT.Optional[int]'ImmutableListProtocol[str]'c                &  
 |                      |d          }||dk    r|S g }|D ]

fdt          j        
          D             }|s|                    
           :|D ]}t          j                            
|          }	 t          |d          5 }|                    d          }	|	dd         dk    st          |	d                   |k    r|                    
           d d d            n# 1 swxY w Y    n# t          $ r Y w xY w|S )	N	librariesr   c                    g | ]V}|                     d           t          j                            t          j                            |                    T|WS )r   )endswithrN   rO   isfilejoin)r)   fr   s     r,   r-   z3CLikeCompiler._get_library_dirs.<locals>.<listcomp>   sS    jjj1E1B1Bjrw~~VXV]VbVbcdfgVhVhGiGijQjjjr.   rb   r      s   ELF)
r   rN   listdirappendrO   r   openreadintOSError)r+   r   r   dirsretvalfilesr   file_to_checkfdheaderr   s             @r,   _get_library_dirszCLikeCompiler._get_library_dirs   s    %%c;77	QK ! 	 	Ajjjj
1jjjE a      "Q 2 2mT22 -b!# "!A#;&00Cq	NNi4O4O"MM!,,,- - - - - - - - - - - - - - - E   D s7   D AC3'D 3C77D :C7;D  
DDc                R    |                      ||                                          S )znWrap the lru_cache so that we return a new copy and don't allow
        mutation of the cached value.
        )r   r    )r+   r   r   s      r,   get_library_dirszCLikeCompiler.get_library_dirs   s&    
 %%c955::<<<r.   c                .    |                      |d          S )z
        Programs used by the compiler. Also where toolchain DLLs such as
        libstdc++-6.dll are found with MinGW.
        programs)r   r+   r   s     r,   _get_program_dirszCLikeCompiler._get_program_dirs   s     %%c:666r.   c                P    |                      |                                          S rM   )r   r    r   s     r,   get_program_dirszCLikeCompiler.get_program_dirs   s"    %%c**//111r.   c                    dgS )Nz-fPICr'   rS   s    r,   get_pic_argszCLikeCompiler.get_pic_args   s
    yr.   pch_dirr   c                D    dt           j                            |          gS )Nz-include)rN   rO   basename)r+   r   r   s      r,   get_pch_use_argszCLikeCompiler.get_pch_use_args   s    BG,,V4455r.   c                p    t           j                            |          dz   |                                 z   S )Nr   )rN   rO   r   get_pch_suffixr+   r   s     r,   get_pch_namezCLikeCompiler.get_pch_name  s.    w%%+d.A.A.C.CCCr.   c                    g S rM   r'   rS   s    r,   r9   z&CLikeCompiler.get_default_include_dirs  s    	r.   c                6    | j                             |          S rM   )r4   export_dynamic_argsr   s     r,   gen_export_dynamic_link_argsz*CLikeCompiler.gen_export_dynamic_link_args	  s    {..s333r.   
implibnamec                6    | j                             |          S rM   )r4   import_library_args)r+   r   s     r,   gen_import_library_argsz%CLikeCompiler.gen_import_library_args  s    {..z:::r.   work_direnvironmentsnamecodec                   t          j        d|                                 z   dz   t          j        | j                             t          j        d| j        d           t          j        	                    ||          }|
                    dd          d         }t          j        }| j        r%|dz  }|                                st          j        }|                     ||          \  }}	||                     |	          z   }
|dz  }t          j        	                    ||          }t#          |d	d
          5 }|                    |           d d d            n# 1 swxY w Y   | j        |gz   |                     |          z   |
z   }t          j        ||          \  }}}t          j        dt          j        |                     t          j        d           t          j        |           t          j        d           t          j        |           t          j        d           |j        dk    r*t          j        d|                                  d          | j        r4|                                sd S |j                                        |gz   }n|g}t          j        dt          j        |                     	 t5          j        |t4          j        t4          j                  }n*# t:          $ r}t          j        d|d          d }~ww xY w|j        dk    r2t          j        d| j         d|                                  d          d S )NzSanity testing z
 compiler:zIs cross compiler: r   r   r   _crossz.exewzutf-8)encoding)cwdz#Sanity check compiler command line:zSanity check compile stdout:z"-----
Sanity check compile stderr:z-----z	Compiler z cannot compile programs.zRunning test binary command: )stdoutstderrz)Could not invoke sanity test executable: zExecutables created by z
 compiler z are not runnable.)r   debugget_display_languager   	join_argsexelistis_crossrN   rO   r   rsplitr   LINKhas_exe_wrapperCOMPILE_get_basic_compiler_argslinker_to_compiler_argsr   writer   
Popen_safe
returncodeEnvironmentExceptionname_stringexe_wrapperget_command
subprocessrunDEVNULL	Exceptionlanguage)r+   r   r   r   r   source_namebinnamemodecargslargsextra_flagsbinary_nameofilecmdlistpcstdostdepees                      r,   _sanity_check_implz CLikeCompiler._sanity_check_impl  s   
$t'@'@'B'BB\QS[SefjfrSsSsttt
;;;;<<<gll8U33,,sA&&q)$= 	0xG..00 0 (/44[$GGud::5AAA 	6gll8W55+sW555 	KK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 ,%(4+?+?+H+HH;V!,W(CCCD$
8(:LW:U:UVVV
1222
4
8999
4
7=A/0iD<L<L<N<N0i0i0ijjj= 	$..00 !-99;;{mKGG"mG
2H4Fw4O4OPPP	d
0B:K]^^^BB 	d 	d 	d/0b\]0b0b0bccc	d=A/  1J$-  1J  1Jcgcscscucu  1J  1J  1J  K  K  K s*   >E  E$'E$+K; ;
L"LL"c                6    d}|                      ||d|          S )Nz.int main(void) { int class=0; return class; }
zsanitycheckc.c)r   )r+   r   r   r   s       r,   sanity_checkzCLikeCompiler.sanity_checkG  s#    @&&x>NPTUUUr.   
extra_argsdependencieshnameprefixr  IT.Union[None, T.List[str], T.Callable[['CompileCheckMode'], T.List[str]]]r   T.Optional[T.List['Dependency']]T.Tuple[bool, bool]c               D    | d| d}|                      ||||          S )N
        #include <>r   compiles)r+   r  r  r   r  r  r   s          r,   check_headerzCLikeCompiler.check_headerK  sI         }}T3:*6  8 8 	8r.   F)r  r  disable_cacher  c               h    | d| d| d| d}|                      ||||t          j        |          S )Nz;
        #ifdef __has_include
         #if !__has_include("z")
          #error "Header 'zG' could not be found"
         #endif
        #else
         #include <z>
        #endif)r  r  r   r  )r  r   
PREPROCESS)r+   r  r  r   r  r  r  r   s           r,   
has_headerzCLikeCompiler.has_headerS  su       #  !     }}T3:*6=M=Xhu  w w 	wr.   symbolGT.Union[None, T.List[str], T.Callable[[CompileCheckMode], T.List[str]]]c               P    | d| d| d| d}|                      ||||          S )Nr	  zx>
        int main(void) {
            /* If it's not defined as a macro, try to use as a symbol */
            #ifndef z
                z4;
            #endif
            return 0;
        }r   r  )r+   r  r  r  r   r  r  ts           r,   has_header_symbolzCLikeCompiler.has_header_symbolb  si         	 
    }}Q
*6  8 8 	8r.   r   r   !T.Tuple[T.List[str], T.List[str]]c                  
 g }g }|t           j        u rp	 |j        j                            d          }|j        j                            d          }||                     ||          z  }n# t          t          f$ r Y nw xY w|j                            | j	        | j
                  
t          
t                    r
g
|                     
          }||z  }|t           j        u r|                    | j	        | j
        dz             }|$||                     |d         | j                  z  }|j                            | j	        | j
                  }	|
fd|	D             z  }||                     |          z  }||fS )Nb_vscrt	buildtype_ldr   c                    g | ]}|v|	S r'   r'   )r)   xsys_argss     r,   r-   z:CLikeCompiler._get_basic_compiler_args.<locals>.<listcomp>  s#    BBBA0A0Aa0A0A0Ar.   )r   r   coredataoptstore	get_valueget_crt_compile_argsKeyErrorAttributeErrorget_external_argsfor_machiner   r1   rK   remove_linkerlike_argslookup_binary_entryuse_linker_argsversionget_external_link_argsget_compiler_args_for_mode)r+   r   r   r   r   crt_valr  cleaned_sys_argsld_valuesys_ld_argsr  s             @r,   r   z&CLikeCompiler._get_basic_compiler_argsr  s   #(((
,/99)DDL1;;KHH	227IFFFn-    <11$2BDMRRh$$ 	" zH
  66x@@!!#(((..t/?QVAVWWH#--hqk4<HHH ,==d>NPTP]^^K BBBBBBBBE00666e|s   AA- -B B]T.Union[None, arglist.CompilerArgs, T.List[str], T.Callable[[CompileCheckMode], T.List[str]]]arglist.CompilerArgsc           	        |g }nt          j        |          }t          j        fd|D                       }|g }n"t          |t          j        j                  s|g}|                                 }g }|D ]}||                                z  }|                                dk    }|	                                D ]h}	|	
                    |                                |                                          D ]+}
|                    |                     |
|                     ,it          j        u r||                                z  }|                     |          \  }}||z  }||                               z  }|d |                     |          D             z  }|                     g           dgk    r%|g k    r
d|vr|dgz  }|                     |          }||z   |z   }|S )Nc                H    g | ]}t          |          r |          n|S r'   )callable)r)   r   r   s     r,   r-   z4CLikeCompiler.build_wrapper_args.<locals>.<listcomp>  s0    &Y&Y&Y(1++'Dqqwww1&Y&Y&Yr.   systemc                    g | ]
}|d k    |S )/linkr'   )r)   ls     r,   r-   z4CLikeCompiler.build_wrapper_args.<locals>.<listcomp>  s    NNNg!r.   r8  )r   listifyr1   collectionsabcIterablerr   get_compile_argsget_include_typeget_include_dirsto_string_listget_source_dirget_build_dirextendr   r   r   get_link_argsr   get_compiler_check_argsr   r>   )r+   r   r  r  r   r   r   r   system_incdirr*   idircalarn   s       `         r,   build_wrapper_argsz CLikeCompiler.build_wrapper_args  s0   
 JJ ")*55J%&Y&Y&Y&Yj&Y&Y&YZZ
LLL+/*BCC 	*(>L&*&8&8&:&: 		+ 		+AQ'')))E..00H<M'')) M M,,S-?-?-A-A3CTCTCVCVWW M MDLL!6!6t]!K!KLLLLM',,,***..sD99B--d333 	NNT99"==NNNN''++y88{{wj88wi'
 ,,U33Ez!E)r.   
expressionc                P    | d| d}|                      ||||          d         S )NzI
        #include <stddef.h>
        int main(void) { static int a[1-2*!(z)]; a[0]=0; return 0; }r   r   r  )r+   rL  r  r   r  r  r  s          r,   _compile_intzCLikeCompiler._compile_int  sX      U U.8U U U }}Q
*6  8 889; 	;r.   lowhighguessr   c	                   t          |t                    r |                     | d| ||||          r|S | j        |j        j        j        v r	 |                     |||||d          \  }	}
d|	 d}|j        j        j        | j                                     ||          }|rI|j	        rB|j
        dk    r7|                     | d|j         ||||          rt          |j                  S n# t          j        $ r Y nw xY wd}d}t          |t                    rt          |t                    s	|                     | d||||          rxdx}}|                     | d	| ||||          rS|d
z   }||k    rt          j        d          t          |dz  d
z   |          }|                     | d	| ||||          S|}ndx}}|                     | d| ||||          rP|d
z
  }||k     rt          j        d          t          |dz  |          }|                     | d| ||||          P|}nT||k     rt          j        d          | d| d| d| }|                     |||||          st          j        d          ||k    rD|t          ||z
  dz            z   }|                     | d| ||||          r|}n|d
z   }||k    D|S )Nz == Fzz
                #include <stdio.h>
                #include <stdint.h>
                int main(void) { int expression = z'; printf("%d", expression); return 0; }r   ii   z >= 0z > r   zCross-compile check overflowedr   r%   z < z!high limit smaller than low limitz <= z && z >= zValue out of given range)r1   r   rN  r   r  r   build
get_definer   compiledr   r   r   r   minmax)r+   rL  rO  rP  rQ  r  r   r  r  expanded_evaluate_expandedr   maxintminintcur	conditions                    r,   cross_compute_intzCLikeCompiler.cross_compute_int  s   
 eS!! 	  J!;!;E!;!;VS*Vbcc  =CL2888"ooj&#zS_afgg!%i 5=%i %i %i! l,24=AEEFWY\]] /3< /CNa,?,?((J)H)HCJ)H)H&RUWacopp /"3:.0    #s## 	P:dC+@+@ 	P  J!5!5!5vsJP\]] c'':(?(?#(?(?jZfgg 3'CV||&;<\]]]cAgk622C	 '':(?(?#(?(?jZfgg 3
 s'':(?(?#(?(?jZfgg /7Df}}&;<\]]]cAgv..C	 '':(?(?#(?(?jZfgg /
  czz34WXXX%JJ4JJZJJSJJI$$YZVV P34NOOO TkkTCZ1,---C  J!9!9C!9!963
T`aa Ag Tkk 
s   BC. .D ?D )r  c          
     
   |g }| j         r|                     ||||||||          S | d| d}	|                     |	|||          }
|
j        sdS |
j        dk    rt          j        d          t          |
j                  S )Nzr
        #include<stddef.h>
        #include<stdio.h>
        int main(void) {
            printf("%ld\n", (long)(z#));
            return 0;
        }r   r%   r   z&Could not run compute_int test binary.)	r   r_  r   rU  r   r   r   r   r   )r+   rL  rO  rP  rQ  r  r   r  r  r  ress              r,   compute_intzCLikeCompiler.compute_int  s     J= 	o))*c4PSU_amnnn   &0	   hhq#*$0  2 2| 	2>Q/0XYYY3:r.   typenamec          
         |g }| d| d}|                      ||||          d         sdS |                     d| dd d d ||||          S )NB
        #include <stddef.h>
        int main(void) {
            + something;
            return 0;
        }r   r   r%   zsizeof(rR   r  r_  r+   rc  r  r   r  r  r  s          r,   cross_sizeofzCLikeCompiler.cross_sizeof+  s     J      }}Q
*6  8 889; 	2%%&;&;&;&;T4vWZ\fhtuuur.   T.Tuple[int, bool]c                  |g }| j         r|                     |||||          }|dfS | d| d}|                     ||||          }|j        sdS |j        dk    rt          j        d          t          |j                  |j	        fS )Nr   Fzy
        #include<stddef.h>
        #include<stdio.h>
        int main(void) {
            printf("%ld\n", (long)(sizeof(z$)));
            return 0;
        })r%   Fr   z!Could not run sizeof test binary.)
r   ri  
cached_runrU  r   r   r   r   r   cached)	r+   rc  r  r   r  r  rr  ra  s	            r,   sizeofzCLikeCompiler.sizeof;  s     J= 	!!(FCJ/; " = =Ae8O   -5	   ooa+7  9 9| 	9>Q/0STTT3:
**r.   T.Optional[T.List[str]]c          
         |g }| d| d}|                      ||||          d         sdS | d| d}|                     dd d d ||||          S )	Nre  rf  r   r   r%   zR
        #include <stddef.h>
        struct tmp {
            char c;
            z target;
        };zoffsetof(struct tmp, target)rg  rh  s          r,   cross_alignmentzCLikeCompiler.cross_alignmentS  s     J      }}Q
*6  8 889; 	2   	   %%&DdDRVXY[^`jlxyyyr.   c                  |g }| j         r|                     |||||          }|dfS | d| d}|                     ||||          }|j        st	          j        d          |j        dk    rt	          j        d          	 t          |j                  }	n"# t          $ r t	          j        d          w xY w|	dk    rt	          j        d| d	          |	|j
        fS )
Nr   Fzm
        #include <stdio.h>
        #include <stddef.h>
        struct tmp {
            char c;
            z target;
        };
        int main(void) {
            printf("%d", (int)offsetof(struct tmp, target));
            return 0;
        }z!Could not compile alignment test.r   z$Could not run alignment test binary.z!Could not determine alignment of z&. Sorry. You might want to file a bug.)r   rr  rl  rU  r   r   r   r   r   
ValueErrorrm  )
r+   rc  r  r   r  r  rn  r  ra  aligns
             r,   	alignmentzCLikeCompiler.alignmenti  s^    J= 	$$Xvsz2> % @ @Ae8O 
 

 
 
 
 ooa+7  9 9| 	U/0STTT>Q/0VWWW	X
OOEE 	X 	X 	X /0VWWW	X A::/  1ET\  1E  1E  1E  F  F  Fcj  s   B B:dnameAT.Union[T.List[str], T.Callable[[CompileCheckMode], T.List[str]]]T.Tuple[str, bool]c                @   d}d}d}	d| d| d| d|	 d| | | }
|                      |||t          j        	                                          }t	          j        | j        |
|j        |t          j        
          }|r't	          j        | j        |
|t          j        
          } |            5 }|j	        }|j
        dk    rt          j        d|          	 d d d            n# 1 swxY w Y   |j                            |          }|j                            |          }|dk    s|dk    s||k    rt          j        d          |j        |t#          |          z   |         }||	k    rd }n'|                     |                                          }||fS )Nz#"MESON_GET_DEFINE_DELIMITER_START"
z!
"MESON_GET_DEFINE_DELIMITER_END"z%"MESON_GET_DEFINE_UNDEFINED_SENTINEL"z	
        z
        #ifndef z
        # define  z
        #endif
        r   r  r   r   zCould not get define r%   z,Delimiters not found in preprocessor output.)rK  r   r  rG   r`   partialcached_compiler  compilerm  r   r   r   r   findrfindMesonBugExceptionr;   _concatenate_string_literalsstrip)r+   rw  r  r   r  r  r  delim_start	delim_endsentinel_undefr   rn   funcprm  star_idxend_idxdefine_values                     r,   rT  zCLikeCompiler.get_define  sJ    =8	@+	+ ++ + + + )+ +
 
+
 +
 '+ + &&sJ,<,G ' I IIR 	 !4dCLUY`p`{||| 	l$T\4DO_OjkkkDTVV 	WqXF|q  34UE4U4UVVV !	W 	W 	W 	W 	W 	W 	W 	W 	W 	W 	W 	W 	W 	W 	W 8==--(..++NN28w3F3F,-[\\\x3{+;+; ;G CD>))LL  <<\JJPPRRLV##s   1*C((C,/C,fnamertypeT.Union[str, int]c                   |dk    rd}d}n|dk    rd}d}nt          d|          | d| d	| d
| d}	|                     |	|||          }
|
j        st          j        d| d          |dk    r|
j        S |dk    rM	 t          |
j                                                  S # t          $ r t          j        d| d          w xY wJ d            )Nstringz%sz(char*)r   z%lliz(long long int)zBUG: Unknown return type zJ
        #include <stdio.h>
        int main(void) {
            printf ("z", r{  z$());
            return 0;
        }r   zCould not get return value of z()zReturn value of z() is not an intFUnreachable)	AssertionErrorr   rU  r   r   r   r   r  rt  )r+   r  r  r  r   r  r  fmtcastr   ra  s              r,   get_return_valuezCLikeCompiler.get_return_value  sT   
 HCDDe^^C$DD !FU!F!FGGG     #  &+   hhtSZlhSS| 	\/0ZQV0Z0Z0Z[[[H:e^^`3:++--... ` ` `34^u4^4^4^___`#m###s   %B) )#CT.Tuple[str, str]c                     d} | dz  } d}| |fS )a0  
        Try to find the function without a prototype from a header by defining
        our own dummy prototype and trying to link with the C library (and
        whatever else the compiler links in by default). This is very similar
        to the check performed by Autoconf for AC_CHECK_FUNCS.
        z
        #define {func} meson_disable_define_of_{func}
        {prefix}
        #include <limits.h>
        #undef {func}
        zb
        #ifdef __cplusplus
        extern "C"
        #endif
        char {func} (void);
        zA
        int main(void) {{
          return {func} ();
        }}r'   headmains     r,   _no_prototype_templz!CLikeCompiler._no_prototype_templ  s-     	  	 Tzr.   c                     d} d}| |fS )z
        Returns a head-er and main() call that uses the headers listed by the
        user for the function prototype while checking if a function exists.
        z{prefix}
#include <limits.h>
z
int main(void) {{
            void *a = (void*) &{func};
            long long b = (long long) a;
            return (int) b;
        }}r'   r  s     r,   _have_prototype_templz#CLikeCompiler._have_prototype_templ  s     1

 Tzr.   funcnamec                  |g }d|z   }|                     dd          }| j        rS|j        j                            |d          }|1t          |t                    r|dfS t          j        d| d          ||d}d	}	d
|v r| 	                                \  }
}n| 
                                \  }
}|
|	z   |z   }|                      |j        di ||||          \  }}|rd|fS |                                 dv rdS d
|v|d<   |                    d          }||d<   |rdnd|d<   d}|                      |j        di ||||          S )a  Determine if a function exists.

        First, this function looks for the symbol in the default libraries
        provided by the compiler (stdlib + a few others usually). If that
        fails, it checks if any of the headers specified in the prefix provide
        an implementation of the function, and if that fails, it checks if it's
        implemented as a compiler-builtin.
        Nzhas function r{  rY  FzCross variable z is not a boolean.)r  r  z
        #if defined __stub_{func} || defined __stub___{func}
        fail fail fail this function is not going to work
        #endif
        z#includer   T>   intel-clmsvcFFno_includes
__builtin_
is_builtinr   a  {prefix}
        int main(void) {{

        /* With some toolchains (MSYS2/mingw for example) the compiler
         * provides various builtins which are not really implemented and
         * fall back to the stdlib where they aren't provided and fail at
         * build/link time. In case the user provides a header, including
         * the header didn't lead to the function being defined, and the
         * function we are checking isn't a builtin itself we assume the
         * builtin is not functional and we just error out. */
        #if !{no_includes:d} && !defined({func}) && !{is_builtin:d}
            #error "No definition for {__builtin_}{func} found in the prefix"
        #endif

        #ifdef __has_builtin
            #if !__has_builtin({__builtin_}{func})
                #error "{__builtin_}{func} not found"
            #endif
        #elif ! defined({func})
            {__builtin_}{func};
        #endif
        return 0;
        }}r'   )replacer   
propertieshostgetr1   r!   r   r   r  r  linksformatget_idr:   )r+   r  r  r   r  r  varnamevalfargs
stubs_failr  r  templra  rm  r  r  s                    r,   has_functionzCLikeCompiler.has_function  s    J "H,//#s++= 	c.%))'488Cc4(( &:%34ag4a4a4abbb BHQY6Z6Z
 3355JD$$1133JD$z!D(jj!6!6!6!6
.: ! < <V 	 < ;;==000<  *7m((66
(l$.@bbLl. zz(!(++U++SZ'3  5 5 	5r.   membernamesc                   |g }d                     d |D                       }| d| d| d}|                     ||||          S )Nr   c              3  "   K   | ]
}d | dV  dS )z(void) ( foo.z );
Nr'   )r)   members     r,   	<genexpr>z,CLikeCompiler.has_members.<locals>.<genexpr>x  s.      RRF7&777RRRRRRr.   z&
        void bar(void) {
            z foo;
            z"
            (void) foo;
        }r   )r   r  )	r+   rc  r  r  r   r  r  membersr  s	            r,   has_memberszCLikeCompiler.has_membersq  s     J''RRkRRRRR       }}Q
*6  8 8 	8r.   c               D    | d| d}|                      ||||          S )Nz4
        void bar(void) {
            (void) sizeof(z);
        }r   r  rh  s          r,   has_typezCLikeCompiler.has_type  sK       #   }}Q
*6  8 8 	8r.   c                   d}d|                                 z   dz   }|                     t          j                  }d}|                     |||t          j        d          5 }|j        dk    rt          d|d	|j                   t          j	        
                    |j                  st          d
|d          t          |j        d          5 }|D ]g}d|z   |v r-t          j        d            ddd           ddd           dS ||v r-t          j        d            ddd           ddd           dS h	 ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   t          d|d          )z
        Check if symbols have underscore prefix by compiling a small test binary
        and then searching the binary for the string,
        s   meson_uscore_prefixzD#ifdef __cplusplus
        extern "C" {
        #endif
        void zG (void) {}
        #ifdef __cplusplus
        }
        #endif
        )_symbols_have_underscore_prefix_searchbinT)r  r   want_outputr   zBUG: Unable to compile z check: z'BUG: Can't find compiled test code for z checkr      _z9Underscore prefix check found prefixed function in binaryNz=Underscore prefix check found non-prefixed function in binaryFzBUG: z+ check did not find symbol string in binary)decoderF  r   r   _build_wrapperr   RuntimeErrorr   rN   rO   r   output_namer   r   r   )	r+   r   symbol_namer   rn   nr  olines	            r,   r  z7CLikeCompiler._symbols_have_underscore_prefix_searchbin  s   
 - %%''(+ ++,<,DEE7  stBRBZhl mm 	%qr|q  "#TQ#T#T!(#T#TUUU7>>!-00 ["#Ya#Y#Y#YZZZamT** 
%a 	% 	%D k)T11
#^___#
% 
% 
% 
% 
% 
%	% 	% 	% 	% 	% 	% 	% 	% %,,
#bccc$
% 
% 
% 
% 
% 
%	% 	% 	% 	% 	% 	% 	% 	% -	%
% 
% 
% 
% 
% 
% 
% 
% 
% 
% 
% 
% 
% 
% 
%	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%  S1SSSTTTsO   "A2E#!E5E#E&E#>E E#E	E#E	E##E'*E'T.Optional[bool]c                   d}d| d}|                      ||t          j        d          5 }|j        dk    rt	          d|j                   |j                            |          d                                         }t          j	        d	|d
           |dk    r	 ddd           dS |dk    r	 ddd           dS 	 ddd           dS # 1 swxY w Y   dS )aZ  
        Check if symbols have underscore prefix by querying the
        __USER_LABEL_PREFIX__ define that most compilers provide
        for this. Return if functions have underscore prefix or None
        if it was not possible to determine, like when the compiler
        does not set the define or the define has an unexpected value.
        z""MESON_HAVE_UNDERSCORE_DELIMITER" z
        #ifndef __USER_LABEL_PREFIX__
        #define MESON_UNDERSCORE_PREFIX unsupported
        #else
        #define MESON_UNDERSCORE_PREFIX __USER_LABEL_PREFIX__
        #endif
        z MESON_UNDERSCORE_PREFIX
        F)r   r  r   zHBUG: Unable to preprocess _symbols_have_underscore_prefix_define check: r%   z@Queried compiler for function prefix: __USER_LABEL_PREFIX__ is ""rY  NTr   )
r  r   r  r   r  r   	partitionrstripr   r   )r+   r   delimr   r  symbol_prefixs         r,   &_symbols_have_underscore_prefix_definez4CLikeCompiler._symbols_have_underscore_prefix_define  s    5 
     s1A1LZ_ `` 	de|q  "#xnonv#x#xyyyH..u55b9@@BBMJlZglllmmm##	 	 	 	 	 	 	 	 "$$	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A4C-CCCCc                    |j         | j                 }|                                rdS |                                s|                                r|j        dk    S dS )z
        Check if symbols have underscore prefix by consulting a hardcoded
        list of cases where we know the results.
        Return if functions have underscore prefix or None if unknown.
        Tx86N)machinesr&  	is_darwin
is_windows	is_cygwin
cpu_family)r+   r   ms      r,   $_symbols_have_underscore_prefix_listz2CLikeCompiler._symbols_have_underscore_prefix_list  sY     L)*;;== 	4<<>> 	)Q[[]] 	)<5((tr.   c                    |                      |          }||S |                     |          }||S |                     |          S )zR
        Check if the compiler prefixes an underscore to global C symbols
        )r  r  r  )r+   r   results      r,   symbols_have_underscore_prefixz,CLikeCompiler.symbols_have_underscore_prefix  sX    
 <<SAAM ::3??M ==cBBBr.   prefixessuffixessharedc                    g }|D ]"}|D ]}|                     |dz   |z              #|rA|j        | j                                                 r|D ]}|                     |dz              |S )Nz{}.z{}.so.[0-9]*.[0-9]*)r   r  r&  
is_openbsd)r+   r   r  r  r  patternsr  ss           r,   _get_patternszCLikeCompiler._get_patterns  s     " 	/ 	/A / /E	A..../ 		;cl4#34??AA 		;  ; ;$9 9::::r.   libtyper   strictT.Tuple[str, ...]c           	     
   dg}|rt          | t                    sdg}nddg}|j        | j                                                 rddg}n|j        | j                                                 r$t          | t                    rdg}ng d}|dgz  }nV|j        | j                                                 rddg}d	g|z   }n'| j                                        d
v r	ddg}ddg}ndg}|t          j
        u rP|                     |||d                              fd|                     |||d          D                        n|t          j        u rP|                     |||d                              fd|                     |||d          D                        nO|t          j        u r|                     |||d          n(|t          j        u sJ |                     |||d          t!                    S )zg
        Get library prefixes and suffixes for the target platform ordered by
        priority
        alibr   dylibso)dll.ar  dllr  r  cyg>   tic2000c6000Tc                    g | ]}|v|	S r'   r'   r)   r  r  s     r,   r-   z4CLikeCompiler.get_library_naming.<locals>.<listcomp>&  s%    ppp1^_go^o^oQ^o^o^or.   Fc                    g | ]}|v|	S r'   r'   r  s     r,   r-   z4CLikeCompiler.get_library_naming.<locals>.<listcomp>)  s%    ooo1]^fn]n]nQ]n]n]nr.   )r1   r   r  r&  r  r  r  idlowerr   PREFER_SHAREDr  rD  PREFER_STATICSHAREDSTATICtuple)r+   r   r  r  stlibextr  shlibextr  s          @r,   get_library_namingz CLikeCompiler.get_library_naming  sM   
 5
  	#*T+CDD 	#wHHr{H<()3355 	HH\$*+6688 	 $ 899 3!7222HH\$*+5577 		w'Hw)HHW]]__ 888U|Ht}HH vHg+++))#x4HHHOOpppp(:(:3(TY(Z(Zpppqqqq---))#x5IIHOOoooo(:(:3(TX(Y(Yooopppp&&))#x4HHHHgn,,,,))#x5IIHXr.   libsc                D   dd}g }| D ]}|                     dd          }t          |          d	k    r-	 t          d
 |d                             d          D                        n# t          $ r Y mw xY w|                    |           t          ||d          S )Nr  rK   r"   T.Tuple[int, ...]c                    |                      dd          d         }t          d |                    d          D                       S )N.so.r   maxsplitc              3  4   K   | ]}t          |          V  d S rM   r   r)   r*   s     r,   r  zHCLikeCompiler._sort_shlibs_openbsd.<locals>.tuple_key.<locals>.<genexpr>5  s(      88AQ888888r.   r   )r   r  split)r  vers     r,   	tuple_keyz5CLikeCompiler._sort_shlibs_openbsd.<locals>.tuple_key3  sC    ((6A(..q1C883888888r.   r  r   r  r   c              3  4   K   | ]}t          |          V  d S rM   r	  r
  s     r,   r  z5CLikeCompiler._sort_shlibs_openbsd.<locals>.<genexpr>>  s(      88c!ff888888r.   r   T)keyreverse)r  rK   r"   r  )r   r;   r  r  rt  r   sorted)r  r  filteredr  rets        r,   _sort_shlibs_openbsdz"CLikeCompiler._sort_shlibs_openbsd1  s    	9 	9 	9 	9 !# 		! 		!C**Va*00C3xx1}}88c!fll3&7&78888888   OOC    hIt<<<<s   2A**
A76A7pattern	directorylibnamec                    t           j                            ||                    |                    }d|v r'|                     t          j        |                    S |gS )N*)rN   rO   r   r  r  glob)clsr  r  r  r   s        r,   _get_trials_from_patternz&CLikeCompiler._get_trials_from_patternD  sQ    GLLGNN7$;$;<<'>> ++DIaLL999s
r.   r   pathsT.Optional[Path]c           	        |D ]}t           j                            |          r| j        j                                        rt| j        j                                        rVt          j        |          }|r| j        j        j	        |vr-t          j        d| d| d| j        j        j	                    t          |          c S dS )z
        We just check whether the library exists. We can't do a link check
        because the library might have unresolved symbols that require other
        libraries. On macOS we check if the library matches our target
        architecture.
        z	Rejected z, supports z
 but need N)rN   rO   r   r  r  r  rS  r   darwin_get_object_archsr  r   r   r   )r   r  r  archss       r,   _get_file_from_listz!CLikeCompiler._get_file_from_listN  s      
	 
	Aw~~a   	<$..00 !S\5G5Q5Q5S5S !$<Q??E  !CL$5$@$M$M
#lq#l#lU#l#lclN_Nj#l#lmmm Aww	 tr.   c                D    |                      dd|          d         dk    S )zP
        returns true if the output produced is 64-bit, false if 32-bit
        zvoid *r   r   r0   )ro  r   s     r,   output_is_64bitzCLikeCompiler.output_is_64bitd  s$    
 {{8R--a0A55r.   
extra_dirslib_prefix_warningc                H   |s|t           j        u s	|| j        v rsd|z   g}|                                 |                                 z   }||                     |          z   }	|                     |||	d          d         r|S || j        v rd S |                     ||          }
	 |                     |          rd}nd}n# t          j
        t          f$ r d}Y nw xY wt          j        ||                     ||                    D ]}|
D ]}|                     |||          }|s|                     ||          }|s5|                    d          r4|j                            |          r|rt'          j        d|d	           |                                gc c S d S )
Nr   Tr  r  r   r   r   r  zfind_library(z>) starting in "lib" only works by accident and is not portable)r   r  internal_libsget_linker_always_argsget_allow_undefined_link_argsr   r  r   r$  r   MesonExceptionr#  	itertoolschainr   r  r"  r:   r   r   warningas_posix)r+   r  r   r%  r   r  r&  r   r   r  r  r   r   r  trialstrials                   r,   _find_library_realz CLikeCompiler._find_library_realk  s     
	7+@ @ @4---G^$E//11D4V4V4X4XXE!=!=e!D!DDJzz$
$zOOPQR $,,,t **388	##C(( 			'2 	 	 	III	 T-B-B3	-R-RSS 
	* 
	*A 	* 	*66q!WEE 00f== %%e,, |1F1Fw1O1O |Tf |L!z!z!z!z{{{(())))))	* ts   $B? ?CCc                :   || j         v rg S t          |t                    r|g}t          | j                  |t          |          ||f}|| j        vr%|                     ||||||          }|| j        |<   n| j        |         }|d S |                                S rM   )ignore_libsr1   rK   r  r   re   r3  r    )	r+   r  r   r%  r   r  r&  r  values	            r,   _find_library_implz CLikeCompiler._find_library_impl  s     d&&&Ij#&& 	&$JT\""GU:->->gNd---++GS*dGUghhE+0D#C((+C0E=4zz||r.   Tc                :    d}|                      ||||||          S Nzint main(void) { return 0; }
)r7  )r+   r  r   r%  r  r&  r   s          r,   find_libraryzCLikeCompiler.find_library  s&    /&&wZwPbcccr.   c                v   | j         dk    rt          j        d          |                     d          g dz   }||                                 z  }||j                            | j        | j                  z  }t          j
        dd                    |          d           t          j                                        }d	|d
<   t          j        ||t           j                  \  }}}g }|                    d          D ]6}d|vr|                    |dd                                                    7|S )z
        These are usually /Library/Frameworks and /System/Library/Frameworks,
        unless you select a particular macOS SDK with the -isysroot flag.
        You can also add to this by setting -F in CFLAGS.
        clangz2Cannot find framework path with non-clang compilerF)ccache)z-vr   -z#Finding framework path by running: r{  
CLC_ALL)r   stdinz(framework directory)Ni)r  r   r,  get_exelistrw   r  r%  r&  r   r   r   r   rN   environr    r   r   PIPEr  r   r  )r+   r   commandsos_envrY  r   r  r  s           r,   find_framework_pathsz"CLikeCompiler.find_framework_paths  s5    7g)*^___##5#114E4E4EED((***CL2243CT]SSS
8#((8:L:LdSSS""x(vZ_UUU
1dJJt$$ 	- 	-D&d22 LLdsd))++,,,,r.   allow_systemc                    d}g }|D ]}|d|z   gz  }|rg nddg}|d|gz  }|                      ||||z   d          d         r|S d S )	Nzint main(void) { return 0; }z-Fz-Zz
-L/usr/libz
-frameworkTr(  r   )r  )	r+   r   r   r%  rI  r   	link_argsr   r  s	            r,   _find_framework_realz"CLikeCompiler._find_framework_real  s    -!#	 	$ 	$A$(#II (ARRdL-A
lD))	::dCZ)-CTX:YYZ[\ 	tr.   c                   t          |t                    r|g}t          | j                  |t          |          |f}|| j        v r| j        |         }n"|                     ||||          }|| j        |<   |d S |                                S rM   )r1   rK   r  r   rf   rL  r    )r+   r   r   r%  rI  r  r6  s          r,   _find_framework_implz"CLikeCompiler._find_framework_impl  s    j#&& 	&$JT\""D%
*;*;\J$+++-c2EE--dC\RRE-2D%c*=4zz||r.   c                2    |                      ||||          S )z
        Finds the framework with the specified name, and returns link args for
        the same or returns None when the framework is not found.
        )rN  )r+   r   r   r%  rI  s        r,   find_frameworkzCLikeCompiler.find_framework  s     ((sJMMMr.   r-  r  c                    g S rM   r'   r+   r-  r  s      r,   r"  z"CLikeCompiler.get_crt_compile_args      	r.   c                    g S rM   r'   rR  s      r,   get_crt_link_argszCLikeCompiler.get_crt_link_args  rS  r.   c                    |j         | j                 }|                                s|                                rg S dgS )Nr   )r  r&  is_haikur  )r+   r   host_ms      r,   thread_flagszCLikeCompiler.thread_flags  sC    d./?? 	 0 0 2 2 	I|r.   c                *    |                                 S rM   )r    rq   s     r,   r   z%CLikeCompiler.linker_to_compiler_args  s    yy{{r.   c                4    |                      ||||          S )Nr}  r  )r+   rn   r   r   r   s        r,   has_argumentszCLikeCompiler.has_arguments  s    }}T34d}CCCr.   c                   g }|D ]}|                     d          rR|                     d          rn<|dk    r|                    d           n |                    d|dd          z              |                     d          rt          j        | d           |                    |           |                     |||t
          j        	          S )
Nz-Wno-z-Wno-attributes=z-Wno-vla-larger-thanz-Wvla-larger-than=1000z-Wr   z-Wl,a9   looks like a linker argument, but has_argument and other similar methods only support checking compiler arguments. Using them to check linker arguments are never supported, and results are likely to be wrong regardless of the compiler you are using. has_link_argument or other similar method can be used instead.r|  )r:   r   r   r/  r\  r   r   )r+   rn   r   r   new_argsrJ   s         r,   _has_multi_argumentsz"CLikeCompiler._has_multi_arguments  s     " 	! 	!C ~~g&& 	4 >>"455 4222OO$<====OOD3qrr7N333~~f%% J I I I J J J OOC    !!(C<L<T!UUUr.   c                0    |                      ||d          S )Nzextern int i;
int i;
)r_  r+   rn   r   s      r,   has_multi_argumentsz!CLikeCompiler.has_multi_arguments  s    ((s4MNNNr.   c                    | j                                         |z   }|                     |          }|                     |||t          j                  S )Nr|  )r4   fatal_warningsr   r\  r   r   )r+   rn   r   r   s       r,   _has_multi_link_argumentsz'CLikeCompiler._has_multi_link_arguments   sP     {))++d2++D11!!$T8H8M!NNNr.   c                0    |                      ||d          S r9  )re  ra  s      r,   has_multi_link_argumentsz&CLikeCompiler.has_multi_link_arguments(  s    --dC9YZZZr.   r  c                    t          j        d          }| }|                    |          }|rBd                    |                    dddd                    }|                    |          }|B|S )NzV(?P<pre>.*([^\\]")|^")(?P<str1>([^\\"]|\\.)*)"\s+"(?P<str2>([^\\"]|\\.)*)(?P<post>".*)r   prestr1str2post)rer  matchr   group)r  r  r  r  s       r,   r  z*CLikeCompiler._concatenate_string_literals+  su    *vwwMM# 	#''!''%@@AACc""A  	# 
r.   c                    dgS r   r'   r   s     r,   !get_has_func_attribute_extra_argsz/CLikeCompiler.get_has_func_attribute_extra_args5  s     {r.   c                    |j         | j                 }|                                s|                                s|dv rdS |                     |                     |          ||                     |                    S )N>   	dllexport	dllimportr  )r  )r  r&  r  r  r  attribute_check_funcrq  )r+   r   r   r  s       r,   has_func_attributez CLikeCompiler.has_func_attribute;  s     L)* 	$!++-- 	$111#|}}T66t<<c(,(N(Nt(T(T  V V 	Vr.   disablec                    |rdgS g S )Nz-DNDEBUGr'   )r+   rw  r   s      r,   get_assert_argszCLikeCompiler.get_assert_argsF  s     	 <	r.   rH   src'mesonlib.FileOrString'c                `    | j         dk    rdS t                                          |          S )NPREPROCESSORT)r   supercan_compile)r+   rz  	__class__s     r,   r  zCLikeCompiler.can_compileK  s/     9&&4ww""3'''r.   r   c                    | j         sjt          j        |           | _         | j        |                                 z   | j         _        d| j         _        | j                            | j                    | j         S )Nr}  )rl   r    r   get_preprocess_to_file_argsr   modesr   rS   s    r,   get_preprocessorzCLikeCompiler.get_preprocessorR  sh      	1 $	$D(,t7W7W7Y7Y(YD%%3D"Jd/000  r.   )r"   rg   rM   )rn   ro   r"   r   )r"   r!   )r"   r#   )r}   rK   r"   r#   rV   )r   rK   r"   r#   )rO   rK   r   r!   r"   r#   )r   r   r   rK   r"   r#   )r   r   r   r   r"   r   )r   r   r   r   r"   r#   )r   r   r"   r   )r   r   r"   r#   )r   rK   r   rK   r"   r#   )r   rK   r"   rK   )r   rK   r"   r#   )
r   rK   r   r   r   rK   r   rK   r"   rg   )r   rK   r   r   r"   rg   )r  rK   r  rK   r   r   r  r  r  r  r"   r  )r  rK   r  rK   r   r   r  r  r  r  r  r!   r"   r  )r  rK   r  rK   r  rK   r   r   r  r  r  r  r"   r  )r   r   r   r   r"   r  )
r   r   r  r1  r  r  r   r   r"   r2  )rL  rK   r  rK   r   r   r  r  r  r  r"   r!   )NN)rL  rK   rO  r   rP  r   rQ  r   r  rK   r   r   r  r  r  r  r"   r   )rc  rK   r  rK   r   r   r  r  r  r  r"   r   )rc  rK   r  rK   r   r   r  r  r  r  r"   rj  )rc  rK   r  rK   r   r   r  rp  r  r  r"   r   )rc  rK   r  rK   r   r   r  rp  r  r  r"   rj  rU   )rw  rK   r  rK   r   r   r  rx  r  r  r  r!   r"   ry  )r  rK   r  rK   r  rK   r   r   r  rp  r  r  r"   r  )r"   r  )r  rK   r  rK   r   r   r  rp  r  r  r"   r  )rc  rK   r  r#   r  rK   r   r   r  r  r  r  r"   r  )rc  rK   r  rK   r   r   r  rx  r  r  r"   r  )r   r   r"   r!   )r   r   r"   r  )
r   r   r  r#   r  r#   r  r!   r"   r#   )r   r   r  r   r  r!   r"   r  )r  r#   r"   r#   )r  rK   r  rK   r  rK   r"   r#   )r   r   r  r#   r"   r  )r  rK   r   r   r%  r#   r   rK   r  r   r&  r!   r"   rp  )r  rK   r   r   r%  r#   r  r   r&  r!   r"   rp  )
r   rK   r   r   r%  r#   rI  r!   r"   rp  )T)r-  rK   r  rK   r"   r#   )rn   r#   r"   r#   )
rn   r#   r   r   r   rK   r   r   r"   r  )rn   r#   r   r   r   rK   r"   r  )rn   r#   r   r   r"   r  )r  rK   r"   rK   )r   rK   r"   r#   )r   rK   r   r   r"   r  )rw  r!   r   r   r"   r#   )rz  r{  r"   r!   )r"   r   )drW   rX   rY   __doc__TTYPE_CHECKINGrd   __annotations__re   rf   r   UNIXY_COMPILER_INTERNAL_LIBSr)  rm   rr   rt   rw   ry   r|   r   r   r   r   r   r   r   r   r   r`   ra   r   r   r   r   r   r   r   r9   r   r   r   r   r  r  r  r   r   r   rK  rN  r_  rb  ri  ro  rr  rv  rT  r  r_   r  r  r  r  r  r  r  r  r  r  r   r  classmethodr  r"  r$  r3  r7  r   r  r:  rH  rL  rN  rP  r"  rU  rY  r   r\  r_  rb  re  rg  r  rq  rv  ry  r  r  __classcell__)r  s   @r,   rc   rc   {   s        22 1.0	0000 }~~~~vxxxxx8M7 7 7 7- - - - -   ) ) ) )      % % % %            " " " "          Y7;% % % % %P 7;= = = = = Y7 7 7 72 2 2 2   6 6 6 6D D D D   4 4 4 4; ; ; ;6K 6K 6K 6KpV V V V
 nrFJ8 8 8 8 8 8 lpDH).w w w w w w" quKO8 8 8 8 8 8 & & & &V 5E4L1 1 1 1 1f; ; ; ; quKO< < < < <B FJ     0 lpFJv v v v v v" fj@D+ + + + + +2 ?CIMz z z z z z. 9=CG%! %! %! %! %! %!T */$$ $$ $$ $$ $$L$ $ $ $>       \ D    \* <@FJb5 b5 b5 b5 b5 b5L koEI8 8 8 8 8 8& CG8 8 8 8 8 8 U  U  U  UD   <   C C C C&    "0 0 0 0 0d = = = \=$    [    \* Y6 6 6 6* * * *X   $ )0(=Z^d d d d d
   6       -1N N N N N            D D D DV V V V6O O O OO O O O[ [ [ [    \   	V 	V 	V 	V   
 Y&&&( ( ( ( ( '&(! ! ! ! ! ! ! !r.   rc   )+
__future__r   r;  r`   r  r-  rN   rm  r   r    typingr  pathlibr   r   r   r   r   linkers.linkersr	   r
   r   r   r   r   visualstudior   r  r  r   _typingr   r   r   compilers.compilersr   objectr  Xr6   CompilerArgsr   rc   r'   r.   r,   <module>r     s#   # " " " " "              				 				                                  e e e e e e e e e e             ( ( ( ( ( ( 2 2 2 2 2 2? 
******000000******/////// Hbj %&(d, ,FL FL FL FL FL, FL FL FLR]! ]! ]! ]! ]!H ]! ]! ]! ]! ]!r.   