* [PATCH users/roland/event-pipe] Avoid conflict with gnulib open/close macros.
@ 2022-03-02 0:26 Roland McGrath
2022-03-02 0:31 ` John Baldwin
2022-03-03 18:57 ` Pedro Alves
0 siblings, 2 replies; 4+ messages in thread
From: Roland McGrath @ 2022-03-02 0:26 UTC (permalink / raw)
To: GDB
[This patch is on sourceware branch users/roland/event-pipe for your
convenience. I can merge it in myself after approval.]
On some systems, the gnulib configuration will decide to define open
and/or close as macros to replace the POSIX C functions. This
interferes with using those names in C++ class or namespace scopes.
gdbsupport/
* event-pipe.cc (event_pipe::open): Renamed to ...
(event_pipe::open_pipe): ... this.
(event_pipe::close): Renamed to ...
(event_pipe::close_pipe): ... this.
* event-pipe.h (class event_pipe): Updated.
gdb/
* inf-ptrace.h (async_file_open, async_file_close): Updated.
gdbserver/
* gdbserver/linux-low.cc (linux_process_target::async): Likewise.
---
gdb/inf-ptrace.h | 4 ++--
gdbserver/linux-low.cc | 4 ++--
gdbsupport/event-pipe.cc | 6 +++---
gdbsupport/event-pipe.h | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/gdb/inf-ptrace.h b/gdb/inf-ptrace.h
index 62cc7778767..8f18d4579a6 100644
--- a/gdb/inf-ptrace.h
+++ b/gdb/inf-ptrace.h
@@ -77,9 +77,9 @@ struct inf_ptrace_target : public inf_child_target
protected:
/* Helper routines for interacting with the async event pipe. */
bool async_file_open ()
- { return m_event_pipe.open (); }
+ { return m_event_pipe.open_pipe (); }
void async_file_close ()
- { m_event_pipe.close (); }
+ { m_event_pipe.close_pipe (); }
void async_file_flush ()
{ m_event_pipe.flush (); }
void async_file_mark ()
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 301e42a36f3..0a5b6063104 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -5810,7 +5810,7 @@ linux_process_target::async (bool enable)
if (enable)
{
- if (!linux_event_pipe.open ())
+ if (!linux_event_pipe.open_pipe ())
{
gdb_sigmask (SIG_UNBLOCK, &mask, NULL);
@@ -5830,7 +5830,7 @@ linux_process_target::async (bool enable)
{
delete_file_handler (linux_event_pipe.event_fd ());
- linux_event_pipe.close ();
+ linux_event_pipe.close_pipe ();
}
gdb_sigmask (SIG_UNBLOCK, &mask, NULL);
diff --git a/gdbsupport/event-pipe.cc b/gdbsupport/event-pipe.cc
index 2b56b2fac8e..a1d34d59609 100644
--- a/gdbsupport/event-pipe.cc
+++ b/gdbsupport/event-pipe.cc
@@ -28,7 +28,7 @@
event_pipe::~event_pipe ()
{
if (is_open ())
- close ();
+ close_pipe ();
}
/* See event-pipe.h. */
@@ -45,7 +45,7 @@ event_pipe::open ()
if (fcntl (m_fds[0], F_SETFL, O_NONBLOCK) == -1
|| fcntl (m_fds[1], F_SETFL, O_NONBLOCK) == -1)
{
- close ();
+ close_pipe ();
return false;
}
@@ -55,7 +55,7 @@ event_pipe::open ()
/* See event-pipe.h. */
void
-event_pipe::close ()
+event_pipe::close_pipe ()
{
::close (m_fds[0]);
::close (m_fds[1]);
diff --git a/gdbsupport/event-pipe.h b/gdbsupport/event-pipe.h
index 50679e470e4..9a41089774d 100644
--- a/gdbsupport/event-pipe.h
+++ b/gdbsupport/event-pipe.h
@@ -34,10 +34,10 @@ class event_pipe
DISABLE_COPY_AND_ASSIGN (event_pipe);
/* Create a new pipe. */
- bool open ();
+ bool open_pipe ();
/* Close the pipe. */
- void close ();
+ void close_pipe ();
/* True if the event pipe has been opened. */
bool is_open () const
--
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH users/roland/event-pipe] Avoid conflict with gnulib open/close macros.
2022-03-02 0:26 [PATCH users/roland/event-pipe] Avoid conflict with gnulib open/close macros Roland McGrath
@ 2022-03-02 0:31 ` John Baldwin
2022-03-03 18:57 ` Pedro Alves
1 sibling, 0 replies; 4+ messages in thread
From: John Baldwin @ 2022-03-02 0:31 UTC (permalink / raw)
To: Roland McGrath, GDB
On 3/1/22 4:26 PM, Roland McGrath via Gdb-patches wrote:
> [This patch is on sourceware branch users/roland/event-pipe for your
> convenience. I can merge it in myself after approval.]
>
> On some systems, the gnulib configuration will decide to define open
> and/or close as macros to replace the POSIX C functions. This
> interferes with using those names in C++ class or namespace scopes.
I noticed this recently as well (and I authored the event-pipe.cc file).
This is an unfortunate consequence of the gnulib #define approach.
I think this patch is fine (but I'm not an approver).
--
John Baldwin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH users/roland/event-pipe] Avoid conflict with gnulib open/close macros.
2022-03-02 0:26 [PATCH users/roland/event-pipe] Avoid conflict with gnulib open/close macros Roland McGrath
2022-03-02 0:31 ` John Baldwin
@ 2022-03-03 18:57 ` Pedro Alves
2022-03-03 19:23 ` Roland McGrath
1 sibling, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2022-03-03 18:57 UTC (permalink / raw)
To: Roland McGrath, GDB
On 2022-03-02 00:26, Roland McGrath via Gdb-patches wrote:
> [This patch is on sourceware branch users/roland/event-pipe for your
> convenience. I can merge it in myself after approval.]
>
> On some systems, the gnulib configuration will decide to define open
> and/or close as macros to replace the POSIX C functions. This
> interferes with using those names in C++ class or namespace scopes.
>
> gdbsupport/
> * event-pipe.cc (event_pipe::open): Renamed to ...
> (event_pipe::open_pipe): ... this.
> (event_pipe::close): Renamed to ...
> (event_pipe::close_pipe): ... this.
> * event-pipe.h (class event_pipe): Updated.
> gdb/
> * inf-ptrace.h (async_file_open, async_file_close): Updated.
> gdbserver/
> * gdbserver/linux-low.cc (linux_process_target::async): Likewise.
OK, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH users/roland/event-pipe] Avoid conflict with gnulib open/close macros.
2022-03-03 18:57 ` Pedro Alves
@ 2022-03-03 19:23 ` Roland McGrath
0 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2022-03-03 19:23 UTC (permalink / raw)
To: Pedro Alves; +Cc: GDB
Merged. Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-03 19:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 0:26 [PATCH users/roland/event-pipe] Avoid conflict with gnulib open/close macros Roland McGrath
2022-03-02 0:31 ` John Baldwin
2022-03-03 18:57 ` Pedro Alves
2022-03-03 19:23 ` Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).