New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osdc: silence warning from `-Wsign-compare` #14729

Merged
merged 1 commit into from Apr 24, 2017

Conversation

Projects
None yet
3 participants
@joscollin
Member

joscollin commented Apr 22, 2017

The following warning appears during make:
[ 28%] Building CXX object src/mds/CMakeFiles/mds.dir/__/osdc/Journaler.cc.o
./src/osdc/Journaler.cc: In member function ‘void Journaler::_do_flush(unsigned int)’:
./src/osdc/Journaler.cc:643:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (newlen < len) {
         ~~~~~~~^~~~~

Signed-off-by: Jos Collin jcollin@redhat.com

@@ -640,7 +640,7 @@ void Journaler::_do_flush(unsigned amount)
waiting_for_zero = true;
return;
}
if (newlen < len) {
if ((uint64_t)newlen < len) { //here newlen is a positive value.

This comment has been minimized.

@badone

badone Apr 24, 2017

Contributor

Can we use "static_cast<uint64_t>(newlen)" here please instead of the c-style cast? Please also remove the comment, it shouldn't really be needed.

@badone

This comment has been minimized.

Contributor

badone commented Apr 24, 2017

Please also merge the two commits into one.

osdc: warning: comparison between signed and unsigned integer express…
…ions

The following warning appears during make. Fixed the review comments too.
[ 28%] Building CXX object src/mds/CMakeFiles/mds.dir/__/osdc/Journaler.cc.o
./src/osdc/Journaler.cc: In member function ‘void Journaler::_do_flush(unsigned int)’:
./src/osdc/Journaler.cc:643:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (newlen < len) {
         ~~~~~~~^~~~~

Signed-off-by: Jos Collin <jcollin@redhat.com>
@joscollin

This comment has been minimized.

Member

joscollin commented Apr 24, 2017

@badone Done.

@badone

badone approved these changes Apr 24, 2017

@tchaikov tchaikov changed the title from osdc: warning: comparison between signed and unsigned integer expressions to osdc: silence warning from `-Wsign-compare` Apr 24, 2017

@badone badone merged commit 3c257ef into ceph:master Apr 24, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodifed Submodules submodules for project are unmodified
Details
default Build finished.
Details

@joscollin joscollin deleted the joscollin:wip-cleanup-osdc-comparision branch Apr 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment