From patchwork Wed Sep 26 11:31:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 29548 Received: (qmail 93009 invoked by alias); 26 Sep 2018 11:32:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 92995 invoked by uid 89); 26 Sep 2018 11:32:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=tracepointc, UD:tracepoint.c, tracepoint.c X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Sep 2018 11:32:28 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway33.websitewelcome.com (Postfix) with ESMTP id F3A9A62A34E for ; Wed, 26 Sep 2018 06:32:26 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 582hg83BOBcCX5836gUcKl; Wed, 26 Sep 2018 06:32:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=1M0/hlXfcH1iNo2Zam2hwYUafz/g8RK9gygLkGgsO18=; b=pPhfMf27pD9WEK6oOZsgvSa6Pb /5bhMkjSapnG1TTVbm33StpfZpI6sfxryz7zlMYk/VdtitkH3Pi1AOYUKerJFKUcJEwNFBlmWXsBD 2E1NF0oispm5T+76ZGrFHR/FP; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:44376 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1g582h-00193s-6L; Wed, 26 Sep 2018 06:31:43 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Don't check HAVE_UNISTD_H Date: Wed, 26 Sep 2018 05:31:41 -0600 Message-Id: <20180926113141.21219-1-tom@tromey.com> I noticed some spots that were checking HAVE_UNISTD_H. There is no need to do this, as is unconditionally included in many places in gdb. This sort of cleanup was done once before, in 2013: 2013-07-01 Pedro Alves * defs.h: Don't check HAVE_UNISTD_H before including . (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Delete. * tracepoint.c: Don't check HAVE_UNISTD_H before including . HAVE_UNISTD_H seems to come from gnulib, so there are still mentions of it in the source. gdb/ChangeLog 2018-09-26 Tom Tromey * unittests/scoped_mmap-selftests.c: Don't check HAVE_UNISTD_H. * unittests/scoped_fd-selftests.c: Don't check HAVE_UNISTD_H. * common/scoped_fd.h: Don't check HAVE_UNISTD_H. --- gdb/ChangeLog | 6 ++++++ gdb/common/scoped_fd.h | 5 ----- gdb/unittests/scoped_fd-selftests.c | 7 ------- gdb/unittests/scoped_mmap-selftests.c | 6 +++--- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/gdb/common/scoped_fd.h b/gdb/common/scoped_fd.h index a6a8ab9a38..c2125bd1af 100644 --- a/gdb/common/scoped_fd.h +++ b/gdb/common/scoped_fd.h @@ -20,10 +20,6 @@ #ifndef SCOPED_FD_H #define SCOPED_FD_H -#include "config.h" - -#ifdef HAVE_UNISTD_H - #include /* A smart-pointer-like class to automatically close a file descriptor. */ @@ -56,5 +52,4 @@ private: int m_fd; }; -#endif /* HAVE_UNISTD_H */ #endif /* SCOPED_FD_H */ diff --git a/gdb/unittests/scoped_fd-selftests.c b/gdb/unittests/scoped_fd-selftests.c index 4d7454134a..d5c0d30abb 100644 --- a/gdb/unittests/scoped_fd-selftests.c +++ b/gdb/unittests/scoped_fd-selftests.c @@ -21,9 +21,6 @@ #include "common/scoped_fd.h" #include "config.h" - -#ifdef HAVE_UNISTD_H - #include "selftest.h" namespace selftests { @@ -78,13 +75,9 @@ run_tests () } /* namespace scoped_fd */ } /* namespace selftests */ -#endif /* HAVE_UNISTD_H */ - void _initialize_scoped_fd_selftests () { -#ifdef HAVE_UNISTD_H selftests::register_test ("scoped_fd", selftests::scoped_fd::run_tests); -#endif } diff --git a/gdb/unittests/scoped_mmap-selftests.c b/gdb/unittests/scoped_mmap-selftests.c index e9d4afdffc..b181e02f50 100644 --- a/gdb/unittests/scoped_mmap-selftests.c +++ b/gdb/unittests/scoped_mmap-selftests.c @@ -22,7 +22,7 @@ #include "common/scoped_mmap.h" #include "config.h" -#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_UNISTD_H) +#if defined(HAVE_SYS_MMAN_H) #include "selftest.h" #include "common/gdb_unlinker.h" @@ -132,12 +132,12 @@ run_tests () } /* namespace mmap_file */ } /* namespace selftests */ -#endif /* !defined(HAVE_SYS_MMAN_H) || !defined(HAVE_UNISTD_H) */ +#endif /* !defined(HAVE_SYS_MMAN_H) */ void _initialize_scoped_mmap_selftests () { -#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_UNISTD_H) +#if defined(HAVE_SYS_MMAN_H) selftests::register_test ("scoped_mmap", selftests::scoped_mmap::run_tests); selftests::register_test ("mmap_file",