Skip to contentSkip to conversation

m68k: define __div64_32() to avoid a warning

PATCH In review Arnd Bergmann 3 participants 5 messages Aug 9, 2023 – Aug 16, 2023 m68k architecture

lore
Share & tools
lore
#0 lore raw

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]

---
 arch/m68k/include/asm/div64.h | 3 +++
 1 file changed, 3 insertions(+)
arch/m68k/include/asm/div64.h +3 -0
index 365f39f5e256f..df1f6b450cc51 100644
@@ -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 */
Signature · 1 line
2.39.2
#1 lore raw

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.

---
 arch/m68k/include/asm/string.h | 1 +
 1 file changed, 1 insertion(+)
arch/m68k/include/asm/string.h +1 -0
index f0f5021d6327d..760cc13acdf41 100644
@@ -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
Signature · 1 line
2.39.2
#2 lore raw

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

Hi Arnd!

Quoted 5 lines · Arnd Bergmann

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:

Quoted 7 lines

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.

Can you fix the typo in the subject?

s/declarartion/declaration/

Thanks,
Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
maintainer Reviewed-by on v1 2/2
#3 lore raw

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

In reply to Arnd Bergmann

Hi Arnd,

Quoted 10 lines · Arnd Bergmann

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.

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.

Quoted 1 line

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 -- [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

maintainer Reviewed-by on v1 1/2
#4 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

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]

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

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