2023-08-09 22:06:28

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 1/2] m68k: define __div64_32() to avoid a warning

From: Arnd Bergmann <[email protected]>

The generic __div64_32() definition is built on all architectures that don't
provide this as a macro. m68k however neither defines nor requires __div64_32,
so it should define an empty one to avoid the warning:

lib/math/div64.c:31:32: error: no previous prototype for '__div64_32' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/m68k/include/asm/div64.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/m68k/include/asm/div64.h b/arch/m68k/include/asm/div64.h
index 365f39f5e256f..df1f6b450cc51 100644
--- a/arch/m68k/include/asm/div64.h
+++ b/arch/m68k/include/asm/div64.h
@@ -31,6 +31,9 @@
__rem; \
})

+/* defining this stops the unused helper function from being built */
+#define __div64_32 __div64_32
+
#endif /* CONFIG_CPU_HAS_NO_MULDIV64 */

#endif /* _M68K_DIV64_H */
--
2.39.2



2023-08-09 22:09:00

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 2/2] m68k: add memcmp() declarartion

From: Arnd Bergmann <[email protected]>

There is a global definition of memcmp() that gets built on m68k but is never
used and causes a warning because of the missing prototype:

lib/string.c:671:15: error: no previous prototype for 'memcmp' [-Werror=missing-prototypes]

Add the corresponding declaration to avoid the warning. As far as I understand
the #define to redirect memcmp() to __builtin_memcmp() does not actually do anything
here since this is what it does anyway.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/m68k/include/asm/string.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
index f0f5021d6327d..760cc13acdf41 100644
--- a/arch/m68k/include/asm/string.h
+++ b/arch/m68k/include/asm/string.h
@@ -41,6 +41,7 @@ static inline char *strncpy(char *dest, const char *src, size_t n)
#define __HAVE_ARCH_MEMMOVE
extern void *memmove(void *, const void *, __kernel_size_t);

+extern int memcmp(const void *, const void *, __kernel_size_t);
#define memcmp(d, s, n) __builtin_memcmp(d, s, n)

#define __HAVE_ARCH_MEMSET
--
2.39.2


Subject: Re: [PATCH 2/2] m68k: add memcmp() declarartion

Hi Arnd!

On Wed, 2023-08-09 at 23:10 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
>
> There is a global definition of memcmp() that gets built on m68k but is never
> used and causes a warning because of the missing prototype:
>
> lib/string.c:671:15: error: no previous prototype for 'memcmp' [-Werror=missing-prototypes]
>
> Add the corresponding declaration to avoid the warning. As far as I understand
> the #define to redirect memcmp() to __builtin_memcmp() does not actually do anything
> here since this is what it does anyway.
>
> Signed-off-by: Arnd Bergmann <[email protected]>

Can you fix the typo in the subject?

s/declarartion/declaration/

Thanks,
Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

2023-08-18 15:20:14

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 1/2] m68k: define __div64_32() to avoid a warning

On Wed, Aug 9, 2023 at 11:11 PM Arnd Bergmann <[email protected]> wrote:
> From: Arnd Bergmann <[email protected]>
>
> The generic __div64_32() definition is built on all architectures that don't
> provide this as a macro. m68k however neither defines nor requires __div64_32,
> so it should define an empty one to avoid the warning:
>
> lib/math/div64.c:31:32: error: no previous prototype for '__div64_32' [-Werror=missing-prototypes]
>
> Signed-off-by: Arnd Bergmann <[email protected]>

Nice! 142 bytes saved (which do not show up with bloat-o-meter,
as it does not count weak symbols; patch sent).

Reviewed-by: Geert Uytterhoeven <[email protected]>
i.e. will queue in the m68k for-v6.6 branch.

Gr{oetje,eeting}s,

Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds