o
    uJAfU                     @  s  d dl mZ d dlZd dl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 ddlmZ ddlmZ ddlmZmZ ddlmZmZ ddlm Z  ddlm!Z!m"Z" ddl#m$Z$m%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/ ddl.m0Z0m1Z1 ddl2m3Z3m4Z4m5Z5 ej6rddlm7Z7m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@ ddl	mAZA dd lBmCZC dd!l2mDZD e5ZEneFZEg d"ZGeGd#d$ eGD 7 ZGeGg d%7 ZGG d&d' d'ee5ZHG d(d) d)eEZIG d*d+ d+eIe'eHZJG d,d- d-eJZKG d.d/ d/eJZLG d0d1 d1e-eJZMG d2d3 d3eeHZNG d4d5 d5e eHZOG d6d7 d7e+eHZPG d8d9 d9e+eHZQG d:d; d;e)eHZRG d<d= d=e$eHZSG d>d? d?eJZTG d@dA dAeEZUG dBdC dCeeUeHZVG dDdE dEeIeeUeHZWG dFdG dGe%eUeHZXG dHdI dIeXZYG dJdK dKeeHZZG dLdM dMeeHZ[G dNdO dOeeHZ\G dPdQ dQeeHZ]G dRdS dSeeHZ^G dTdU dUe^Z_G dVdW dWe/eHZ`G dXdY dYe/eHZadS )Z    )annotationsN   )coredata)mlog)MesonExceptionversion_compare	OptionKey   )C_FUNC_ATTRIBUTES)CLikeCompiler)CcrxCompiler)Xc16Compiler)CompCertCompiler)
TICompiler)ArmCompilerArmclangCompiler)MSVCCompilerClangClCompiler)GnuCompiler)gnu_common_warning_argsgnu_c_warning_args)IntelGnuLikeCompilerIntelVisualStudioLikeCompiler)ClangCompiler)ElbrusCompiler)PGICompiler)EmscriptenMixin)MetrowerksCompiler)mwccarm_instruction_set_argsmwcceppc_instruction_set_args)gnu_winlibsmsvc_winlibsCompiler)MutableKeyedOptionDictTypeKeyedOptionDictType)
Dependency)MachineInfo)Environment)DynamicLinker)MachineChoice)ExternalProgram)CompileCheckMode)	c89c9xc90c99c1xc11c17c18c2xc                 C  s   g | ]}d |dd  qS )gnur	   N ).0stdr6   r6   ;/usr/lib/python3.10/site-packages/mesonbuild/compilers/c.py
<listcomp><   s    r:   )iso9899:1990iso9899:199409iso9899:1999iso9899:2011iso9899:2017iso9899:2018c                      sd   e Zd Zd1ddZdZ			d2d3ddZd4ddZd5d d!Zddd"d6d,d-Zd7 fd/d0Z	  Z
S )8	CCompilernamestrreturnc                 C  s*   zt | W S  ty   td| dw )NzUnknown function attribute "")r
   KeyErrorr   )selfrB   r6   r6   r9   attribute_check_funcA   s
   
zCCompiler.attribute_check_funccNccacheT.List[str]exelistversionfor_machiner)   is_crossboolinfo'MachineInfo'exe_wrapperT.Optional['ExternalProgram']linkerT.Optional['DynamicLinker']full_versionT.Optional[str]c
           
      C  s,   t j| |||||||	|d	 t| | d S )N)rO   rW   rU   )r"   __init__r   
