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

osd: silence warning from -Wint-in-bool-context #16744

Merged
merged 1 commit into from Aug 4, 2017

Conversation

Projects
None yet
4 participants
@joscollin
Member

joscollin commented Aug 2, 2017

The following warning appears during build:

ceph/src/osd/PGLog.h: In member function ‘void PGLog::IndexedLog::index(pg_log_dup_t&)’:
ceph/src/osd/PGLog.h:29:43: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
 #define PGLOG_INDEXED_DUPS             (1 << 3)
                                        ~~~^~~~~
ceph/src/osd/PGLog.h:29:43: note: in definition of macro ‘PGLOG_INDEXED_DUPS’
 #define PGLOG_INDEXED_DUPS             (1 << 3)
                                           ^~
ceph/src/osd/PGLog.h: In member function ‘void PGLog::IndexedLog::unindex(const pg_log_dup_t&)’:
ceph/src/osd/PGLog.h:29:43: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
 #define PGLOG_INDEXED_DUPS             (1 << 3)
                                        ~~~^~~~~
ceph/src/osd/PGLog.h:29:43: note: in definition of macro ‘PGLOG_INDEXED_DUPS’
 #define PGLOG_INDEXED_DUPS             (1 << 3)
                                           ^~

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

@tchaikov tchaikov requested a review from ivancich Aug 2, 2017

@@ -476,18 +476,14 @@ struct PGLog : DoutPrefixProvider {
}
void index(pg_log_dup_t& e) {
if (PGLOG_INDEXED_DUPS) {

This comment has been minimized.

@tchaikov

tchaikov Aug 2, 2017

Contributor

i don't really think we should remove this check just to silence the warning.

instead i think it should be

if (indexed_data & PGLOG_INDEXED_DUPS) {

@ivancich what do you think?

This comment has been minimized.

@joscollin

joscollin Aug 2, 2017

Member

@tchaikov I thought of doing the same as you suggested, but then I found that if (PGLOG_INDEXED_DUPS) will always be true.

Let's hear suggestion from @ivancich.

Thanks.

This comment has been minimized.

@ivancich

ivancich Aug 2, 2017

Member

Kefu's fix is correct. It should be:

if (indexed_data & PGLOG_INDEXED_DUPS) {

This comment has been minimized.

@ivancich

ivancich Aug 2, 2017

Member

As Kefu's fix shows, this should be a check whether the flag is set in indexed_data.

}
void unindex(const pg_log_dup_t& e) {
if (PGLOG_INDEXED_DUPS) {

This comment has been minimized.

@tchaikov

tchaikov Aug 2, 2017

Contributor

ditto.

This comment has been minimized.

@ivancich

ivancich Aug 2, 2017

Member

Agreed, ditto!

if (indexed_data & PGLOG_INDEXED_DUPS) {

osd: silence warning from -Wint-in-bool-context
The following warning appears during build:
ceph/src/osd/PGLog.h: In member function ‘void PGLog::IndexedLog::index(pg_log_dup_t&)’:
ceph/src/osd/PGLog.h:29:43: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
 #define PGLOG_INDEXED_DUPS             (1 << 3)
                                        ~~~^~~~~
ceph/src/osd/PGLog.h:29:43: note: in definition of macro ‘PGLOG_INDEXED_DUPS’
 #define PGLOG_INDEXED_DUPS             (1 << 3)
                                           ^~
ceph/src/osd/PGLog.h: In member function ‘void PGLog::IndexedLog::unindex(const pg_log_dup_t&)’:
ceph/src/osd/PGLog.h:29:43: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
 #define PGLOG_INDEXED_DUPS             (1 << 3)
                                        ~~~^~~~~
ceph/src/osd/PGLog.h:29:43: note: in definition of macro ‘PGLOG_INDEXED_DUPS’
 #define PGLOG_INDEXED_DUPS             (1 << 3)
                                           ^~
Signed-off-by: Jos Collin <jcollin@redhat.com>
@joscollin

This comment has been minimized.

Member

joscollin commented Aug 2, 2017

Jenkins retest this please

@joscollin

This comment has been minimized.

Member

joscollin commented Aug 2, 2017

@ivancich Thank you.

@tchaikov Did the changes. Please review.

@jdurgin

jdurgin approved these changes Aug 4, 2017

@jdurgin jdurgin merged commit 91ad2e6 into ceph:master Aug 4, 2017

4 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
make check (arm64) make check succeeded
Details

@joscollin joscollin deleted the joscollin:wip-osd-warning branch Aug 5, 2017

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