diff mbox series

[testsuite,analyzer] include sys/select.h if available

Message ID oredb6dlzp.fsf@lxoliva.fsfla.org
State New
Headers show
Series [testsuite,analyzer] include sys/select.h if available | expand

Commit Message

Alexandre Oliva April 16, 2024, 3:28 a.m. UTC
Test that calls select fails on vxworks because select is only
declared in sys/select.h.  Include that header if it's present.

Regstrapped on x86_64-linux-gnu.  Also tested with gcc-13 on arm-,
aarch64-, x86- and x86_64-vxworks7r2.  Ok to install?


for  gcc/testsuite/ChangeLog

	* gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c:
	Include sys/select.h if present.
---
 .../fd-glibc-byte-stream-connection-server.c       |    3 +++
 1 file changed, 3 insertions(+)

Comments

Richard Biener April 16, 2024, 7:12 a.m. UTC | #1
On Tue, Apr 16, 2024 at 5:29 AM Alexandre Oliva <oliva@adacore.com> wrote:
>
>
> Test that calls select fails on vxworks because select is only
> declared in sys/select.h.  Include that header if it's present.
>
> Regstrapped on x86_64-linux-gnu.  Also tested with gcc-13 on arm-,
> aarch64-, x86- and x86_64-vxworks7r2.  Ok to install?

OK

>
> for  gcc/testsuite/ChangeLog
>
>         * gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c:
>         Include sys/select.h if present.
> ---
>  .../fd-glibc-byte-stream-connection-server.c       |    3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c b/gcc/testsuite/gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c
> index fcbcc740170e6..f922a52238f90 100644
> --- a/gcc/testsuite/gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c
> +++ b/gcc/testsuite/gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c
> @@ -8,6 +8,9 @@
>  #include <stdlib.h>
>  #include <unistd.h>
>  #include <sys/types.h>
> +#if __has_include(<sys/select.h>)
> +#include <sys/select.h>
> +#endif
>  #include <sys/socket.h>
>  #include <netinet/in.h>
>  #include <arpa/inet.h>
>
> --
> Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
>    Free Software Activist                   GNU Toolchain Engineer
> More tolerance and less prejudice are key for inclusion and diversity
> Excluding neuro-others for not behaving ""normal"" is *not* inclusive
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c b/gcc/testsuite/gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c
index fcbcc740170e6..f922a52238f90 100644
--- a/gcc/testsuite/gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c
@@ -8,6 +8,9 @@ 
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/types.h>
+#if __has_include(<sys/select.h>)
+#include <sys/select.h>
+#endif
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>