c++tools: Fix compilation of server.cc on hpux

Message ID Y7nEKiHZJhHBwJMf@mx3210.localdomain
State Accepted
Headers
Series c++tools: Fix compilation of server.cc on hpux |

Checks

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

Commit Message

John David Anglin Jan. 7, 2023, 7:12 p.m. UTC
  Tested on trunk and gcc-12 with hppa64-hp-hpux11.11.

Okay?

Dave
---

Fix compilation of server.cc on hpux.

Select and FD_ISSET are declared in sys/time.h on most versions
of hpux.  As a result, HAVE_PSELECT and HAVE_SELECT can be 0.

2023-01-07  John David Anglin  <danglin@gcc.gnu.org>

c++tools/ChangeLog:

	PR c++tools/107616
	* server.cc (server): Don't call FD_ISSET when HAVE_PSELECT
	and HAVE_SELECT are zero.
  

Comments

Nathan Sidwell Jan. 9, 2023, 11:14 a.m. UTC | #1
On 1/7/23 14:12, John David Anglin wrote:
> Tested on trunk and gcc-12 with hppa64-hp-hpux11.11.

ah, I see that is the use that was unprotected, ok.


> 
> Okay?
> 
> Dave
> ---
> 
> Fix compilation of server.cc on hpux.
> 
> Select and FD_ISSET are declared in sys/time.h on most versions
> of hpux.  As a result, HAVE_PSELECT and HAVE_SELECT can be 0.
> 
> 2023-01-07  John David Anglin  <danglin@gcc.gnu.org>
> 
> c++tools/ChangeLog:
> 
> 	PR c++tools/107616
> 	* server.cc (server): Don't call FD_ISSET when HAVE_PSELECT
> 	and HAVE_SELECT are zero.
> 
> diff --git a/c++tools/server.cc b/c++tools/server.cc
> index 00154a05925..693aec6820a 100644
> --- a/c++tools/server.cc
> +++ b/c++tools/server.cc
> @@ -753,8 +753,10 @@ server (bool ipv6, int sock_fd, module_resolver *resolver)
>   		      }
>   		  }
>   
> +#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
>   	      if (active < 0 && sock_fd >= 0 && FD_ISSET (sock_fd, &readers))
>   		active = -1;
> +#endif
>   	    }
>   
>   	  if (active >= 0)
>
  

Patch

diff --git a/c++tools/server.cc b/c++tools/server.cc
index 00154a05925..693aec6820a 100644
--- a/c++tools/server.cc
+++ b/c++tools/server.cc
@@ -753,8 +753,10 @@  server (bool ipv6, int sock_fd, module_resolver *resolver)
 		      }
 		  }
 
+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
 	      if (active < 0 && sock_fd >= 0 && FD_ISSET (sock_fd, &readers))
 		active = -1;
+#endif
 	    }
 
 	  if (active >= 0)