From: Kefu Chai Date: Wed, 18 Apr 2018 03:08:44 +0000 (+0800) Subject: common: silence GCC warnings X-Git-Tag: v13.1.0~172^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c4f51c85df3ba2b20572159f4ebdacb29fe3d6ff;p=ceph.git common: silence GCC warnings Preforker.h:111:8: warning: ignoring return value of ‘ssize_t safe_write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] (void)safe_write(fd[1], &r, sizeof(r)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and compat.cc:36:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (off + sizeof(data) > len) ~~~~~~~~~~~~~~~~~~~^~~~~ Fixes: http://tracker.ceph.com/issues/23774 Signed-off-by: Kefu Chai --- diff --git a/src/common/Preforker.h b/src/common/Preforker.h index f6671a5d302d..8925d944daa3 100644 --- a/src/common/Preforker.h +++ b/src/common/Preforker.h @@ -108,7 +108,7 @@ public: int signal_exit(int r) { if (forked) { /* If we get an error here, it's too late to do anything reasonable about it. */ - (void)safe_write(fd[1], &r, sizeof(r)); + [[maybe_unused]] auto n = safe_write(fd[1], &r, sizeof(r)); } return r; } diff --git a/src/common/compat.cc b/src/common/compat.cc index 18b75874ad05..66f6e7e8f6b3 100644 --- a/src/common/compat.cc +++ b/src/common/compat.cc @@ -33,7 +33,7 @@ int manual_fallocate(int fd, off_t offset, off_t len) { // TODO: compressing filesystems would require random data memset(data, 0x42, sizeof(data)); for (off_t off = 0; off < len; off += sizeof(data)) { - if (off + sizeof(data) > len) + if (off + static_cast(sizeof(data)) > len) r = safe_write(fd, data, len - off); else r = safe_write(fd, data, sizeof(data));