From 85c8e7f788512ce5b5b43cd816e8091b57c3d5e7 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 21 Nov 2016 13:50:32 -0500 Subject: Fixup lint flags. The -build/include setting was masking out build/include_what_you_use. This CL restores them, fixes any build errors, and adds NOLINT as needed. As well, the runtime/explicit and runtime/printf flags are aslo enabled and NOLINT'd. lint cleanups Change-Id: Ib013b3eb29c8d0e48cad74c5df9028684130719f Reviewed-on: https://pdfium-review.googlesource.com/2030 Reviewed-by: Tom Sepez --- core/fxcrt/cfx_shared_copy_on_write.h | 1 + core/fxcrt/cfx_string_c_template.h | 2 ++ core/fxcrt/cfx_weak_ptr.h | 4 +++- core/fxcrt/fx_basic.h | 4 ++-- core/fxcrt/fx_basic_bstring_unittest.cpp | 2 ++ core/fxcrt/fx_ext.h | 1 + core/fxcrt/fx_extension.cpp | 2 ++ core/fxcrt/fx_string.h | 4 ++++ core/fxcrt/fx_xml.h | 2 +- core/fxcrt/fx_xml_parser.cpp | 1 + 10 files changed, 19 insertions(+), 4 deletions(-) (limited to 'core/fxcrt') diff --git a/core/fxcrt/cfx_shared_copy_on_write.h b/core/fxcrt/cfx_shared_copy_on_write.h index cd6cf6adc5..c87d96509d 100644 --- a/core/fxcrt/cfx_shared_copy_on_write.h +++ b/core/fxcrt/cfx_shared_copy_on_write.h @@ -56,6 +56,7 @@ class CFX_SharedCopyOnWrite { class CountedObj : public ObjClass { public: template + // NOLINTNEXTLINE(runtime/explicit) CountedObj(Args... params) : ObjClass(params...), m_RefCount(0) {} CountedObj(const CountedObj& src) : ObjClass(src), m_RefCount(0) {} diff --git a/core/fxcrt/cfx_string_c_template.h b/core/fxcrt/cfx_string_c_template.h index 4a3dae7e7e..3bfcc915fb 100644 --- a/core/fxcrt/cfx_string_c_template.h +++ b/core/fxcrt/cfx_string_c_template.h @@ -24,6 +24,7 @@ class CFX_StringCTemplate { CFX_StringCTemplate() : m_Ptr(nullptr), m_Length(0) {} // Deliberately implicit to avoid calling on every string literal. + // NOLINTNEXTLINE(runtime/explicit) CFX_StringCTemplate(const CharType* ptr) : m_Ptr(reinterpret_cast(ptr)), m_Length(ptr ? FXSYS_len(ptr) : 0) {} @@ -41,6 +42,7 @@ class CFX_StringCTemplate { // Deliberately implicit to avoid calling on every string literal. // |ch| must be an lvalue that outlives the the CFX_StringCTemplate. + // NOLINTNEXTLINE(runtime/explicit) CFX_StringCTemplate(CharType& ch) { m_Ptr = reinterpret_cast(&ch); m_Length = 1; diff --git a/core/fxcrt/cfx_weak_ptr.h b/core/fxcrt/cfx_weak_ptr.h index f679696992..43ae5b881d 100644 --- a/core/fxcrt/cfx_weak_ptr.h +++ b/core/fxcrt/cfx_weak_ptr.h @@ -9,6 +9,7 @@ #include #include +#include #include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_system.h" @@ -19,10 +20,11 @@ class CFX_WeakPtr { CFX_WeakPtr() {} CFX_WeakPtr(const CFX_WeakPtr& that) : m_pHandle(that.m_pHandle) {} CFX_WeakPtr(CFX_WeakPtr&& that) { Swap(that); } - CFX_WeakPtr(std::unique_ptr pObj) + explicit CFX_WeakPtr(std::unique_ptr pObj) : m_pHandle(new Handle(std::move(pObj))) {} // Deliberately implicit to allow passing nullptr. + // NOLINTNEXTLINE(runtime/explicit) CFX_WeakPtr(std::nullptr_t arg) {} explicit operator bool() const { return m_pHandle && !!m_pHandle->Get(); } diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 9c8b4e146e..9034398983 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -455,7 +455,7 @@ class CFX_MapPtrToPtr { }; public: - CFX_MapPtrToPtr(int nBlockSize = 10); + explicit CFX_MapPtrToPtr(int nBlockSize = 10); ~CFX_MapPtrToPtr(); int GetCount() const { return m_nCount; } @@ -554,7 +554,7 @@ class CFX_PtrList { }; public: - CFX_PtrList(int nBlockSize = 10); + explicit CFX_PtrList(int nBlockSize = 10); FX_POSITION GetHeadPosition() const { return (FX_POSITION)m_pNodeHead; } FX_POSITION GetTailPosition() const { return (FX_POSITION)m_pNodeTail; } diff --git a/core/fxcrt/fx_basic_bstring_unittest.cpp b/core/fxcrt/fx_basic_bstring_unittest.cpp index f314c652ba..503e68458a 100644 --- a/core/fxcrt/fx_basic_bstring_unittest.cpp +++ b/core/fxcrt/fx_basic_bstring_unittest.cpp @@ -649,6 +649,7 @@ TEST(fxcrt, ByteStringGetBuffer) { { CFX_ByteString str; FX_CHAR* buffer = str.GetBuffer(12); + // NOLINTNEXTLINE(runtime/printf) strcpy(buffer, "clams"); str.ReleaseBuffer(); EXPECT_EQ("clams", str); @@ -656,6 +657,7 @@ TEST(fxcrt, ByteStringGetBuffer) { { CFX_ByteString str("cl"); FX_CHAR* buffer = str.GetBuffer(12); + // NOLINTNEXTLINE(runtime/printf) strcpy(buffer + 2, "ams"); str.ReleaseBuffer(); EXPECT_EQ("clams", str); diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h index b7fd6f67f7..7d8529e333 100644 --- a/core/fxcrt/fx_ext.h +++ b/core/fxcrt/fx_ext.h @@ -9,6 +9,7 @@ #include #include +#include #include "core/fxcrt/fx_basic.h" diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 0a378f32e5..39bf028205 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -6,6 +6,8 @@ #include "core/fxcrt/extension.h" +#include +#include #include #include "core/fxcrt/fx_basic.h" diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h index 0b6d8064d4..540c0c4330 100644 --- a/core/fxcrt/fx_string.h +++ b/core/fxcrt/fx_string.h @@ -41,7 +41,9 @@ class CFX_ByteString { CFX_ByteString(CFX_ByteString&& other); // Deliberately implicit to avoid calling on every string literal. + // NOLINTNEXTLINE(runtime/explicit) CFX_ByteString(char ch); + // NOLINTNEXTLINE(runtime/explicit) CFX_ByteString(const FX_CHAR* ptr); CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); @@ -242,7 +244,9 @@ class CFX_WideString { CFX_WideString(CFX_WideString&& other); // Deliberately implicit to avoid calling on every string literal. + // NOLINTNEXTLINE(runtime/explicit) CFX_WideString(FX_WCHAR ch); + // NOLINTNEXTLINE(runtime/explicit) CFX_WideString(const FX_WCHAR* ptr); CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); diff --git a/core/fxcrt/fx_xml.h b/core/fxcrt/fx_xml.h index 6c6e6178af..a7375b9e90 100644 --- a/core/fxcrt/fx_xml.h +++ b/core/fxcrt/fx_xml.h @@ -66,7 +66,7 @@ class CXML_Element { FX_FILESIZE* pParsedSize = nullptr); CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); - CXML_Element(const CFX_ByteStringC& qTagName); + explicit CXML_Element(const CFX_ByteStringC& qTagName); CXML_Element(); ~CXML_Element(); diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index e1a209a701..3391086e90 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -6,6 +6,7 @@ #include "core/fxcrt/xml_int.h" +#include #include #include "core/fxcrt/fx_ext.h" -- cgit v1.2.3