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

* G++ warnings for set-control-group-knob from nosh-1.37
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan de Boyne Pollard @ 2018-03-11 23:57 UTC (permalink / raw)
  To: supervision

The macro generates no warning in the GNU C library in Debian 9, but I 
should have caught that overload that was not passing by reference.  It 
is fixed now, thank you. The in-development source archive for 1.38 is 
in the usual place.



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

* Re: G++ warnings for set-control-group-knob from nosh-1.37
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Guillermo @ 2018-03-12  2:33 UTC (permalink / raw)
  To: supervision

2018-03-11 20:57 GMT-03:00 Jonathan de Boyne Pollard:
>
> The macro generates no warning in the GNU C library in Debian 9, but I
> should have caught that overload that was not passing by reference.  It is
> fixed now, thank you. The in-development source archive for 1.38 is in the
> usual place.

Yes, both G++ warnings are gone now. BTW, the removal of the macros
from <sys/types.h> has already been committed, so it looks like it is
going to happen for GNU libc version 2.28:

*  https://sourceware.org/git/?p=glibc.git;a=commit;h=e16deca62e16f645213dffd4ecd1153c37765f17

However, a new warning has appeared:

In file included from set-control-group-knob.cpp:23:0:
popt.h:85:16: warning: 'virtual bool
popt::table_definition::execute(popt::processor&, char, const char*)'
was hidden [-Woverloaded-virtual]
   virtual bool execute(processor &, char c, const char * s);
                ^~~~~~~
popt.h:100:16: warning:   by 'popt::top_table_definition::execute'
[-Woverloaded-virtual]
   virtual bool execute(processor &, const char * s);
                ^~~~~~~

I believe this is because the 1.38 development version dropped a
'using table_definition::execute;' declaration from the definition of
class popt::top_table_definition that was present in 1.37, so the
three parameter version of popt::table_definition::execute() would now
be hidden. I only did a quick 'redo set-control-group-knob.o' test, so
I'm not sure if it is important or if it affects anything, though.

Thanks,
G.


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

* uschedule service bundles supplied with the nosh toolset
  2018-03-12  2:33   ` Guillermo
@ 2018-03-17 13:33     ` Jonathan de Boyne Pollard
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan de Boyne Pollard @ 2018-03-17 13:33 UTC (permalink / raw)
  To: supervision

Guillermo:
> the 1.38 development version

On that subject: If you are tempted to play with the new uschedule 
service bundles, note what is written in the new section in the Guide 
about uschedule.


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