[PATCH] libgloss: Resolve compilation errors for mips.
Mike Frysinger
vapier@gentoo.org
Thu Jan 4 23:54:43 GMT 2024
On 04 Jan 2024 13:59, Roger Sayle wrote:
> --- a/libgloss/kill.c
> +++ b/libgloss/kill.c
>
> +extern void _exit (int);
missing noreturn markings. can this file include stdlib.h instead ?
> --- a/libgloss/mips/cfe_mem.c
> +++ b/libgloss/mips/cfe_mem.c
>
> - memtop = __libcfe_mem_limit ();
> + memtop = (unsigned long)__libcfe_mem_limit ();
if memtop is supposed to be a pointer, then it should be a pointer, not an
integer.
ignoring that, never use long or int to cast pointers. this is what
uintptr_t is designed for.
> --- a/libgloss/mips/syscalls.c
> +++ b/libgloss/mips/syscalls.c
>
> extern char _end[];
> +extern void *get_mem_info (void*);
seems like mips should have a header for its prototypes rather than duplicating
it across multiple files, and so it makes sure it's defined correctly both in
the callers & definitions. seems like get_mem_info takes a struct pointer, not
a void.
> - if (((size_t)heap_ptr >= heap_start) && ((size_t)heap_ptr < (heap_start + mem.size))) {
> - avail = (heap_start + mem.size) - (size_t)heap_ptr;
> + if ((heap_ptr >= heap_start) && (heap_ptr < (heap_start + mem.size))) {
> + avail = (unsigned int)((heap_start + mem.size) - heap_ptr);
use ptrdiff_t to hold the difference between pointers, don't cast like this.
> --- a/libgloss/print.c
> +++ b/libgloss/print.c
>
> #include "glue.h"
>
> +extern int outbyte (char x);
outbyte is already defined in glue.h which is included here
> --- a/libgloss/putnum.c
> +++ b/libgloss/putnum.c
> @@ -14,7 +14,7 @@
> */
> #include "glue.h"
>
> -extern void print (char *ptr);
> +extern void print (const char *ptr);
this prob should be moved to glue.h instead
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20240104/5a967cf8/attachment.sig>
More information about the Newlib
mailing list