rG   rJ   rL   rM   rN   rO   rQ   rS   rU   rW   r6   r6   r9   rY   I   s   zCCompiler.__init__c                 C     dgS )Nz	-nostdincr6   rG   r6   r6   r9   get_no_stdinc_argsR      zCCompiler.get_no_stdinc_argswork_direnvironment'Environment'Nonec                 C  s   d}|  ||d|S )Nz.int main(void) { int class=0; return class; }
zsanitycheckc.c)Z_sanity_check_impl)rG   r_   r`   coder6   r6   r9   sanity_checkU   s   zCCompiler.sanity_check
extra_argsdependencieshnamesymbolprefixenvrf   IT.Union[None, T.List[str], T.Callable[['CompileCheckMode'], T.List[str]]]rg    T.Optional[T.List['Dependency']]T.Tuple[bool, bool]c          	      C  s.   |||d}d}| j |jdi ||||dS )N)rj   headerri   z{prefix}
        #include <{header}>
        int main(void) {{
            /* If it's not defined as a macro, try to use as a symbol */
            #ifndef {symbol}
                {symbol};
            #endif
            return 0;
        }}re   r6   )compilesformat)	rG   rh   ri   rj   rk   rf   rg   Zfargstr6   r6   r9   has_header_symbolY   s
   	zCCompiler.has_header_symbol'MutableKeyedOptionDictType'c                   s6   t   }td| j| jd}||tdti |S )Nr8   machinelangC)	superget_optionsr   rN   languageupdater   UserStdOption	_ALL_STDS)rG   optskey	__class__r6   r9   rz   j   s   
zCCompiler.get_options)rB   rC   rD   rC   NNNrJ   rK   rL   rK   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rD   rK   )r_   rC   r`   ra   rD   rb   )rh   rC   ri   rC   rj   rC   rk   ra   rf   rl   rg   rm   rD   rn   rD   rt   )__name__
__module____qualname__rH   r{   rY   r]   rd   rs   rz   __classcell__r6   r6   r   r9   rA   @   s    

	
rA   c                      s.   e Zd ZdZdZdZdZd	 fddZ  ZS )
_ClangCStdszMixin class for clang based compilers for setting C standards.

    This is used by both ClangCCompiler and ClangClCompiler, as they share
    the same versions
    z>=6.0.0>=8.0.0>=9.0.0rD   rt   c                   s   t   }g d}t| j| jr|dg7 }t| j| jr!|dg7 }t| j| jr-|dg7 }|td| j| j	d }t
|tjsBJ d|j|dd	 |S )
Nr,   r/   r1   r2   r3   r4   r8   ru   for mypyTr5   )ry   rz   r   rM   _C17_VERSION_C18_VERSION_C2X_VERSIONr   rN   r{   
isinstancer   r}   set_versionsrG   r   stdsstd_optr   r6   r9   rz      s   



z_ClangCStds.get_optionsr   )	r   r   r   __doc__r   r   r   rz   r   r6   r6   r   r9   r   s   s    r   c                      sF   e Zd Z				d!d"ddZd# fddZd$ddZd$dd Z  ZS )%ClangCCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   definesT.Optional[T.Dict[str, str]]rW   rX   c                 C  sX   t j| |||||||||
d
 t| |	 ddg}g ||dg |ddg dgd| _d S NrU   rW   -Wall-Winvalid-pch-Wextra
-Wpedanticz-Weverything0123
everything)rA   rY   r   	warn_argsrG   rJ   rL   rM   rN   rO   rQ   rS   rU   r   rW   default_warn_argsr6   r6   r9   rY      s   
zClangCCompiler.__init__rD   rt   c                   sF   t   }| j s| j r!|td| j| jdt	
dti |S )Nwinlibsru   &Standard Win libraries to link against)ry   rz   rQ   
is_windows	is_cygwinr|   r   rN   r{   r   UserArrayOptionr    rG   r   r   r6   r9   rz      s   
zClangCCompiler.get_optionsoptions'KeyedOptionDictType'c                 C  8   g }|t d| j| jd }|jdkr|d|j  |S Nr8   ru   none-std=r   rN   r{   valueappendrG   r   argsr8   r6   r6   r9   get_option_compile_args   
   
z&ClangCCompiler.get_option_compile_argsc                 C  ^   | j  s
| j  r-|td| j| jd j }t|t	sJ |D ]	}t|t
s*J q!|S g S Nr   ru   )rQ   r   r   r   rN   r{   r   copyr   listrC   rG   r   libslr6   r6   r9   get_option_link_args      z#ClangCCompiler.get_option_link_argsNNNNrJ   rK   rL   rK   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   r   r   rW   rX   r   r   r   rD   rK   )r   r   r   rY   rz   r   r   r   r6   r6   r   r9   r      s    
r   c                   @     e Zd ZdZdS )ArmLtdClangCCompilerZarmltdclangNr   r   r   idr6   r6   r6   r9   r          r   c                   @  s   e Zd ZdZdZdZdZdS )AppleClangCCompilerzHandle the differences between Apple Clang and Vanilla Clang.

    Right now this just handles the differences between the versions that new
    C standards were added.
    z>=10.0.0z>=11.0.0N)r   r   r   r   r   r   r   r6   r6   r6   r9   r      s
    r   c                   @  s$   e Zd ZdZ				ddddZdS )EmscriptenCCompiler
emscriptenNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   r   r   rW   rX   c                 C  sB   |st dt|dst dtj| |||||||||	|
d d S )Nz;Emscripten compiler can only be used for cross compilation.z	>=1.39.19z$Meson requires Emscripten >= 1.39.19)rS   rU   r   rW   )r   r   r   rY   rG   rJ   rL   rM   rN   rO   rQ   rS   rU   r   rW   r6   r6   r9   rY      s   

zEmscriptenCCompiler.__init__r   r   r   r   r   r   rY   r6   r6   r6   r9   r      s    r   c                   @  s@   e Zd ZdZ			d d!ddZd"ddZd#ddZd#ddZdS )$ArmclangCCompilerz
    Keil armclang
    NrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
                 C  sV   t j| |||||||||	d
 t|  ddg}
g |
|
dg |
ddg dgd| _d S r   )rA   rY   r   r   rG   rJ   rL   rM   rN   rO   rQ   rS   rU   rW   r   r6   r6   r9   rY      s   

zArmclangCCompiler.__init__rD   rt   c                 C  sJ   t | }|td| j| jd }t|tjsJ d|jg ddd |S )Nr8   ru   r   )r.   r/   r1   Tr   	rA   rz   r   rN   r{   r   r   r}   r   rG   r   r   r6   r6   r9   rz      
   
zArmclangCCompiler.get_optionsr   r   c                 C  r   r   r   r   r6   r6   r9   r      r   z)ArmclangCCompiler.get_option_compile_argsc                 C     g S Nr6   rG   r   r6   r6   r9   r        z&ArmclangCCompiler.get_option_link_argsr   r   r   r   )r   r   r   r   rY   rz   r   r   r6   r6   r6   r9   r      s    

r   c                   @  sT   e Zd ZdZdZdZ				d(d)ddZd*ddZd+d d!Zd+d"d#Z	d,d&d'Z
dS )-GnuCCompilerr   r   z>=3.4.0NrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   r   r   rW   rX   c                 C  s   t j| |||||||||
d
 t| |	 dg}t| j| jr$|dg7 }g ||dg |ddg |ddg | t | t d| _	d S )Nr   r   r   r   r   r   )
rA   rY   r   r   rM   _INVALID_PCH_VERSIONZsupported_warn_argsr   r   r   r   r6   r6   r9   rY     s   


zGnuCCompiler.__init__rD   rt   c                 C  s   t | }g d}t| j| jr|ddg7 }t| j| jr"|dg7 }td| j| jd}|| }t	|t
js9J d|j|dd	 | j sJ| j rX||d
t
dti |S )Nr   r2   r3   r4   r8   ru   r   Tr   r   r   )rA   rz   r   rM   r   r   r   rN   r{   r   r   r}   r   rQ   r   r   r|   evolver   r    )rG   r   r   r   r   r6   r6   r9   rz     s$   

zGnuCCompiler.get_optionsr   r   c                 C  r   )Nr8   rw   rv   r   r   )r   r{   rN   r   r   r   r6   r6   r9   r   2  r   z$GnuCCompiler.get_option_compile_argsc                 C  r   )Nr   r   )rQ   r   r   r   r{   rN   r   r   r   r   rC   r   r6   r6   r9   r   9  r   z!GnuCCompiler.get_option_link_argspch_dirro   c                 C  s   ddt j|gS )Nz-fpch-preprocessz-include)ospathbasename)rG   r   ro   r6   r6   r9   get_pch_use_argsC  s   zGnuCCompiler.get_pch_use_argsr   r   r   r   )r   rC   ro   rC   rD   rK   )r   r   r   r   r   r   rY   rz   r   r   r   r6   r6   r6   r9   r     s    



r   c                   @  s   e Zd Z			ddddZdS )PGICCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  ,   t j| |||||||||	d
 t|  d S Nr   rA   rY   r   rZ   r6   r6   r9   rY   H     zPGICCompiler.__init__r   r   )r   r   r   rY   r6   r6   r6   r9   r   G  s
    r   c                   @  s"   e Zd ZdZ			ddddZdS )NvidiaHPC_CCompilerZ
nvidia_hpcNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   r   rZ   r6   r6   r9   rY   U  r   zNvidiaHPC_CCompiler.__init__r   r   r   r6   r6   r6   r9   r   Q  s    r   c                      sD   e Zd Z				d'd(ddZd)ddZdddd* fd%d&Z  ZS )+ElbrusCCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   r   r   rW   rX   c                 C  s,   t j| |||||||||
d
 t|  d S r   )rA   rY   r   r   r6   r6   r9   rY   _     zElbrusCCompiler.__init__rD   rt   c                 C  s   t | }g d}|g d7 }t| jdr|ddg7 }t| jdr-t| jdr-|g d7 }t| jd	r9|g d7 }t| jd
rE|g d7 }|td| j| jd }t|tj	sZJ d|
| |S )N)r,   r-   r/   Zgnu89Zgnu9xZgnu99)r;   r<   r=   z	>=1.20.00r1   Zgnu11z	>=1.21.00z<1.22.00)r.   r0   Zgnu90Zgnu1xr>   z	>=1.23.00z	>=1.26.00)r2   r3   r?   r@   Zgnu17Zgnu18r8   ru   r   rA   rz   r   rM   r   rN   r{   r   r   r}   r   r   r6   r6   r9   rz   h  s   

zElbrusCCompiler.get_optionsre   funcnamerj   rk   ra   rf   T.Optional[T.List[str]]rg   rm   rn   c                  s"   |dkrdS t  j|||||dS )Nlchmod)FFre   )ry   has_function)rG   r   rj   rk   rf   rg   r   r6   r9   r   {  s   zElbrusCCompiler.has_functionr   r   r   )r   rC   rj   rC   rk   ra   rf   r   rg   rm   rD   rn   )r   r   r   rY   rz   r   r   r6   r6   r   r9   r   ^  s    
	r   c                   @  2   e Zd Z			ddddZdddZd ddZdS )!IntelCCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
                 C  sh   t j| |||||||||	d
 t|  d| _ddg}
g |
dg |
ddg |
ddg |
dg d| _d S )Nr   zc-headerr   z-w3z-diag-disable:remarkr   r   )rA   rY   r   Zlang_headerr   r   r6   r6   r9   rY     s   


zIntelCCompiler.__init__rD   rt   c                 C  sd   t | }ddg}t| jdr|dg7 }|td| j| jd }t|tj	s)J d|j
|dd	 |S )
Nr,   r/   z>=16.0.0r1   r8   ru   r   Tr   r   r   r6   r6   r9   rz     s   

zIntelCCompiler.get_optionsr   r   c                 C  r   r   r   r   r6   r6   r9   r     r   z&IntelCCompiler.get_option_compile_argsr   r   r   r   r   r   r   rY   rz   r   r6   r6   r6   r9   r     s    

r   c                   @  r   )IntelLLVMCCompilerz
intel-llvmNr   r6   r6   r6   r9   r     r   r   c                      s,   e Zd ZdZd fddZdd	d
Z  ZS )VisualStudioLikeCCompilerMixinz3Shared methods that apply to MSVC-like C compilers.rD   rt   c                   s2   t   }|td| j| jdtdti |S )Nr   ru   zWindows libs to link against.)	ry   rz   r|   r   rN   r{   r   r   r!   r   r   r6   r9   rz     s   
z*VisualStudioLikeCCompilerMixin.get_optionsr   r   rK   c                 C  sJ   t d| j| jd}|| j }t|tsJ |D ]	}t|ts"J q|S r   )r   rN   r{   r   r   r   r   rC   )rG   r   r   r   r   r6   r6   r9   r     s   z3VisualStudioLikeCCompilerMixin.get_option_link_argsr   r   )r   r   r   r   rz   r   r   r6   r6   r   r9   r     s    
r   c                      sB   e Zd ZdZdZ			dd ddZd! fddZd"ddZ  ZS )#VisualStudioCCompilerz>=19.28NrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   targetrS   rT   rU   rV   rW   rX   c                 C  s.   t j| ||||||||	|
d
 t| | d S r   )rA   rY   r   )rG   rJ   rL   rM   rN   rO   rQ   r   rS   rU   rW   r6   r6   r9   rY     
   zVisualStudioCCompiler.__init__rD   rt   c                   s   t   }ddg}t| j| jr|dg7 }t| j| jr"|ddg7 }|td| j| jd }t	|t
js7J d|j|d	d	d
 |S )Nr,   r/   r1   r2   r3   r8   ru   r   T)r5   gnu_deprecated)ry   rz   r   rM   _C11_VERSIONr   r   rN   r{   r   r   r}   r   r   r   r6   r9   rz     s   

z!VisualStudioCCompiler.get_optionsr   r   c                 C  sJ   g }|t d| j| jd }|jdv r|d |S |jdv r#|d |S )Nr8   ru   >   r1   z/std:c11>   r3   r2   z/std:c17r   r   r6   r6   r9   r     s   



z-VisualStudioCCompiler.get_option_compile_argsr   )rJ   rK   rL   rK   rM   rC   rN   r)   rO   rP   rQ   rR   r   rC   rS   rT   rU   rV   rW   rX   r   r   )	r   r   r   r   r   rY   rz   r   r   r6   r6   r   r9   r     s    
r   c                   @  s(   e Zd Z			ddddZdddZdS )ClangClCCompilerNrL   rK   rM   rC   rN   r)   rO   rP   rQ   rR   r   rS   rT   rU   rV   rW   rX   c
           
      C  .   t j| g ||||||||	d
 t| | d S r   )rA   rY   r   
rG   rL   rM   rN   rO   rQ   r   rS   rU   rW   r6   r6   r9   rY     r   zClangClCCompiler.__init__r   r   rD   c                 C  s4   t d| j| jd}|| j}|dkrd| gS g S )Nr8   ru   r   z/clang:-std=)r   rN   r{   r   )rG   r   r   r8   r6   r6   r9   r     s
   
z(ClangClCCompiler.get_option_compile_argsr   rL   rK   rM   rC   rN   r)   rO   rP   rQ   rR   r   rC   rS   rT   rU   rV   rW   rX   r   )r   r   r   rY   r   r6   r6   r6   r9   r     s    
r   c                      s>   e Zd ZdZ			ddddZd  fddZd!ddZ  ZS )"IntelClCCompilerz!Intel "ICL" compiler abstraction.NrL   rK   rM   rC   rN   r)   rO   rP   rQ   rR   r   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   )rA   rY   r   r   r6   r6   r9   rY     r   zIntelClCCompiler.__init__rD   rt   c                   sF   t   }|td| j| jd }t|tjsJ d|g d |S Nr8   ru   r   r   )	ry   rz   r   rN   r{   r   r   r}   r   r   r   r6   r9   rz     
   
zIntelClCCompiler.get_optionsr   r   c                 C  sX   g }t d| j| jd}|| }|jdkrtjddd |S |jdkr*|d|j  |S )	Nr8   ru   r,   zUICL doesn't explicitly implement c89, setting the standard to 'none', which is close.T)oncer   z/Qstd:)r   rN   r{   r   r   logr   rG   r   r   r   r8   r6   r6   r9   r     s   

z(IntelClCCompiler.get_option_compile_argsr   r  r   r   )r   r   r   r   rY   rz   r   r   r6   r6   r   r9   r    s    
r  c                   @  r   )IntelLLVMClCCompilerzintel-llvm-clNr   r6   r6   r6   r9   r    r   r  c                   @  r   )!ArmCCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   )rA   rY   r   rZ   r6   r6   r9   rY   $  s
   zArmCCompiler.__init__rD   rt   c                 C  F   t | }|td| j| jd }t|tjsJ d|g d |S r  r   r   r6   r6   r9   rz   .  r  zArmCCompiler.get_optionsr   r   c                 C  <   g }t d| j| jd}|| }|jdkr|d|j  |S Nr8   ru   r   z--r   r  r6   r6   r9   r   5     
z$ArmCCompiler.get_option_compile_argsr   r   r   r   r   r6   r6   r6   r9   r	  #  s    

