[ada] fix unknown type name 'cpu_set_t'

Message ID Y/zI+Vt0kL68AFHm@guest.guest
State Accepted
Headers
Series [ada] fix unknown type name 'cpu_set_t' |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

宋冬生 Feb. 27, 2023, 3:15 p.m. UTC
  Hi,

When building ada with musl, I encountered the following error:

----------------
make[7]: Entering directory '/opt/gcc-build/gcc/build/gcc/ada/rts'
/opt/gcc-build/gcc/build/./gcc/xgcc -B/opt/gcc-build/gcc/build/./gcc/ -B/opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/bin/ -B/opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/lib/ -isystem /opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/include -isystem /opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/sys-include --sysroot=/opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/sys-root   -c -DCROSS_DIRECTORY_STRUCTURE -DIN_GCC  -W -Wall -g -O2 -g -O2 -fexceptions -DIN_RTS -DHAVE_GETIPINFO   -fPIC -fno-lto   \
  -iquote . -iquote .. -iquote ../.. -iquote /opt/gcc-build/gcc/gcc/ada -iquote /opt/gcc-build/gcc/gcc -I/opt/gcc-build/gcc/include  -I./../.. adadecode.c -o adadecode.o
In file included from adadecode.c:37:
adaint.h:324:8: error: unknown type name 'cpu_set_t'
  324 | extern cpu_set_t *__gnat_cpu_alloc                 (size_t);
      |        ^~~~~~~~~
----------------

It can be seen from the man pages[1] that this error is caused by not defining `_GNU_SOURCE`, so I recommend the following fix:




[1] https://man7.org/linux/man-pages/man3/CPU_SET.3.html

Please help commit if appropriate.
  

Comments

Andreas Schwab Feb. 27, 2023, 3:45 p.m. UTC | #1
On Feb 27 2023, 宋冬生 via Gcc-patches wrote:

> diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
> index 987432c93..fa8ddaf13 100644
> --- a/gcc/ada/adaint.h
> +++ b/gcc/ada/adaint.h
> @@ -319,6 +319,9 @@ extern void   *__gnat_lwp_self			   (void);
>  
>  /* Routines for interface to required CPU set primitives */
>  
> +#ifndef _GNU_SOURCE
> +#define _GNU_SOURCE
> +#endif
>  #include <sched.h>
>  
>  extern cpu_set_t *__gnat_cpu_alloc                 (size_t);

Feature test macros must always be defined before any system header is
included.
  

Patch

diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 987432c93..fa8ddaf13 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -319,6 +319,9 @@  extern void   *__gnat_lwp_self			   (void);
 
 /* Routines for interface to required CPU set primitives */
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
 #include <sched.h>
 
 extern cpu_set_t *__gnat_cpu_alloc                 (size_t);