Skip to content
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

Fix compilation with -DHAVE_STATS=0 #5

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions deps/ccommon/include/cc_metric.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ extern "C" {
#define METRIC_DECLARE(_name, _type, _description)
#define METRIC_INIT(_name, _type, _description)
#define METRIC_NAME(_name, _type, _description)
#define INCR(_base, _metric)
#define DECR(_base, _metric)
#define INCR_N(_base, _metric, _delta)
#define DECR_N(_base, _metric, _delta)

#endif

Expand Down
2 changes: 2 additions & 0 deletions deps/ccommon/src/buffer/cc_dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ static rstatus_t
_dbuf_resize(struct buf **buf, uint32_t nsize)
{
struct buf *nbuf;
#if defined CC_STATS && CC_STATS == 1
uint32_t size = buf_size(*buf);
#endif
uint32_t roffset = (*buf)->rpos - (*buf)->begin;
uint32_t woffset = (*buf)->wpos - (*buf)->begin;

Expand Down
2 changes: 2 additions & 0 deletions deps/ccommon/src/cc_rbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ rbuf_destroy(struct rbuf *buf)
log_verb("Destroy ring buffer %p", buf);

if (buf != NULL) {
#if defined CC_STATS && CC_STATS == 1

This comment was marked as spam.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the warning:

/home/seppo/Projects/pelikan/deps/ccommon/src/cc_rbuf.c: In function 'rbuf_destroy':
/home/seppo/Projects/pelikan/deps/ccommon/src/cc_rbuf.c:99:18: warning: unused variable 'cap' [-Wunused-variable]
         uint32_t cap = buf->cap;

This comment was marked as spam.

uint32_t cap = buf->cap;
#endif

cc_free(buf);
INCR(rbuf_metrics, rbuf_destroy);
Expand Down
2 changes: 2 additions & 0 deletions src/util/procinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ procinfo_teardown(void)
void
procinfo_update(void)
{
#if defined CC_STATS && CC_STATS == 1

This comment was marked as spam.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "rename" this function? I was thinking I could keep this function in the if branch and an empty macro in the else branch?

This comment was marked as spam.

struct rusage usage;

procinfo_metrics->pid.vintmax = (intmax_t)getpid();
Expand Down Expand Up @@ -77,4 +78,5 @@ procinfo_update(void)
procinfo_metrics->ru_nsignals.vintmax = (intmax_t)usage.ru_nsignals;
procinfo_metrics->ru_nvcsw.vintmax = (intmax_t)usage.ru_nvcsw;
procinfo_metrics->ru_nivcsw.vintmax = (intmax_t)usage.ru_nivcsw;
#endif
}