r	  c                   @  sx   e Zd Z			d.d/ddZd0ddZd1ddZd0ddZd2dd Zd0d!d"Zd0d#d$Z	d3d&d'Z
d0d(d)Zd4d,d-ZdS )5CcrxCCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   )rA   rY   r   rZ   r6   r6   r9   rY   ?  r   zCcrxCCompiler.__init__rD   c                 C  r[   )Nz-nologor6   r\   r6   r6   r9   get_always_argsI  r^   zCcrxCCompiler.get_always_argsrt   c                 C  F   t | }|td| j| jd }t|tjsJ d|ddg |S Nr8   ru   r   r,   r/   r   r   r6   r6   r9   rz   L  r  zCcrxCCompiler.get_optionsc                 C  r   r   r6   r\   r6   r6   r9   r]   S  r   z CcrxCCompiler.get_no_stdinc_argsr   r   c                 C  sN   g }t d| j| jd}|| }|jdkr|d |S |jdkr%|d |S )Nr8   ru   r,   z-lang=cr/   z	-lang=c99r   r  r6   r6   r9   r   V  s   



z%CcrxCCompiler.get_option_compile_argsc                 C  r   r   r6   r\   r6   r6   r9   get_compile_only_args`  r   z#CcrxCCompiler.get_compile_only_argsc                 C  r[   )Nz-optimize=0r6   r\   r6   r6   r9   get_no_optimization_argsc  r^   z&CcrxCCompiler.get_no_optimization_argsr   c                 C     d| gS )Nz-output=obj=r6   rG   r   r6   r6   r9   get_output_argsf     zCcrxCCompiler.get_output_argsc                 C  r[   Nz-change_message=errorr6   r\   r6   r6   r9   get_werror_argsi  r^   zCcrxCCompiler.get_werror_argsr   	is_systemc                 C     |dkrd}d| gS )N .z	-include=r6   rG   r   r  r6   r6   r9   get_include_argsl     
zCcrxCCompiler.get_include_argsr   r   r   r   r   r   rC   rD   rK   r   rC   r  rP   rD   rK   )r   r   r   rY   r  rz   r]   r   r  r  r  r  r  r6   r6   r6   r9   r  >  s    









r  c                   @  sn   e Zd Z			d,d-ddZd.ddZd/ddZd0ddZd/dd Zd/d!d"Zd1d$d%Z	d/d&d'Z
d2d*d+ZdS )3Xc16CCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   )rA   rY   r   rZ   r6   r6   r9   rY   s  r   zXc16CCompiler.__init__rD   rt   c                 C  sJ   t | }|td| j| jd }t|tjsJ d|jddgdd |S )Nr8   ru   r   r,   r/   Tr   r   r   r6   r6   r9   rz   |  r   zXc16CCompiler.get_optionsc                 C  r   r   r6   r\   r6   r6   r9   r]     r   z Xc16CCompiler.get_no_stdinc_argsr   r   c                 C  sF   g }t d| j| jd}|| }|jdkr!|d |d|j  |S )Nr8   ru   r   z-ansir   r   r  r6   r6   r9   r     s   

z%Xc16CCompiler.get_option_compile_argsc                 C  r   r   r6   r\   r6   r6   r9   r    r   z#Xc16CCompiler.get_compile_only_argsc                 C  r[   Nz-O0r6   r\   r6   r6   r9   r    r^   z&Xc16CCompiler.get_no_optimization_argsr   c                 C  r  Nz-or6   r  r6   r6   r9   r    r  zXc16CCompiler.get_output_argsc                 C  r[   r  r6   r\   r6   r6   r9   r    r^   zXc16CCompiler.get_werror_argsr   r  c                 C  r  Nr  r  z-Ir6   r  r6   r6   r9   r    r   zXc16CCompiler.get_include_argsr   r   r   r   r   r!  r"  )r   r   r   rY   rz   r]   r   r  r  r  r  r  r6   r6   r6   r9   r#  r  s    
	


	


r#  c                   @  sZ   e Zd Z			d(d)ddZd*ddZd+ddZd,ddZd-d d!Zd,d"d#Zd.d&d'Z	dS )/CompCertCCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   )rA   rY   r   rZ   r6   r6   r9   rY     r   zCompCertCCompiler.__init__rD   rt   c                 C  r  r  r   r   r6   r6   r9   rz     r  zCompCertCCompiler.get_optionsr   r   c                 C  r   r   r6   r   r6   r6   r9   r     r   z)CompCertCCompiler.get_option_compile_argsc                 C  r[   r$  r6   r\   r6   r6   r9   r    r^   z*CompCertCCompiler.get_no_optimization_argsr   c                 C  r  r%  r6   r  r6   r6   r9   r    r  z!CompCertCCompiler.get_output_argsc                 C  r[   )Nz-Werrorr6   r\   r6   r6   r9   r    r^   z!CompCertCCompiler.get_werror_argsr   r  c                 C  r  r&  r6   r  r6   r6   r9   r    r   z"CompCertCCompiler.get_include_argsr   r   r   r   r   r!  r"  )
r   r   r   rY   rz   r   r  r  r  r  r6   r6   r6   r9   r'    s    
	



r'  c                   @  sF   e Zd Z			d!d"ddZd#ddZd$ddZd#ddZd%dd ZdS )&TICCompilerNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   )rA   rY   r   rZ   r6   r6   r9   rY     r   zTICCompiler.__init__rD   c                 C  r   r   r6   r\   r6   r6   r9   r    r   zTICCompiler.get_always_argsrt   c                 C  r
  r  r   r   r6   r6   r9   rz     r  zTICCompiler.get_optionsc                 C  r   r   r6   r\   r6   r6   r9   r]     r   zTICCompiler.get_no_stdinc_argsr   r   c                 C  r  r  r   r  r6   r6   r9   r     r  z#TICCompiler.get_option_compile_argsr   r   r   r   r   )r   r   r   rY   r  rz   r]   r   r6   r6   r6   r9   r(    s    



r(  c                   @  r   )C2000CCompilerc2000Nr   r6   r6   r6   r9   r)    r   r)  c                   @  @   e Zd ZdZ			d"d#ddZd$ddZd%ddZd&d d!ZdS )'MetrowerksCCompilerARMmwccarmNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   rA   rY   r   rZ   r6   r6   r9   rY     r   zMetrowerksCCompilerARM.__init__instruction_setrD   r   c                 C     t |d S r   )r   getrG   r/  r6   r6   r9   get_instruction_set_args  r  z/MetrowerksCCompilerARM.get_instruction_set_argsrt   c                 C  2   t | }dg}dg| |td| j| jd _|S Nr/   r   r8   ru   rA   rz   r   rN   r{   choicesrG   r   Zc_stdsr6   r6   r9   rz        
z"MetrowerksCCompilerARM.get_optionsr   r   c                 C  s>   g }|t d| j| jd }|jdkr|d ||j |S )Nr8   ru   r   z-langr   r   r6   r6   r9   r     s   

z.MetrowerksCCompilerARM.get_option_compile_argsr   r   r/  rC   rD   r   r   r   r   r   r   r   rY   r3  rz   r   r6   r6   r6   r9   r,        
	
r,  c                   @  r+  )'"MetrowerksCCompilerEmbeddedPowerPCmwcceppcNrJ   rK   rL   rM   rC   rN   r)   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   c
           
      C  r   r   r.  rZ   r6   r6   r9   rY     r   z+MetrowerksCCompilerEmbeddedPowerPC.__init__r/  rD   r   c                 C  r0  r   )r   r1  r2  r6   r6   r9   r3    r  z;MetrowerksCCompilerEmbeddedPowerPC.get_instruction_set_argsrt   c                 C  r4  r5  r6  r8  r6   r6   r9   rz     r9  z.MetrowerksCCompilerEmbeddedPowerPC.get_optionsr   r   c                 C  r   )Nr8   ru   r   z-lang r   r   r6   r6   r9   r     r   z:MetrowerksCCompilerEmbeddedPowerPC.get_option_compile_argsr   r   r:  r   r   r;  r6   r6   r6   r9   r=    r<  r=  )b
__future__r   Zos.pathr   typingTr  r   r   mesonlibr   r   r   Zc_function_attributesr
   Zmixins.cliker   Zmixins.ccrxr   Zmixins.xc16r   Zmixins.compcertr   Z	mixins.tir   Z
mixins.armr   r   Zmixins.visualstudior   r   Z
mixins.gnur   r   r   Zmixins.intelr   r   Zmixins.clangr   Zmixins.elbrusr   Z
mixins.pgir   Zmixins.emscriptenr   Zmixins.metrowerksr   r   r   	compilersr    r!   r"   TYPE_CHECKINGr#   r$   rg   r%   	envconfigr&   r`   r'   linkers.linkersr(   r)   programsr*   r+   ZCompilerMixinBaseobjectr~   rA   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=  r6   r6   r6   r9   <module>   s   3-%A
("& 4." 