public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* [PATCH 1/2] m68k: define __div64_32() to avoid a warning
@ 2023-08-09 21:10 Arnd Bergmann
  2023-08-09 21:10 ` [PATCH 2/2] m68k: add memcmp() declarartion Arnd Bergmann
  2023-08-16 15:33 ` [PATCH 1/2] m68k: define __div64_32() to avoid a warning Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-08-09 21:10 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Arnd Bergmann, linux-m68k, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] m68k: add memcmp() declarartion
  2023-08-09 21:10 [PATCH 1/2] m68k: define __div64_32() to avoid a warning Arnd Bergmann
@ 2023-08-09 21:10 ` Arnd Bergmann
  2023-08-09 21:28   ` John Paul Adrian Glaubitz
  2023-08-16 15:42   ` Geert Uytterhoeven
  2023-08-16 15:33 ` [PATCH 1/2] m68k: define __div64_32() to avoid a warning Geert Uytterhoeven
  1 sibling, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-08-09 21:10 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Arnd Bergmann, linux-m68k, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] m68k: add memcmp() declarartion
  2023-08-09 21:10 ` [PATCH 2/2] m68k: add memcmp() declarartion Arnd Bergmann
@ 2023-08-09 21:28   ` John Paul Adrian Glaubitz
  2023-08-16 15:42   ` Geert Uytterhoeven
  1 sibling, 0 replies; 5+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-08-09 21:28 UTC (permalink / raw)
  To: Arnd Bergmann, Geert Uytterhoeven; +Cc: Arnd Bergmann, linux-m68k, linux-kernel

Hi Arnd!

On Wed, 2023-08-09 at 23:10 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] m68k: define __div64_32() to avoid a warning
  2023-08-09 21:10 [PATCH 1/2] m68k: define __div64_32() to avoid a warning Arnd Bergmann
  2023-08-09 21:10 ` [PATCH 2/2] m68k: add memcmp() declarartion Arnd Bergmann
@ 2023-08-16 15:33 ` Geert Uytterhoeven
  1 sibling, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2023-08-16 15:33 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Arnd Bergmann, linux-m68k, linux-kernel

On Wed, Aug 9, 2023 at 11:11 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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 <arnd@arndb.de>

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 <geert@linux-m68k.org>
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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] m68k: add memcmp() declarartion
  2023-08-09 21:10 ` [PATCH 2/2] m68k: add memcmp() declarartion Arnd Bergmann
  2023-08-09 21:28   ` John Paul Adrian Glaubitz
@ 2023-08-16 15:42   ` Geert Uytterhoeven
  1 sibling, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2023-08-16 15:42 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Arnd Bergmann, linux-m68k, linux-kernel

Hi Arnd,

On Wed, Aug 9, 2023 at 11:11 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.

I believe it does with -ffreestanding?
So if you don't mind, I'd like to apply this with that sentence removed.

x86 also still has that define in string_32.h.
Andi dropped it for amd64 in commit 6edfba1b33c70110
("[PATCH] x86_64: Don't define string functions to builtin")
in v2.6.17.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k for-v6.6 branch, with the obvious typo fixed.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-16 15:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-09 21:10 [PATCH 1/2] m68k: define __div64_32() to avoid a warning Arnd Bergmann
2023-08-09 21:10 ` [PATCH 2/2] m68k: add memcmp() declarartion Arnd Bergmann
2023-08-09 21:28   ` John Paul Adrian Glaubitz
2023-08-16 15:42   ` Geert Uytterhoeven
2023-08-16 15:33 ` [PATCH 1/2] m68k: define __div64_32() to avoid a warning Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox