facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
http://myrocks.io
Other
2.46k stars 711 forks source link

Fix printf formatting for enum class values #1441

Closed laurynas-biveinis closed 3 months ago

laurynas-biveinis commented 3 months ago

These values do not implicitly cast to ints, thus cast them manually.

This fixes the following LLVM 17 build error:

storage/rocksdb/rdb_cmd_srv_helper.cc:215:56: error: format specifies type 'unsigned int' but the argument has type 'enum_json_type' [-Werror,-Wformat]
  215 |                     "expect json type %u, but got %u", expected_type,
      |                                       ~~               ^~~~~~~~~~~~~
      |                                                        static_cast<int>( )
include/mysql/components/services/log_builtins.h:838:66: note: expanded from macro 'LogPluginErrMsg'
  838 |       .message_quoted("Plugin " LOG_COMPONENT_TAG " reported", ##__VA_ARGS__)
      |                                                                  ^~~~~~~~~~~
storage/rocksdb/rdb_cmd_srv_helper.cc:216:21: error: format specifies type 'unsigned int' but the argument has type 'enum_json_type' [-Werror,-Wformat]
  215 |                     "expect json type %u, but got %u", expected_type,
      |                                                   ~~
  216 |                     dom_ptr->json_type());
      |                     ^~~~~~~~~~~~~~~~~~~~
      |                     static_cast<int>(   )
include/mysql/components/services/log_builtins.h:838:66: note: expanded from macro 'LogPluginErrMsg'
  838 |       .message_quoted("Plugin " LOG_COMPONENT_TAG " reported", ##__VA_ARGS__)
      |                                                                  ^~~~~~~~~~~
2 errors generated.
facebook-github-bot commented 3 months ago

@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 3 months ago

This pull request has been merged in facebook/mysql-5.6@43dcab62a13d14d1c8abdf9c0ada0664654941b5.