NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/58696: [PATCH] ssize_t undefined in build of toolchain gcc



>Number:         58696
>Category:       toolchain
>Synopsis:       [PATCH] ssize_t undefined in build of toolchain gcc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 25 15:15:01 +0000 2024
>Originator:     gorg%gorgnet.net@localhost
>Release:        NetBSD current
>Organization:
>Environment:
System: NetBSD 10.0 NetBSD 10.0 (GENERIC64) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:
POSIX specifies that ssize_t must be defined in sys/types.h:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html

NetBSD includes sys/types.h in sys/param.h. However, when building the
toolchain on systems which do not define ssize_t in sys/param.h directly or
indirectly, regsub.cc in gcc fails to compile because it uses ssize_t while
only including sys/param.h:

regsub.cc:101:8: error: 'ssize_t' does not name a type; did you mean 'size_t'?
  101 | static ssize_t
      |        ^~~~~~~
      |        size_t

>How-To-Repeat:
Attempt to build the toolchain on a system in which ssize_t is not usable
through including sys/param.h, such as Linux with musl libc.

>Fix:
Index: external/gpl3/gcc/dist/gcc/regsub.cc
===================================================================
RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/regsub.cc,v
retrieving revision 1.1
diff -u -r1.1 regsub.cc
--- external/gpl3/gcc/dist/gcc/regsub.cc	1 Aug 2023 06:04:42 -0000	1.1
+++ external/gpl3/gcc/dist/gcc/regsub.cc	25 Sep 2024 14:25:23 -0000
@@ -32,6 +32,7 @@
 extern "C" {
 
 #include <sys/param.h>
+#include <sys/types.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>



Home | Main Index | Thread Index | Old Index