[PATCH v3 3/3] Add tests for the -l/--syscall-limit option

Dmitry V. Levin ldv at strace.io
Thu Mar 2 10:48:32 UTC 2023


On Thu, Mar 02, 2023 at 04:13:30PM +0530, Sahil Siddiq wrote:
> On Friday, 24 February 2023 23:45:58 IST Dmitry V. Levin wrote:
> > > +
> > > +int
> > > +main(int argc, char **argv)
> > > +{
> > > +       return syscall_limit_detach();
> > > +}
> > 
> > It would be better to declare main without arguments if they are not going
> > to be used anyway.
> 
> I decided to declare main without arguments. When I run "make check", I get
> an error (-Werror=old-style-definition) stating that main() is an old style function
> definition.

Most of strace tests already declare main() without arguments.
All you need is to do it properly: int main(void).

> On Thursday, 2 March 2023 05:54:31 IST Dmitry V. Levin wrote:
> > On Thu, Mar 02, 2023 at 03:08:44AM +0530, Sahil Siddiq wrote:
> > [...]
> > 
> > > diff --git a/m4/st_warn_cflags.m4 b/m4/st_warn_cflags.m4
> > > index e226cadb8..dfc59e499 100644
> > > --- a/m4/st_warn_cflags.m4
> > > +++ b/m4/st_warn_cflags.m4
> > > @@ -60,6 +60,7 @@ AC_ARG_ENABLE([gcc-Werror],
> > > 
> > >  	      [enable_gcc_Werror="$st_cv_enable_Werror"])
> > >  
> > >  if test "$enable_gcc_Werror" = yes; then
> > >  
> > >    gl_WARN_ADD([-Werror])
> > > 
> > > +  gl_WARN_ADD([-Wno-error=old-style-definition])
> > 
> > Sorry, why do you need this?  We don't use old style definitions, do we?
> 
> I added this option to ignore the old-style-definition error. The alternative would
> be to declare main() with the arguments. I don't think there is any other place
> where main() has been declared without the arguments.

This option would allow use of all kinds of old style definitions
all over the code, we definitely don't need to go that route.


-- 
ldv


More information about the Strace-devel mailing list