Skip to content
  • Steinar H. Gunderson's avatar
    08f46b3c
    Bug #30199590: RUN CLANG-TIDY MODERNIZE-USE-NULLPTR · 08f46b3c
    Steinar H. Gunderson authored
    Another cross-cutting, large-scale clang-tidy fix. It runs the
    “modernize-use-nullptr” fixit over all source code compiled in a fairly
    full-featured MySQL build, changing 0 literals (in pointer context)
    and NULL to nullptr. A typical example would be:
    
    -  mysql_options(connection, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
    +  mysql_options(connection, MYSQL_OPT_CONNECT_ATTR_RESET, nullptr);
    
    as the third argument to mysql_options() is a void *.
    
    Converting 0 and NULL literals to nullptr 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 adding pointers), enable perfect forwarding in more cases (NULL cannot
    be perfect forwarded, nullptr can) and reduces noise from IDEs and other tools
    that check clang-tidy warnings.
    
    Change-Id: Ic863d0a52a78b46f6345e3b69b60bd3dab317e9a
    08f46b3c
    Bug #30199590: RUN CLANG-TIDY MODERNIZE-USE-NULLPTR
    Steinar H. Gunderson authored
    Another cross-cutting, large-scale clang-tidy fix. It runs the
    “modernize-use-nullptr” fixit over all source code compiled in a fairly
    full-featured MySQL build, changing 0 literals (in pointer context)
    and NULL to nullptr. A typical example would be:
    
    -  mysql_options(connection, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
    +  mysql_options(connection, MYSQL_OPT_CONNECT_ATTR_RESET, nullptr);
    
    as the third argument to mysql_options() is a void *.
    
    Converting 0 and NULL literals to nullptr 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 adding pointers), enable perfect forwarding in more cases (NULL cannot
    be perfect forwarded, nullptr can) and reduces noise from IDEs and other tools
    that check clang-tidy warnings.
    
    Change-Id: Ic863d0a52a78b46f6345e3b69b60bd3dab317e9a
Loading