From aa55ee60447f9b3aebb7c5c543c063c0f0c1e30e Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Mon, 15 Jul 2019 14:56:53 -0700 Subject: [PATCH] Add nolint for implicit borrowed_fd constructors bpfloader uses both clang-tidy and this header, so the below lint warnings are generated: /work/aosp/system/core/base/include/android-base/unique_fd.h:261:18: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor] /* implicit */ borrowed_fd(int fd) : fd_(fd) {} ^ explicit /work/aosp/system/core/base/include/android-base/unique_fd.h:263:18: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor] /* implicit */ borrowed_fd(const unique_fd_impl& ufd) : fd_(ufd.get()) {} ^ explicit Add NOLINT to quiet them. Test: build without this lint warning Change-Id: I5241938c33070b0fa39888289b8ca67d6d94ac73 --- base/include/android-base/unique_fd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/include/android-base/unique_fd.h b/base/include/android-base/unique_fd.h index 3a02cffba..a39245baf 100644 --- a/base/include/android-base/unique_fd.h +++ b/base/include/android-base/unique_fd.h @@ -258,9 +258,9 @@ inline DIR* Fdopendir(unique_fd&& ufd) { // A wrapper type that can be implicitly constructed from either int or unique_fd. struct borrowed_fd { - /* implicit */ borrowed_fd(int fd) : fd_(fd) {} + /* implicit */ borrowed_fd(int fd) : fd_(fd) {} // NOLINT template - /* implicit */ borrowed_fd(const unique_fd_impl& ufd) : fd_(ufd.get()) {} + /* implicit */ borrowed_fd(const unique_fd_impl& ufd) : fd_(ufd.get()) {} // NOLINT int get() const { return fd_; }