1
0
mirror of https://github.com/MariaDB/server.git synced 2025-10-12 12:25:37 +03:00

compiler warnings (clang 4.0.1 on i386)

extra/mariabackup/fil_cur.cc:361:42: warning: format specifies type 'unsigned long' but the argument has type 'ib_int64_t' (aka 'long long') [-Wformat]
extra/mariabackup/fil_cur.cc:376:9: warning: format specifies type 'unsigned long' but the argument has type 'ib_int64_t' (aka 'long long') [-Wformat]
sql/handler.cc:6196:45: warning: format specifies type 'unsigned long' but the argument has type 'wsrep_trx_id_t' (aka 'unsigned long long') [-Wformat]
sql/log.cc:1681:16: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
sql/log.cc:1687:16: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
sql/wsrep_sst.cc:1388:86: warning: format specifies type 'long' but the argument has type 'wsrep_seqno_t' (aka 'long long') [-Wformat]
sql/wsrep_sst.cc:232:86: warning: format specifies type 'long' but the argument has type 'wsrep_seqno_t' (aka 'long long') [-Wformat]
storage/connect/filamdbf.cpp:450:47: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
storage/connect/filamdbf.cpp:970:47: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
storage/connect/inihandl.cpp:197:16: warning: address of array 'key->name' will always evaluate to 'true' [-Wpointer-bool-conversion]
storage/innobase/btr/btr0scrub.cc:151:17: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
storage/innobase/buf/buf0buf.cc:5085:8: warning: nonnull parameter 'bpage' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
storage/innobase/fil/fil0crypt.cc:2454:5: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
storage/innobase/handler/ha_innodb.cc:18685:7: warning: format specifies type 'unsigned long' but the argument has type 'wsrep_trx_id_t' (aka 'unsigned long long') [-Wformat]
storage/innobase/row/row0mysql.cc:3319:5: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
storage/innobase/row/row0mysql.cc:3327:5: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
storage/maria/ma_norec.c:35:10: warning: implicit conversion from 'int' to 'my_bool' (aka 'char') changes value from 131 to -125 [-Wconstant-conversion]
storage/maria/ma_norec.c:42:10: warning: implicit conversion from 'int' to 'my_bool' (aka 'char') changes value from 131 to -125 [-Wconstant-conversion]
storage/maria/ma_test2.c:1009:12: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
storage/maria/ma_test2.c:1010:12: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
storage/mroonga/ha_mroonga.cpp:9189:44: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
storage/mroonga/vendor/groonga/lib/expr.c:4987:22: warning: comparison of constant -1 with expression of type 'grn_operator' is always false [-Wtautological-constant-out-of-range-compare]
storage/xtradb/btr/btr0scrub.cc:151:17: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
storage/xtradb/buf/buf0buf.cc:5047:8: warning: nonnull parameter 'bpage' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
storage/xtradb/fil/fil0crypt.cc:2454:5: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
storage/xtradb/row/row0mysql.cc:3324:5: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
storage/xtradb/row/row0mysql.cc:3332:5: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
unittest/sql/mf_iocache-t.cc:120:35: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
unittest/sql/mf_iocache-t.cc:96:35: note: expanded from macro 'INFO_TAIL'
This commit is contained in:
Sergei Golubchik
2018-08-31 01:22:51 +02:00
parent aec54fb938
commit 8bee7c16c8
25 changed files with 35 additions and 37 deletions

View File

@@ -666,12 +666,6 @@
#cmakedefine WSREP_PROC_INFO 1 #cmakedefine WSREP_PROC_INFO 1
#endif #endif
#ifdef _AIX
/*
AIX includes inttypes.h from sys/types.h
Explicitly request format macros before the first inclusion of inttypes.h
*/
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif
#endif #endif

View File

@@ -357,7 +357,7 @@ read_retry:
/* skip doublewrite buffer pages */ /* skip doublewrite buffer pages */
xb_a(cursor->page_size == UNIV_PAGE_SIZE); xb_a(cursor->page_size == UNIV_PAGE_SIZE);
msg("[%02u] mariabackup: " msg("[%02u] mariabackup: "
"Page %lu is a doublewrite buffer page, " "Page " UINT64PF " is a doublewrite buffer page, "
"skipping.\n", cursor->thread_n, page_no); "skipping.\n", cursor->thread_n, page_no);
} else { } else {
retry_count--; retry_count--;
@@ -372,7 +372,7 @@ read_retry:
} }
msg("[%02u] mariabackup: " msg("[%02u] mariabackup: "
"Database page corruption detected at page " "Database page corruption detected at page "
"%lu, retrying...\n", cursor->thread_n, UINT64PF ", retrying...\n", cursor->thread_n,
page_no); page_no);
os_thread_sleep(100000); os_thread_sleep(100000);

