Skip to content
Snippets Groups Projects
  • Andre Maroneze's avatar
    a3eb75e3
    [Libc] avoid spurious uninitialized warnings from the compiler · a3eb75e3
    Andre Maroneze authored
    Clang 13 emits warnings related to uninitialized variables:
    
    variable 'r' is used uninitialized whenever 'if'
    condition is false [-Wsometimes-uninitialized]
    
    This is due to the fact that the assert(0) macro, when using Frama-C's libc,
    is expanded to __FC_assert. Since it is not known by the compiler, it cannot
    consider it as "noreturn" when the condition is zero. Note that adding
    '__attribute__ ((__noreturn__))' will not work: Frama-C will assume it
    never returns, even when the condition is true.
    Initializing the 'r' variables with a default value will not change the
    actual behavior, and will avoid the warnings.
    a3eb75e3
    History
    [Libc] avoid spurious uninitialized warnings from the compiler
    Andre Maroneze authored
    Clang 13 emits warnings related to uninitialized variables:
    
    variable 'r' is used uninitialized whenever 'if'
    condition is false [-Wsometimes-uninitialized]
    
    This is due to the fact that the assert(0) macro, when using Frama-C's libc,
    is expanded to __FC_assert. Since it is not known by the compiler, it cannot
    consider it as "noreturn" when the condition is zero. Note that adding
    '__attribute__ ((__noreturn__))' will not work: Frama-C will assume it
    never returns, even when the condition is true.
    Initializing the 'r' variables with a default value will not change the
    actual behavior, and will avoid the warnings.