diff mbox series

mtd: fix compile warnings

Message ID CABg9-KKApmiMXLtJ=BMAxSe7mb8JjPe_HnB6ZR30z9TmqKZe+g@mail.gmail.com
State New
Headers show
Series mtd: fix compile warnings | expand

Commit Message

Adam June 7, 2024, 2:45 a.m. UTC
From: Adam-0320 <adam0320a@gmail.com>

ubi-mdeia.h defines 'struct ubi_vid_hdr'. It is used as a parameter type
of function 'ubigen_init_ec_hdr', which is declared in libubigen.h.
ubiformat.c and liubigen.c use this function. And they both have
included ubi-mdeia.h and libubigen.h. However, mtdinfo.c includes
libubigen.h but not ubi-mdeia.h. This also happens to 'ubi_ec_hdr'.
These issues lead to warnings:

In file included from ubi-utils/mtdinfo.c:34:
./include/libubigen.h:124:32: warning: 'struct ubi_ec_hdr' declared
inside parameter list will not be visible outside of this definition
or declaration
  124 |                         struct ubi_ec_hdr *hdr, long long ec);
      |                                ^~~~~~~~~~
./include/libubigen.h:140:33: warning: 'struct ubi_vid_hdr' declared
inside parameter list will not be visible outside of this definition
or declaration
  140 |                          struct ubi_vid_hdr *hdr, int lnum,
      |                                 ^~~~~~~~~~~

So include ubi-media.h in libubigen.h.

Signed-off-by: Adam-0320 <adam0320a@gmail.com>
---
 .../patches/140-mtd-fix-compile-warnings.patch       | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644
package/utils/mtd-utils/patches/140-mtd-fix-compile-warnings.patch

Comments

Rosen Penev June 8, 2024, 1:25 a.m. UTC | #1
On Thu, Jun 6, 2024 at 7:48 PM Adam <adam0320a@gmail.com> wrote:
>
> From: Adam-0320 <adam0320a@gmail.com>
>
> ubi-mdeia.h defines 'struct ubi_vid_hdr'. It is used as a parameter type
> of function 'ubigen_init_ec_hdr', which is declared in libubigen.h.
> ubiformat.c and liubigen.c use this function. And they both have
> included ubi-mdeia.h and libubigen.h. However, mtdinfo.c includes
> libubigen.h but not ubi-mdeia.h. This also happens to 'ubi_ec_hdr'.
> These issues lead to warnings:
>
> In file included from ubi-utils/mtdinfo.c:34:
> ./include/libubigen.h:124:32: warning: 'struct ubi_ec_hdr' declared
> inside parameter list will not be visible outside of this definition
> or declaration
>   124 |                         struct ubi_ec_hdr *hdr, long long ec);
>       |                                ^~~~~~~~~~
> ./include/libubigen.h:140:33: warning: 'struct ubi_vid_hdr' declared
> inside parameter list will not be visible outside of this definition
> or declaration
>   140 |                          struct ubi_vid_hdr *hdr, int lnum,
>       |                                 ^~~~~~~~~~~
>
> So include ubi-media.h in libubigen.h.
>
> Signed-off-by: Adam-0320 <adam0320a@gmail.com>
Send this in the packages feed instead
> ---
>  .../patches/140-mtd-fix-compile-warnings.patch       | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>  create mode 100644
> package/utils/mtd-utils/patches/140-mtd-fix-compile-warnings.patch
>
> diff --git a/package/utils/mtd-utils/patches/140-mtd-fix-compile-warnings.patch
> b/package/utils/mtd-utils/patches/140-mtd-fix-compile-warnings.patch
> new file mode 100644
> index 0000000..bb07c55
> --- /dev/null
> +++ b/package/utils/mtd-utils/patches/140-mtd-fix-compile-warnings.patch
> @@ -0,0 +1,12 @@
> +diff --git a/include/libubigen.h b/include/libubigen.h
> +index 48d2fad..0c20979 100644
> +--- a/include/libubigen.h
> ++++ b/include/libubigen.h
> +@@ -26,6 +26,7 @@
> + #define __LIBUBIGEN_H__
> +
> + #include <stdint.h>
> ++#include "ubi-media.h"
> +
> + #ifdef __cplusplus
> + extern "C" {
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/package/utils/mtd-utils/patches/140-mtd-fix-compile-warnings.patch
b/package/utils/mtd-utils/patches/140-mtd-fix-compile-warnings.patch
new file mode 100644
index 0000000..bb07c55
--- /dev/null
+++ b/package/utils/mtd-utils/patches/140-mtd-fix-compile-warnings.patch
@@ -0,0 +1,12 @@ 
+diff --git a/include/libubigen.h b/include/libubigen.h
+index 48d2fad..0c20979 100644
+--- a/include/libubigen.h
++++ b/include/libubigen.h
+@@ -26,6 +26,7 @@
+ #define __LIBUBIGEN_H__
+
+ #include <stdint.h>
++#include "ubi-media.h"
+
+ #ifdef __cplusplus
+ extern "C" {