supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* G++ warnings for set-control-group-knob from nosh-1.37
@ 2018-03-11 15:06 Guillermo
  2018-03-11 23:57 ` Jonathan de Boyne Pollard
  0 siblings, 1 reply; 4+ messages in thread
From: Guillermo @ 2018-03-11 15:06 UTC (permalink / raw)
  To: supervision

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-17 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 15:06 G++ warnings for set-control-group-knob from nosh-1.37 Guillermo
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

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).