[PATCH] Removes build time warning for all the bsps using libtests/dl10 test

Richi Dubey richidubey at gmail.com
Mon Apr 27 12:18:46 UTC 2020


Dear Dr. Bloom,

Thanks for the suggestion.

dl_call() is being used in the following places:

./dl07/dl-load.c:105:static int dl_call (void* handle, const char* func)
./dl07/dl-load.c:152:  if (dl_call (o1, "rtems_main_o1"))
./dl07/dl-load.c:154:  if (dl_call (o2, "rtems_main_o2"))
./dl07/dl-load.c:156:  if (dl_call (o3, "rtems_main_o3"))
./dl07/dl-load.c:158:  if (dl_call (o4, "rtems_main_o4"))
./dl07/dl-load.c:160:  if (dl_call (o5, "rtems_main_o5"))
./dl09/dl-load.c:134:static int dl_call (void* handle, const char* func)
./dl09/dl-load.c:196:  if (dl_call (o[0].handle, "rtems_main_o1"))

and dl_close() in the following:

./dl07/dl-load.c:95:static void dl_close (void* handle, const char* msg)
./dl07/dl-load.c:175:  dl_close (o3, "o3");
./dl07/dl-load.c:177:  dl_close (o4, "o4");
./dl07/dl-load.c:179:  dl_close (o5, "o5");
./dl07/dl-load.c:181:  dl_close (o2, "o2");
./dl07/dl-load.c:182:  dl_close (o1, "o1");
./dl09/dl-load.c:124:static void dl_close (void* handle)
./dl09/dl-load.c:163:  dl_close (o->handle);

And I checked that these definitions present in dl07/dl-load.c are
completely similar to the one in dl10 which we are deleting to remove
the warnings. So, It's safe to delete them since they are already
being tested in another test, right? If yes, I would send in the
patch.

Thanks,
Richi.



On Fri, Apr 24, 2020 at 7:46 PM Gedare Bloom <gedare at rtems.org> wrote:
>
> Whenever you fix a warning something is unused by deleting that
> something, you should first make sure that something isn't supposed to
> be used. Because that might also be the problem. Check if these 2
> functions maybe should be tested, or does dlsym/dlclose get tested
> elsewhere?
>
> On Fri, Apr 24, 2020 at 7:33 AM Richi Dubey <richidubey at gmail.com> wrote:
> >
> > Hey,
> >
> > Can someone please check if this patch is correct? The warnings were:
> >
> > log/sparc-leon3.log:../../../../../../rtems/c/src/../../testsuites/libtests/dl10/dl-load.c:109:12:
> > warning: 'dl_call' defined but not used [-Wunused-function]
> >
> > log/sparc-leon3.log:../../../../../../rtems/c/src/../../testsuites/libtests/dl10/dl-load.c:99:13:
> > warning: 'dl_close' defined but not used [-Wunused-function]
> >
> > I looked around and it seemed fine to delete these functions because
> > they weren't being called. Is it fine to remove them? I rebuilt the
> > leon3 bsp successfully with the new changes with no errors.
> >
> > ----------------------------------------------------------------------------------------------------------
> >
> > From ce902f7107eab8485e8f7ba7b7ac8c37013d7a30 Mon Sep 17 00:00:00 2001
> > From: Richi Dubey <richidubey at gmail.com>
> > Date: Fri, 24 Apr 2020 18:42:16 +0530
> > Subject: [PATCH 2/2] Removed dl_call and dl_close
> >
> > ---
> >  testsuites/libtests/dl10/dl-load.c | 21 +--------------------
> >  1 file changed, 1 insertion(+), 20 deletions(-)
> >
> > diff --git a/testsuites/libtests/dl10/dl-load.c
> > b/testsuites/libtests/dl10/dl-load.c
> > index dee1d6e9cc..d3fed3d69f 100644
> > --- a/testsuites/libtests/dl10/dl-load.c
> > +++ b/testsuites/libtests/dl10/dl-load.c
> > @@ -96,27 +96,8 @@ static void* dl_load_obj(const char* name, bool
> > has_unresolved)
> >    return handle;
> >  }
> >
> > -static void dl_close (void* handle)
> > -{
> > -  int r;
> > -  printf ("handle: %p closing\n", handle);
> > -  r = dlclose (handle);
> > -  if (r != 0)
> > -    printf("dlclose failed: %s\n", dlerror());
> > -  rtems_test_assert (r == 0);
> > -}
> >
> > -static int dl_call (void* handle, const char* func)
> > -{
> > -  call_sig call = dlsym (handle, func);
> > -  if (call == NULL)
> > -  {
> > -    printf("dlsym failed: symbol not found: %s\n", func);
> > -    return 1;
> > -  }
> > -  call ();
> > -  return 0;
> > -}
> > +
> >
> >  int dl_load_test(void)
> >  {
> > --
> > 2.17.1
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list