View File

@@ -21,6 +21,7 @@
*/ */
#include <my_global.h> #include <my_global.h>
#include <inttypes.h>
#include "sql_priv.h" #include "sql_priv.h"
#include "unireg.h" #include "unireg.h"
#include "rpl_handler.h" #include "rpl_handler.h"
@@ -6168,7 +6169,7 @@ void ha_fake_trx_id(THD *thd)
if (thd->wsrep_ws_handle.trx_id != WSREP_UNDEFINED_TRX_ID) if (thd->wsrep_ws_handle.trx_id != WSREP_UNDEFINED_TRX_ID)
{ {
WSREP_DEBUG("fake trx id skipped: %lu", thd->wsrep_ws_handle.trx_id); WSREP_DEBUG("fake trx id skipped: %" PRIu64, thd->wsrep_ws_handle.trx_id);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@@ -1677,13 +1677,13 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
uchar *buf; uchar *buf;
size_t len=0; size_t len=0;
wsrep_write_cache_buf(cache, &buf, &len); wsrep_write_cache_buf(cache, &buf, &len);
WSREP_WARN("binlog trx cache not empty (%lu bytes) @ connection close %lu", WSREP_WARN("binlog trx cache not empty (%zu bytes) @ connection close %lu",
len, thd->thread_id); len, thd->thread_id);
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len); if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
cache = cache_mngr->get_binlog_cache_log(false); cache = cache_mngr->get_binlog_cache_log(false);
wsrep_write_cache_buf(cache, &buf, &len); wsrep_write_cache_buf(cache, &buf, &len);
WSREP_WARN("binlog stmt cache not empty (%lu bytes) @ connection close %lu", WSREP_WARN("binlog stmt cache not empty (%zu bytes) @ connection close %lu",
len, thd->thread_id); len, thd->thread_id);
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len); if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
} }

View File

@@ -15,6 +15,7 @@
#include "wsrep_sst.h" #include "wsrep_sst.h"
#include <inttypes.h>
#include <mysqld.h> #include <mysqld.h>
#include <m_ctype.h> #include <m_ctype.h>
#include <my_sys.h> #include <my_sys.h>
@@ -229,7 +230,7 @@ bool wsrep_sst_wait ()
if (!sst_complete) if (!sst_complete)
{ {
total_wtime += difftime(end_time, start_time); total_wtime += difftime(end_time, start_time);
WSREP_DEBUG("Waiting for SST to complete. current seqno: %ld waited %f secs.", local_seqno, total_wtime); WSREP_DEBUG("Waiting for SST to complete. current seqno: %" PRId64 " waited %f secs.", local_seqno, total_wtime);
service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL, service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL,
"WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime); "WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime);
} }
@@ -1385,7 +1386,7 @@ void wsrep_SE_init_wait()
if (!SE_initialized) if (!SE_initialized)
{ {
total_wtime += difftime(end_time, start_time); total_wtime += difftime(end_time, start_time);
WSREP_DEBUG("Waiting for SST to complete. current seqno: %ld waited %f secs.", local_seqno, total_wtime); WSREP_DEBUG("Waiting for SST to complete. current seqno: %" PRId64 " waited %f secs.", local_seqno, total_wtime);
service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL, service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL,
"WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime); "WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime);
} }

View File

@@ -447,7 +447,7 @@ int DBFFAM::Cardinality(PGLOBAL g)
if (rln && Lrecl != rln) { if (rln && Lrecl != rln) {
// This happens always on some Linux platforms // This happens always on some Linux platforms
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, rln); sprintf(g->Message, MSG(BAD_LRECL), Lrecl, (ushort)rln);
if (Accept) { if (Accept) {
Lrecl = rln; Lrecl = rln;
@@ -967,7 +967,7 @@ int DBMFAM::Cardinality(PGLOBAL g)
if (rln && Lrecl != rln) { if (rln && Lrecl != rln) {
// This happens always on some Linux platforms // This happens always on some Linux platforms
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, rln); sprintf(g->Message, MSG(BAD_LRECL), Lrecl, (ushort)rln);
if (Accept) { if (Accept) {
Lrecl = rln; Lrecl = rln;

0
storage/connect/filamvct.cpp Executable file → Normal file
View File

View File

@@ -194,7 +194,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section )
} }
for (key = section->key; key; key = key->next) for (key = section->key; key; key = key->next)
if (key->name && key->name[0]) { if (key->name[0]) {
fprintf(file, "%s", SVP(key->name)); fprintf(file, "%s", SVP(key->name));
if (key->value) if (key->value)

0
storage/connect/xindex.cpp Executable file → Normal file
View File

View File

@@ -145,7 +145,7 @@ btr_scrub_lock_dict_func(ulint space_id, bool lock_to_close_table,
time_t now = time(0); time_t now = time(0);
if (now >= last + 30) { if (now >= last + 30) {
fprintf(stderr, fprintf(stderr,
"WARNING: %s:%u waited %ld seconds for" "WARNING: %s:%u waited " TIMETPF " seconds for"
" dict_sys lock, space: %lu" " dict_sys lock, space: %lu"
" lock_to_close_table: %d\n", " lock_to_close_table: %d\n",
file, line, now - start, space_id, file, line, now - start, space_id,

View File

@@ -5082,7 +5082,7 @@ database_corrupted:
&& fil_page_get_type(frame) == FIL_PAGE_INDEX && fil_page_get_type(frame) == FIL_PAGE_INDEX
&& page_is_leaf(frame)) { && page_is_leaf(frame)) {
if (bpage && bpage->encrypted) { if (bpage->encrypted) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
"Table in tablespace " ULINTPF " encrypted." "Table in tablespace " ULINTPF " encrypted."
"However key management plugin or used key_version %u is not found or" "However key management plugin or used key_version %u is not found or"

View File

@@ -2449,7 +2449,7 @@ fil_space_crypt_close_tablespace(
if (now >= last + 30) { if (now >= last + 30) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
"Waited %ld seconds to drop space: %s (" ULINTPF "Waited " TIMETPF " seconds to drop space: %s (" ULINTPF
") active threads %u flushing=%d.", ") active threads %u flushing=%d.",
now - start, space->name, space->id, cnt, flushing); now - start, space->name, space->id, cnt, flushing);
last = now; last = now;

View File

@@ -18648,7 +18648,7 @@ wsrep_innobase_kill_one_trx(
thd_get_thread_id(thd), thd_get_thread_id(thd),
victim_trx->id); victim_trx->id);
WSREP_DEBUG("Aborting query: %s conf %d trx: %lu", WSREP_DEBUG("Aborting query: %s conf %d trx: %" PRId64,
(thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void", (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void",
wsrep_thd_conflict_state(thd, FALSE), wsrep_thd_conflict_state(thd, FALSE),
wsrep_thd_ws_handle(thd)->trx_id); wsrep_thd_ws_handle(thd)->trx_id);

View File

@@ -128,7 +128,6 @@ Sun Studio */
#endif /* #if (defined(WIN32) || ... */ #endif /* #if (defined(WIN32) || ... */
#ifndef __WIN__ #ifndef __WIN__
#define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */
#include <inttypes.h> #include <inttypes.h>
#endif /* !__WIN__ */ #endif /* !__WIN__ */
@@ -455,6 +454,7 @@ macro ULINTPF. */
# define INT64PF "%lld" # define INT64PF "%lld"
# define UINT64PF "%llu" # define UINT64PF "%llu"
# define UINT64PFx "%016llx" # define UINT64PFx "%016llx"
# define TIMETPF "%ld"
typedef __int64 ib_int64_t; typedef __int64 ib_int64_t;
typedef unsigned __int64 ib_uint64_t; typedef unsigned __int64 ib_uint64_t;
typedef unsigned __int32 ib_uint32_t; typedef unsigned __int32 ib_uint32_t;
@@ -464,6 +464,7 @@ typedef unsigned __int32 ib_uint32_t;
# define INT64PF "%" PRId64 # define INT64PF "%" PRId64
# define UINT64PF "%" PRIu64 # define UINT64PF "%" PRIu64
# define UINT64PFx "%016" PRIx64 # define UINT64PFx "%016" PRIx64
# define TIMETPF "%" PRIdFAST32
typedef int64_t ib_int64_t; typedef int64_t ib_int64_t;
typedef uint64_t ib_uint64_t; typedef uint64_t ib_uint64_t;
typedef uint32_t ib_uint32_t; typedef uint32_t ib_uint32_t;

View File

@@ -3314,7 +3314,7 @@ fil_wait_crypt_bg_threads(
time_t now = time(0); time_t now = time(0);
if (now >= last + 30) { if (now >= last + 30) {
fprintf(stderr, fprintf(stderr,
"WARNING: waited %ld seconds " "WARNING: waited " TIMETPF " seconds "
"for ref-count on table: %s space: %u\n", "for ref-count on table: %s space: %u\n",
now - start, table->name, table->space); now - start, table->name, table->space);
last = now; last = now;
@@ -3322,7 +3322,7 @@ fil_wait_crypt_bg_threads(
if (now >= start + 300) { if (now >= start + 300) {
fprintf(stderr, fprintf(stderr,
"WARNING: after %ld seconds, gave up waiting " "WARNING: after " TIMETPF " seconds, gave up waiting "
"for ref-count on table: %s space: %u\n", "for ref-count on table: %s space: %u\n",
now - start, table->name, table->space); now - start, table->name, table->space);
break; break;

View File

@@ -32,14 +32,14 @@ my_bool _ma_update_no_record(MARIA_HA *info __attribute__((unused)),
const uchar *oldrec __attribute__((unused)), const uchar *oldrec __attribute__((unused)),
const uchar *record __attribute__((unused))) const uchar *record __attribute__((unused)))
{ {
return HA_ERR_WRONG_COMMAND; return 1;
} }
my_bool _ma_delete_no_record(MARIA_HA *info __attribute__((unused)), my_bool _ma_delete_no_record(MARIA_HA *info __attribute__((unused)),
const uchar *record __attribute__((unused))) const uchar *record __attribute__((unused)))
{ {
return HA_ERR_WRONG_COMMAND; return 1;
} }

View File

@@ -1006,8 +1006,8 @@ w_requests: %10lu\n\
writes: %10lu\n\ writes: %10lu\n\
r_requests: %10lu\n\ r_requests: %10lu\n\
reads: %10lu\n", reads: %10lu\n",
maria_pagecache->blocks_used, (ulong) maria_pagecache->blocks_used,
maria_pagecache->global_blocks_changed, (ulong) maria_pagecache->global_blocks_changed,
(ulong) maria_pagecache->global_cache_w_requests, (ulong) maria_pagecache->global_cache_w_requests,
(ulong) maria_pagecache->global_cache_write, (ulong) maria_pagecache->global_cache_write,
(ulong) maria_pagecache->global_cache_r_requests, (ulong) maria_pagecache->global_cache_r_requests,

View File

@@ -9186,7 +9186,7 @@ void ha_mroonga::remove_related_files(const char *base_path)
if (stat(entry->d_name, &file_status) != 0) { if (stat(entry->d_name, &file_status) != 0) {
continue; continue;
} }
if (!((file_status.st_mode & S_IFMT) && S_IFREG)) { if (!((file_status.st_mode & S_IFMT) == S_IFREG)) {
continue; continue;
} }
if (strncmp(entry->d_name, base_path, base_path_length) == 0) { if (strncmp(entry->d_name, base_path, base_path_length) == 0) {

View File

@@ -4984,7 +4984,7 @@ grn_scan_info_build_full(grn_ctx *ctx, grn_obj *expr, int *n,
next_code_op = -1; next_code_op = -1;
for (i = 0, stat = SCAN_START, c = e->codes, ce = &e->codes[e->codes_curr]; c < ce; c++) { for (i = 0, stat = SCAN_START, c = e->codes, ce = &e->codes[e->codes_curr]; c < ce; c++) {
grn_operator code_op; grn_operator code_op;
if (next_code_op == -1) { if (next_code_op == (grn_operator)-1) {
code_op = c->op; code_op = c->op;
} else { } else {
code_op = next_code_op; code_op = next_code_op;

View File

@@ -145,7 +145,7 @@ btr_scrub_lock_dict_func(ulint space_id, bool lock_to_close_table,
time_t now = time(0); time_t now = time(0);
if (now >= last + 30) { if (now >= last + 30) {
fprintf(stderr, fprintf(stderr,
"WARNING: %s:%u waited %ld seconds for" "WARNING: %s:%u waited " TIMETPF " seconds for"
" dict_sys lock, space: %lu" " dict_sys lock, space: %lu"
" lock_to_close_table: %d\n", " lock_to_close_table: %d\n",
file, line, now - start, space_id, file, line, now - start, space_id,

View File

@@ -5044,7 +5044,7 @@ database_corrupted:
&& fil_page_get_type(frame) == FIL_PAGE_INDEX && fil_page_get_type(frame) == FIL_PAGE_INDEX
&& page_is_leaf(frame)) { && page_is_leaf(frame)) {
if (bpage && bpage->encrypted) { if (bpage->encrypted) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
"Table in tablespace " ULINTPF " encrypted." "Table in tablespace " ULINTPF " encrypted."
"However key management plugin or used " "However key management plugin or used "

View File

@@ -2449,7 +2449,7 @@ fil_space_crypt_close_tablespace(
if (now >= last + 30) { if (now >= last + 30) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
"Waited %ld seconds to drop space: %s (" ULINTPF "Waited " TIMETPF " seconds to drop space: %s (" ULINTPF
") active threads %u flushing=%d.", ") active threads %u flushing=%d.",
now - start, space->name, space->id, cnt, flushing); now - start, space->name, space->id, cnt, flushing);
last = now; last = now;

View File

@@ -140,7 +140,6 @@ Sun Studio */
#endif /* #if (defined(WIN32) || ... */ #endif /* #if (defined(WIN32) || ... */
#ifndef __WIN__ #ifndef __WIN__
#define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */
#include <inttypes.h> #include <inttypes.h>
#endif /* !__WIN__ */ #endif /* !__WIN__ */
@@ -472,6 +471,7 @@ macro ULINTPF. */
# define INT64PF "%lld" # define INT64PF "%lld"
# define UINT64PF "%llu" # define UINT64PF "%llu"
# define UINT64PFx "%016llx" # define UINT64PFx "%016llx"
# define TIMETPF "%ld"
typedef __int64 ib_int64_t; typedef __int64 ib_int64_t;
typedef unsigned __int64 ib_uint64_t; typedef unsigned __int64 ib_uint64_t;
typedef unsigned __int32 ib_uint32_t; typedef unsigned __int32 ib_uint32_t;
@@ -481,6 +481,7 @@ typedef unsigned __int32 ib_uint32_t;
# define INT64PF "%" PRId64 # define INT64PF "%" PRId64
# define UINT64PF "%" PRIu64 # define UINT64PF "%" PRIu64
# define UINT64PFx "%016" PRIx64 # define UINT64PFx "%016" PRIx64
# define TIMETPF "%" PRIdFAST32
typedef int64_t ib_int64_t; typedef int64_t ib_int64_t;
typedef uint64_t ib_uint64_t; typedef uint64_t ib_uint64_t;
typedef uint32_t ib_uint32_t; typedef uint32_t ib_uint32_t;

View File

@@ -3319,7 +3319,7 @@ fil_wait_crypt_bg_threads(
time_t now = time(0); time_t now = time(0);
if (now >= last + 30) { if (now >= last + 30) {
fprintf(stderr, fprintf(stderr,
"WARNING: waited %ld seconds " "WARNING: waited " TIMETPF " seconds "
"for ref-count on table: %s space: %u\n", "for ref-count on table: %s space: %u\n",
now - start, table->name, table->space); now - start, table->name, table->space);
last = now; last = now;
@@ -3327,7 +3327,7 @@ fil_wait_crypt_bg_threads(
if (now >= start + 300) { if (now >= start + 300) {
fprintf(stderr, fprintf(stderr,
"WARNING: after %ld seconds, gave up waiting " "WARNING: after " TIMETPF " seconds, gave up waiting "
"for ref-count on table: %s space: %u\n", "for ref-count on table: %s space: %u\n",
now - start, table->name, table->space); now - start, table->name, table->space);
break; break;

View File

@@ -92,8 +92,8 @@ void sql_print_error(const char *format, ...)
IO_CACHE info; IO_CACHE info;
#define CACHE_SIZE 16384 #define CACHE_SIZE 16384
#define INFO_TAIL ", pos_in_file = %llu, pos_in_mem = %lu", \ #define INFO_TAIL ", pos_in_file = %llu, pos_in_mem = %td", \
info.pos_in_file, (*info.current_pos - info.request_pos) info.pos_in_file, *info.current_pos - info.request_pos
#define FILL 0x5A #define FILL 0x5A