Re: [PATCH] H8: Minor cleanup in newlib/libc/include/sys/config.h.

Jeff Johnston <[email protected]> Tue, 14 Jul 2026 19:57:46 -0400
Newsgroups gmane.comp.lib.newlib
Message-ID <CAOox84trMxx_+kG_iLLe-0qCoyJ4YaaBDnrX7VPwsCBHo4EKmg@mail.gmail.com>
--000000000000e254dc06569af9d2
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Jan,

Even though the H8300 flag isn't used within newlib, it is possible user
code could be referring to it since it is made available
via the header file.  If the first definition is wrong, that one can be
removed, but in the 2nd case, it appears to be correct.

-- Jeff J.

On Sun, Jul 12, 2026 at 10:19=E2=80=AFPM Jan Dubiec <[email protected]> wrote:

> This patch defines the _POINTER_INT, _READ_WRITE_RETURN_TYPE, and
> _READ_WRITE_BUFSIZE_TYPE macros explicitly for the H8 family, avoiding th=
e
> use of their default definitions. It also removes the unused H8300 macro.
>
> Signed-off-by: Jan Dubiec <[email protected]>
> ---
>  newlib/libc/include/sys/config.h | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/newlib/libc/include/sys/config.h
> b/newlib/libc/include/sys/config.h
> index c3cd51e86..7fbcb4992 100644
> --- a/newlib/libc/include/sys/config.h
> +++ b/newlib/libc/include/sys/config.h
> @@ -20,9 +20,6 @@
>  /* exceptions first */
>  #if defined(__H8500__) || defined(__W65__)
>  #define __SMALL_BITFIELDS
> -/* ???  This conditional is true for the h8500 and the w65, defining H83=
00
> -   in those cases probably isn't the right thing to do.  */
> -#define H8300 1
>  #endif
>
>  /* 16 bit integer machines */
> @@ -36,16 +33,18 @@
>
>  #if defined (__H8300__) || defined (__H8300H__) || defined(__H8300S__) |=
|
> defined (__H8300SX__)
>  #define __SMALL_BITFIELDS
> -#define H8300 1
>  #undef INT_MAX
>  #undef UINT_MAX
>  #define INT_MAX __INT_MAX__
>  #define UINT_MAX (__INT_MAX__ * 2U + 1)
> +#define _POINTER_INT __INTPTR_TYPE__
> +#define _READ_WRITE_RETURN_TYPE _ssize_t
> +#define _READ_WRITE_BUFSIZE_TYPE size_t
>  #endif
>
>  #if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
>  #ifndef __INT32__
> -#define __SMALL_BITFIELDS
> +#define __SMALL_BITFIELDS
>  #undef INT_MAX
>  #undef UINT_MAX
>  #define INT_MAX 32767
> --
> 2.54.0
>
>

--000000000000e254dc06569af9d2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:verdana,=
sans-serif">Hi Jan,</div><div class=3D"gmail_default" style=3D"font-family:=
verdana,sans-serif"><br></div><div class=3D"gmail_default" style=3D"font-fa=
mily:verdana,sans-serif">Even though the H8300 flag isn&#39;t used within n=
ewlib, it is possible user code could be referring to it since it is made a=
vailable</div><div class=3D"gmail_default" style=3D"font-family:verdana,san=
s-serif">via the header file.=C2=A0 If the first definition is wrong, that =
one can be removed, but in the 2nd case, it appears to be correct.</div><di=
v class=3D"gmail_default" style=3D"font-family:verdana,sans-serif"><br></di=
v><div class=3D"gmail_default" style=3D"font-family:verdana,sans-serif">-- =
Jeff J.</div></div><br><div class=3D"gmail_quote gmail_quote_container"><di=
v dir=3D"ltr" class=3D"gmail_attr">On Sun, Jul 12, 2026 at 10:19=E2=80=AFPM=
 Jan Dubiec &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex">This patch defines th=
e _POINTER_INT, _READ_WRITE_RETURN_TYPE, and<br>
_READ_WRITE_BUFSIZE_TYPE macros explicitly for the H8 family, avoiding the<=
br>
use of their default definitions. It also removes the unused H8300 macro.<b=
r>
<br>
Signed-off-by: Jan Dubiec &lt;<a href=3D"mailto:[email protected]" target=3D"_blank=
">[email protected]</a>&gt;<br>
---<br>
=C2=A0newlib/libc/include/sys/config.h | 9 ++++-----<br>
=C2=A01 file changed, 4 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/con=
fig.h<br>
index c3cd51e86..7fbcb4992 100644<br>
--- a/newlib/libc/include/sys/config.h<br>
+++ b/newlib/libc/include/sys/config.h<br>
@@ -20,9 +20,6 @@<br>
=C2=A0/* exceptions first */<br>
=C2=A0#if defined(__H8500__) || defined(__W65__)<br>
=C2=A0#define __SMALL_BITFIELDS<br>
-/* ???=C2=A0 This conditional is true for the h8500 and the w65, defining =
H8300<br>
-=C2=A0 =C2=A0in those cases probably isn&#39;t the right thing to do.=C2=
=A0 */<br>
-#define H8300 1<br>
=C2=A0#endif<br>
<br>
=C2=A0/* 16 bit integer machines */<br>
@@ -36,16 +33,18 @@<br>
<br>
=C2=A0#if defined (__H8300__) || defined (__H8300H__) || defined(__H8300S__=
) || defined (__H8300SX__)<br>
=C2=A0#define __SMALL_BITFIELDS<br>
-#define H8300 1<br>
=C2=A0#undef INT_MAX<br>
=C2=A0#undef UINT_MAX<br>
=C2=A0#define INT_MAX __INT_MAX__<br>
=C2=A0#define UINT_MAX (__INT_MAX__ * 2U + 1)<br>
+#define _POINTER_INT __INTPTR_TYPE__<br>
+#define _READ_WRITE_RETURN_TYPE _ssize_t<br>
+#define _READ_WRITE_BUFSIZE_TYPE size_t<br>
=C2=A0#endif<br>
<br>
=C2=A0#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))<b=
r>
=C2=A0#ifndef __INT32__<br>
-#define __SMALL_BITFIELDS=C2=A0 =C2=A0 =C2=A0 <br>
+#define __SMALL_BITFIELDS<br>
=C2=A0#undef INT_MAX<br>
=C2=A0#undef UINT_MAX<br>
=C2=A0#define INT_MAX 32767<br>
-- <br>
2.54.0<br>
<br>
</blockquote></div>

--000000000000e254dc06569af9d2--