Skip to content
  • Jens Even Berg Blomsoy's avatar
    63c96989
    WL#13110 - Compile time check of error message arguments · 63c96989
    Jens Even Berg Blomsoy authored
    Error message arguments are not checked at compile time. This may
    cause unexpected errors at runtime. This WL creates a CMAKE option
    -DCHECK_ERRMSG_FORMAT=1 where the number and type of arguments to
    error messages are checked at compile time. This is created as an
    option as it only works with the default English language. The
    default setting for this option is OFF.
    
    This will rely on the attribution
    MY_ATTRIBUTE((format(printf, 2, 0)));
    which are effective with gcc, clang, mac and Windows.
    
    This WL will handle the following functions:
    my_printf_error
    my_printv_error
    push_warning_printf
    Parse_tree_node_tmpl<Context>::errorf()
    snprintf()
    my_safe_snprintf()
    my_safe_printf_stderr()
    
    This will only cover calls where the error-code is not a variable
    for the time being. There are some cases where the error-code is
    non-const where we have % substitutions. This will only cover
    messages to the client.
    
    Change-Id: Iffb1c226875f84d944faabf5ee4c50361d8a6434
    63c96989
    WL#13110 - Compile time check of error message arguments
    Jens Even Berg Blomsoy authored
    Error message arguments are not checked at compile time. This may
    cause unexpected errors at runtime. This WL creates a CMAKE option
    -DCHECK_ERRMSG_FORMAT=1 where the number and type of arguments to
    error messages are checked at compile time. This is created as an
    option as it only works with the default English language. The
    default setting for this option is OFF.
    
    This will rely on the attribution
    MY_ATTRIBUTE((format(printf, 2, 0)));
    which are effective with gcc, clang, mac and Windows.
    
    This WL will handle the following functions:
    my_printf_error
    my_printv_error
    push_warning_printf
    Parse_tree_node_tmpl<Context>::errorf()
    snprintf()
    my_safe_snprintf()
    my_safe_printf_stderr()
    
    This will only cover calls where the error-code is not a variable
    for the time being. There are some cases where the error-code is
    non-const where we have % substitutions. This will only cover
    messages to the client.
    
    Change-Id: Iffb1c226875f84d944faabf5ee4c50361d8a6434
Loading