libs/libc: fix compile warning about modlib_depend when CONFIG_MODLIB_MAXDEPEND = 0

modlib/modlib_symbols.c: In function ‘modlib_symcallback’:
modlib/modlib_symbols.c:215:13: warning: implicit declaration of function ‘modlib_depend’; did you mean ‘modlib_read’? [-Wimplicit-function-declaration]
  215 |       ret = modlib_depend(exportinfo->modp, modp);
      |             ^~~~~~~~~~~~~
      |             modlib_read

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1
2023-10-05 19:42:23 +08:00
committed by Xiang Xiao
parent e88a36fa92
commit db13ff2dd5
3 changed files with 9 additions and 9 deletions
+4 -7
View File
@@ -31,6 +31,8 @@
#include <nuttx/lib/modlib.h> #include <nuttx/lib/modlib.h>
#if CONFIG_MODLIB_MAXDEPEND > 0
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -55,7 +57,6 @@
int modlib_depend(FAR struct module_s *importer, int modlib_depend(FAR struct module_s *importer,
FAR struct module_s *exporter) FAR struct module_s *exporter)
{ {
#if CONFIG_MODLIB_MAXDEPEND > 0
int freendx = -1; int freendx = -1;
int i; int i;
@@ -127,10 +128,6 @@ int modlib_depend(FAR struct module_s *importer,
DEBUGPANIC(); DEBUGPANIC();
return -ENFILE; return -ENFILE;
#else
return OK;
#endif
} }
/**************************************************************************** /****************************************************************************
@@ -152,7 +149,6 @@ int modlib_depend(FAR struct module_s *importer,
int modlib_undepend(FAR struct module_s *importer) int modlib_undepend(FAR struct module_s *importer)
{ {
#if CONFIG_MODLIB_MAXDEPEND > 0
FAR struct module_s *exporter; FAR struct module_s *exporter;
int i; int i;
@@ -178,7 +174,8 @@ int modlib_undepend(FAR struct module_s *importer)
importer->dependencies[i] = NULL; importer->dependencies[i] = NULL;
} }
} }
#endif
return OK; return OK;
} }
#endif
+3 -2
View File
@@ -198,7 +198,6 @@ static int modlib_symcallback(FAR struct module_s *modp, FAR void *arg)
{ {
FAR struct mod_exportinfo_s *exportinfo = (FAR struct mod_exportinfo_s *) FAR struct mod_exportinfo_s *exportinfo = (FAR struct mod_exportinfo_s *)
arg; arg;
int ret;
/* Check if this module exports a symbol of that name */ /* Check if this module exports a symbol of that name */
@@ -212,12 +211,14 @@ static int modlib_symcallback(FAR struct module_s *modp, FAR void *arg)
* stop the traversal. * stop the traversal.
*/ */
ret = modlib_depend(exportinfo->modp, modp); #if CONFIG_MODLIB_MAXDEPEND > 0
int ret = modlib_depend(exportinfo->modp, modp);
if (ret < 0) if (ret < 0)
{ {
berr("ERROR: modlib_depend failed: %d\n", ret); berr("ERROR: modlib_depend failed: %d\n", ret);
return ret; return ret;
} }
#endif
return SYM_FOUND; return SYM_FOUND;
} }
+2
View File
@@ -282,7 +282,9 @@ FAR void *insmod(FAR const char *filename, FAR const char *modname)
errout_with_load: errout_with_load:
modlib_unload(&loadinfo); modlib_unload(&loadinfo);
#if CONFIG_MODLIB_MAXDEPEND > 0
modlib_undepend(modp); modlib_undepend(modp);
#endif
errout_with_registry_entry: errout_with_registry_entry:
kmm_free(modp); kmm_free(modp);
errout_with_loadinfo: errout_with_loadinfo: