Skip to content
  • Steinar H. Gunderson's avatar
    3ec803a8
    Bug #30163412: RUN CLANG-TIDY MODERNIZE-USE-BOOL-LITERALS · 3ec803a8
    Steinar H. Gunderson authored
    This is the first cross-cutting, large-scale clang-tidy fix. It runs the
    “modernize-use-bool-literal” fixit over all source code compiled in a fairly
    full-featured MySQL build, changing integral literals to bool literals when
    used in a boolean context. A typical example would be:
    
    -      print_comment(sql_file, 0, "-- Dump completed on %s\n", time_str);
    +      print_comment(sql_file, false, "-- Dump completed on %s\n", time_str);
    
    as the second argument to print_comment() is “bool is_error”.
    
    Converting 0 and 1 literals to false and true makes code easier to read by
    increasing self-documentation, makes type and argument order mistakes more
    difficult, enable compiler warnings when nonsensical operations are attempted
    (such as multiplying bools), and reduces noise from IDEs and other tools that
    check clang-tidy warnings.
    
    Change-Id: I8070dc592cd0341993d2b4261a3949b71ac5e916
    3ec803a8
    Bug #30163412: RUN CLANG-TIDY MODERNIZE-USE-BOOL-LITERALS
    Steinar H. Gunderson authored
    This is the first cross-cutting, large-scale clang-tidy fix. It runs the
    “modernize-use-bool-literal” fixit over all source code compiled in a fairly
    full-featured MySQL build, changing integral literals to bool literals when
    used in a boolean context. A typical example would be:
    
    -      print_comment(sql_file, 0, "-- Dump completed on %s\n", time_str);
    +      print_comment(sql_file, false, "-- Dump completed on %s\n", time_str);
    
    as the second argument to print_comment() is “bool is_error”.
    
    Converting 0 and 1 literals to false and true makes code easier to read by
    increasing self-documentation, makes type and argument order mistakes more
    difficult, enable compiler warnings when nonsensical operations are attempted
    (such as multiplying bools), and reduces noise from IDEs and other tools that
    check clang-tidy warnings.
    
    Change-Id: I8070dc592cd0341993d2b4261a3949b71ac5e916
Loading