supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Guillermo <gdiazhartusch@gmail.com>
To: supervision@list.skarnet.org
Subject: G++ warnings for set-control-group-knob from nosh-1.37
Date: Sun, 11 Mar 2018 12:06:01 -0300	[thread overview]
Message-ID: <CADQ2Nw8t1CoyRGD0n0G-y3RyXqUsG4cdasC_RPsPOzCaWuokew@mail.gmail.com> (raw)

Hello,

1) G++ says:

set-control-group-knob.cpp: In function 'void
set_control_group_knob(const char*&, std::vector<const char*>&,
ProcessEnvironment&)':
set-control-group-knob.cpp:179:5: warning: 'hundred' may be used
uninitialized in this function [-Wmaybe-uninitialized]
     if (hundred > std::numeric_limits<uint_least64_t>::max() / 100U)
     ^~

The only reference to 'hundred' after its definition is the call
'read_first_line_number (percent_of, hundred)', where 'percent_of'
holds the filename passed to set-control-group-knob(1) via its
--percent-of option. read_first_line_number() is defined as this set
of overloaded functions:

bool read_first_line_number (std::istream & i, uint_least64_t v);
bool read_first_line_number (const char * filename, uint_least64_t & v);

The second one is basically a wrapper for the first one. Looking at
the code, shouldn't the 'v' parameter of the first one also have a
reference type?

2) G++ also says:

set-control-group-knob.cpp:153:13: warning: In the GNU C Library,
"major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.

set-control-group-knob.cpp:153:13: warning: In the GNU C Library,
"minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>.

This warning is present for GNU libc >= 2.25, so may I suggest adding
the following to source/set-control-group-knob.cpp?

#if defined(__LINUX__) || defined(__linux__)
#include <sys/sysmacros.h>
#endif

I believe this should work even for Debian jessie's GNU libc 2.19.

Thanks,
G.


             reply	other threads:[~2018-03-11 15:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-11 15:06 Guillermo [this message]
2018-03-11 23:57 ` Jonathan de Boyne Pollard
2018-03-12  2:33   ` Guillermo
2018-03-17 13:33     ` uschedule service bundles supplied with the nosh toolset Jonathan de Boyne Pollard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADQ2Nw8t1CoyRGD0n0G-y3RyXqUsG4cdasC_RPsPOzCaWuokew@mail.gmail.com \
    --to=gdiazhartusch@gmail.com \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).