# In the GNAT runtime, the secondary stack management system allocates chunks
# with maximum alignment. As a result, code handles pointers inside the blocks
# allocated by malloc, so we have these "possible leaks". These are really
# false-positive leaks. Account for two possible symbol names (depending on the
# version of GNAT used to build Libadalang).
{
   ada_secondary_stack_allocation:1
   Memcheck:Leak
   match-leak-kinds: possible
   fun:malloc
   fun:__gnat_malloc
   fun:system__secondary_stack__ss_allocate
}
{
   ada_secondary_stack_allocation:2
   Memcheck:Leak
   match-leak-kinds: possible
   fun:malloc
   fun:__gnat_malloc
   fun:system__secondary_stack__allocate_dynamic
}

# GCC's 4.9 RTL expander for 64-bit platfroms does not handle passing small
# structures in registers. This is fixed in GCC 6, so while we still support
# GCC 4.9 we need the following:
{
    ada_small_structs_passing
    Memcheck:Addr8
    fun:libadalang__ast__types__param_match_arrayIP
    fun:libadalang__ast__types__create__4
}

# We have a leak in libc on several machines. We won't fix glibc, so just
# ignore these leaks.
{
    libc_nss_parsing
    Memcheck:Leak
    match-leak-kinds: definite
    fun:malloc
    fun:nss_parse_service_list
    fun:__nss_database_lookup
}

# System.Traceback.Symbolic leaks with shared libraries
# (eng/toolchain/gnat#912).
{
    ada_symbolic_trace_back_shared_lib
    Memcheck:Leak
    match-leak-kinds: definite
    fun:malloc
    fun:__gnat_malloc
    fun:system__mmap__read
    fun:system__object_reader__create_stream
    fun:system__object_reader__create_stream__2
    fun:system__dwarf_lines__open
    fun:system__traceback__symbolic__init_module
    fun:system__traceback__symbolic__multi_module_symbolic_traceback
}
