public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: newlib@sourceware.org, 'Jeff Law' <jeffreyalaw@gmail.com>
Subject: Re: [PATCH] libgloss: Resolve compilation errors for mips.
Date: Thu, 4 Jan 2024 18:54:43 -0500	[thread overview]
Message-ID: <ZZdFQ6tIRBDPixNk@vapier> (raw)
In-Reply-To: <00ac01da3f16$2e292610$8a7b7230$@nextmovesoftware.com>

[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2024-01-04 23:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 13:59 Roger Sayle
2024-01-04 23:54 ` Mike Frysinger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZdFQ6tIRBDPixNk@vapier \
    --to=vapier@gentoo.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=newlib@sourceware.org \
    --cc=roger@nextmovesoftware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).