Skip to content
  • Tobias Grosser's avatar
    157122e8
    Check the ctx argument of the memory macros · 157122e8
    Tobias Grosser authored
    
    
    Isl defines its own set of memory management macros. These macros currently
    expect an isl_ctx*, but do not yet actively use it. Hence, it is possible to
    pass a random string to these macros, without the compiler issuing any warnings.
    And in case an isl_ctx* is passed, the compiler does not count the macro call
    as a valid use, which may lead to some unexpected 'variable never used'
    warnings.
    
    We solve this, by adding a compile time check that always verifies that ctx has
    the type isl_ctx*. This is also a valid use of ctx and consequently stops the
    'variable never used' warnings. The check itself is designed such that it will
    be optimized out during compilation.
    
    While at this fix all cases, where some invalid structures were passed to the
    memory location macros instead of an valid isl_ctx*.
    
    Signed-off-by: default avatarTobias Grosser <tobias@grosser.es>
    Signed-off-by: default avatarSven Verdoolaege <skimo@kotnet.org>
    157122e8
    Check the ctx argument of the memory macros
    Tobias Grosser authored
    
    
    Isl defines its own set of memory management macros. These macros currently
    expect an isl_ctx*, but do not yet actively use it. Hence, it is possible to
    pass a random string to these macros, without the compiler issuing any warnings.
    And in case an isl_ctx* is passed, the compiler does not count the macro call
    as a valid use, which may lead to some unexpected 'variable never used'
    warnings.
    
    We solve this, by adding a compile time check that always verifies that ctx has
    the type isl_ctx*. This is also a valid use of ctx and consequently stops the
    'variable never used' warnings. The check itself is designed such that it will
    be optimized out during compilation.
    
    While at this fix all cases, where some invalid structures were passed to the
    memory location macros instead of an valid isl_ctx*.
    
    Signed-off-by: default avatarTobias Grosser <tobias@grosser.es>
    Signed-off-by: default avatarSven Verdoolaege <skimo@kotnet.org>
Loading