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

common: prevent unset_dumpable from generating warnings #16462

Merged
merged 1 commit into from Jul 21, 2017

Conversation

Projects
None yet
3 participants
@wjwithagen
Contributor

wjwithagen commented Jul 20, 2017

Signed-off-by: Willem Jan Withagen wjw@digiware.nl

@wjwithagen wjwithagen requested a review from badone Jul 20, 2017

@ceph-jenkins

This comment has been minimized.

Collaborator

ceph-jenkins commented Jul 20, 2017

make check failed

@@ -1,3 +1,6 @@
#ifndef __CEPH_COREDUMPCTL_H

This comment has been minimized.

@tchaikov

tchaikov Jul 21, 2017

Contributor

#pragma once

This comment has been minimized.

@wjwithagen

wjwithagen Jul 21, 2017

Contributor

@tchaikov
I just followed the std way all other files were.
But that is fine with me too.
I just added it because I was just there anyways.

This comment has been minimized.

@tchaikov

tchaikov Jul 21, 2017

Contributor

please git grep for pragma once. also please don't define a macro starts with __ . identifiers starting with __ are reserved and their use is technically undefined behavior.

// usually this structure is definded, but not referenced.
// Which will generate unused-variable if not refed with (void)
#define UNSET_DUMPABLE PrCtl unset_dumpable; (void)unset_dumpable

This comment has been minimized.

@tchaikov

tchaikov Jul 21, 2017

Contributor

the reason that you have

/home/jenkins/workspace/ceph-master/src/test/bufferlist.cc:490:11:
warning: unused variable 'unset_dumpable' [-Wunused-variable]
    PrCtl unset_dumpable;
          ^

is that PrCtl an pretty much an empty struct on FreeBSD. so we could just have following change

diff --git a/src/include/coredumpctl.h b/src/include/coredumpctl.h
index e4424941f4..c3e1109f89 100644
--- a/src/include/coredumpctl.h
+++ b/src/include/coredumpctl.h
@@ -1,3 +1,5 @@
+#pragma once
+
 #ifdef HAVE_SYS_PRCTL_H
 #include <iostream>
 #include <sys/prctl.h>
@@ -35,5 +37,8 @@ struct PrCtl {
   }
 };
 #else
-struct PrCtl {};
+struct PrCtl {
+  // to silence the Wunused-variable warning
+  PrCtl() {}
+};
 #endif
common: prevent unset_dumpable from generating warnings
 - Let the struct at least have a CTR

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>

@tchaikov tchaikov added needs-qa tests and removed common needs-qa labels Jul 21, 2017

@tchaikov tchaikov merged commit 6a821ee into ceph:master Jul 21, 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

@wjwithagen wjwithagen deleted the wjwithagen:wjw-warning-unused-unsetdumpable branch Feb 11, 2018

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