diff mbox series

ada: Fix Ada bootstrap on macOS

Message ID yddfs0mt0oc.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series ada: Fix Ada bootstrap on macOS | expand

Commit Message

Rainer Orth Dec. 1, 2023, 3:14 p.m. UTC
The recent warning changes broke Ada bootstrap on macOS:

adaint.c: In function '__gnat_copy_attribs':
adaint.c:3336:10: error: implicit declaration of function 'utimes'; did you mean 'utime'? [-Wimplicit-function-declaration]
 3336 |      if (utimes (to, tbuf) == -1) {
      |          ^~~~~~
      |          utime
adaint.c: In function '__gnat_kill':
adaint.c:3597:3: error: implicit declaration of function 'kill' [-Wimplicit-function-declaration]
 3597 |   kill (pid, sig);
      |   ^~~~
terminals.c: In function 'allocate_pty_desc':
terminals.c:1196:12: error: implicit declaration of function 'openpty'; did you mean 'openat'? [-Wimplicit-function-declaration]
 1196 |   status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
      |            ^~~~~~~
      |            openat
terminals.c: In function '__gnat_setup_winsize':
terminals.c:1392:6: error: implicit declaration of function 'kill' [-Wimplicit-function-declaration]
 1392 |      kill (desc->child_pid, SIGWINCH);
      |      ^~~~

This patch fixes this by including the necessary headers: <sys/time.h>
for utimes, <signal.h> for kill, and <util.h> for openpty.  With those
changes, the build completed on x86_64-apple-darwin2[0-3] (make check
still running).

Ok for trunk?

	Rainer

Comments

Iain Sandoe Dec. 1, 2023, 3:32 p.m. UTC | #1
> On 1 Dec 2023, at 15:14, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:
> 
> The recent warning changes broke Ada bootstrap on macOS:
> 
> adaint.c: In function '__gnat_copy_attribs':
> adaint.c:3336:10: error: implicit declaration of function 'utimes'; did you mean 'utime'? [-Wimplicit-function-declaration]
> 3336 |      if (utimes (to, tbuf) == -1) {
>      |          ^~~~~~
>      |          utime
> adaint.c: In function '__gnat_kill':
> adaint.c:3597:3: error: implicit declaration of function 'kill' [-Wimplicit-function-declaration]
> 3597 |   kill (pid, sig);
>      |   ^~~~
> terminals.c: In function 'allocate_pty_desc':
> terminals.c:1196:12: error: implicit declaration of function 'openpty'; did you mean 'openat'? [-Wimplicit-function-declaration]
> 1196 |   status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
>      |            ^~~~~~~
>      |            openat
> terminals.c: In function '__gnat_setup_winsize':
> terminals.c:1392:6: error: implicit declaration of function 'kill' [-Wimplicit-function-declaration]
> 1392 |      kill (desc->child_pid, SIGWINCH);
>      |      ^~~~
> 
> This patch fixes this by including the necessary headers: <sys/time.h>
> for utimes, <signal.h> for kill, and <util.h> for openpty.  With those
> changes, the build completed on x86_64-apple-darwin2[0-3] (make check
> still running).
> 
> Ok for trunk?

OK from the Darwin side.
Iain

> 
> 	Rainer
> 
> -- 
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
> 
> 
> 2023-12-01  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	gcc/ada:
> 	* adaint.c [__APPLE__]: Include <signal.h>, <sys/time.h>.
> 	* terminals.c [!_WIN32]: Include <signal.h>.
> 	[__APPLE__]: Include <util.h>.
> 	Fix typos.
> 
> diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
> --- a/gcc/ada/adaint.c
> +++ b/gcc/ada/adaint.c
> @@ -85,6 +85,8 @@
> 
> #if defined (__APPLE__)
> #include <unistd.h>
> +#include <signal.h>
> +#include <sys/time.h>
> #include <TargetConditionals.h>
> #endif
> 
> diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
> --- a/gcc/ada/terminals.c
> +++ b/gcc/ada/terminals.c
> @@ -31,7 +31,7 @@
> 
> #define ATTRIBUTE_UNUSED __attribute__((unused))
> 
> -/* First all usupported platforms. Add stubs for exported routines. */
> +/* First all unsupported platforms. Add stubs for exported routines. */
> 
> #if defined (VMS) || defined (__vxworks) || defined (__Lynx__) \
>   || defined (__ANDROID__) || defined (__PikeOS__) || defined(__DJGPP__)
> @@ -1089,7 +1089,7 @@ void
> {
> }
> 
> -#else /* defined(_WIN32, implementatin for all UNIXes */
> +#else /* defined(_WIN32, implementation for all UNIXes */
> 
> /* First defined some macro to identify easily some systems */
> #if defined (__FreeBSD__) \
> @@ -1104,6 +1104,7 @@ void
> #include <errno.h>
> #include <stdio.h>
> #include <stdlib.h>
> +#include <signal.h>
> #include <sys/ioctl.h>
> #include <termios.h>
> #include <fcntl.h>
> @@ -1121,6 +1122,9 @@ void
> #if defined (__hpux__)
> #   include <sys/stropts.h>
> #endif
> +#if defined (__APPLE__)
> +#   include <util.h>
> +#endif
> 
> #define CDISABLE _POSIX_VDISABLE
>
Marc Poulhiès Dec. 1, 2023, 3:41 p.m. UTC | #2
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> The recent warning changes broke Ada bootstrap on macOS:
>
> adaint.c: In function '__gnat_copy_attribs':
> adaint.c:3336:10: error: implicit declaration of function 'utimes'; did you mean 'utime'? [-Wimplicit-function-declaration]
>  3336 |      if (utimes (to, tbuf) == -1) {
>       |          ^~~~~~
>       |          utime
> adaint.c: In function '__gnat_kill':
> adaint.c:3597:3: error: implicit declaration of function 'kill' [-Wimplicit-function-declaration]
>  3597 |   kill (pid, sig);
>       |   ^~~~
> terminals.c: In function 'allocate_pty_desc':
> terminals.c:1196:12: error: implicit declaration of function 'openpty'; did you mean 'openat'? [-Wimplicit-function-declaration]
>  1196 |   status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
>       |            ^~~~~~~
>       |            openat
> terminals.c: In function '__gnat_setup_winsize':
> terminals.c:1392:6: error: implicit declaration of function 'kill' [-Wimplicit-function-declaration]
>  1392 |      kill (desc->child_pid, SIGWINCH);
>       |      ^~~~
>
> This patch fixes this by including the necessary headers: <sys/time.h>
> for utimes, <signal.h> for kill, and <util.h> for openpty.  With those
> changes, the build completed on x86_64-apple-darwin2[0-3] (make check
> still running).
>
> Ok for trunk?

Ok!

Thanks,
Marc
diff mbox series

Patch

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -85,6 +85,8 @@ 
 
 #if defined (__APPLE__)
 #include <unistd.h>
+#include <signal.h>
+#include <sys/time.h>
 #include <TargetConditionals.h>
 #endif
 
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -31,7 +31,7 @@ 
 
 #define ATTRIBUTE_UNUSED __attribute__((unused))
 
-/* First all usupported platforms. Add stubs for exported routines. */
+/* First all unsupported platforms. Add stubs for exported routines. */
 
 #if defined (VMS) || defined (__vxworks) || defined (__Lynx__) \
   || defined (__ANDROID__) || defined (__PikeOS__) || defined(__DJGPP__)
@@ -1089,7 +1089,7 @@  void
 {
 }
 
-#else /* defined(_WIN32, implementatin for all UNIXes */
+#else /* defined(_WIN32, implementation for all UNIXes */
 
 /* First defined some macro to identify easily some systems */
 #if defined (__FreeBSD__) \
@@ -1104,6 +1104,7 @@  void
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <signal.h>
 #include <sys/ioctl.h>
 #include <termios.h>
 #include <fcntl.h>
@@ -1121,6 +1122,9 @@  void
 #if defined (__hpux__)
 #   include <sys/stropts.h>
 #endif
+#if defined (__APPLE__)
+#   include <util.h>
+#endif
 
 #define CDISABLE _POSIX_VDISABLE