From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by sourceware.org (Postfix) with ESMTPS id E40043858D37 for ; Wed, 2 Mar 2022 00:26:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E40043858D37 Received: by mail-io1-xd32.google.com with SMTP id c14so20432620ioa.12 for ; Tue, 01 Mar 2022 16:26:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=x7ogz7dk8Mqgw70gr8Fqc1LhGeMfe0NTI2MNW3zP2yQ=; b=b0SklmPlgZPD2dMY4eFgpfCPxk39o1kfh3MEnZ0h5EqqnBaxvu036vPJR6/9Zd7Lt8 DRk5N0MCAKHKSySaPTJ5afatJIhuA3OxVd6HatirL1FigGul6Up38y9GO5zhfTPzt918 CmSMwyxO78lqgIN8g2jZM5K/tVLf5vn9cC6YfZS1nrdb9cOS9t3LSq/iAiq7OP3qDOWA uxFVgfxPSfjNIG2Ef796ckZY6BRW+XGgu/tfpmCulS5LRANTB9UC/ALxv7YEvtb6q+Ag +OYf2G1Havgyde8zmmYPgnilZ2lWjn5ojtblguxzxrApJuxbynPrSsNoxZPt1lOyuUJv lRDQ== X-Gm-Message-State: AOAM532eHWJLyzfjhz+mUUnWkVtIJzb4zp58Ou8+cKL/z7s9rGRQweR9 M8pDjm4ieulp7DI0EGdG0lFhauYxacqzytd50xFRjYeyzdn3+Q== X-Google-Smtp-Source: ABdhPJwhzs/ezu7LejJKNdkUUs2AcdUz2DcezJcfpvDDYst/0DuLnw2J308ChG74G+ewB30qEoGe6cJmosqyTZkzgBo= X-Received: by 2002:a02:b199:0:b0:317:2edd:53d with SMTP id t25-20020a02b199000000b003172edd053dmr11663342jah.296.1646180777774; Tue, 01 Mar 2022 16:26:17 -0800 (PST) MIME-Version: 1.0 From: Roland McGrath Date: Tue, 1 Mar 2022 16:26:07 -0800 Message-ID: Subject: [PATCH users/roland/event-pipe] Avoid conflict with gnulib open/close macros. To: GDB Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-25.4 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2022 00:26:20 -0000 [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 --