From 1fb0af7fba1bc01066c771f5dc0b0fbb6bfd4fa8 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 14 May 2019 21:46:19 -0400 Subject: [PATCH] Internals: Fix some -Wsuggest-attribute=const suggestions. --- src/V3Ast.cpp | 3 --- src/V3Ast.h | 2 +- src/V3GraphTest.cpp | 10 +++++----- src/V3Number.cpp | 4 ++-- src/V3PreProc.cpp | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 3100e128e..7dd16620f 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -690,9 +690,6 @@ void AstNode::deleteNode() { // and we can debug easier. } -AstNode::~AstNode() { -} - void AstNode::deleteTreeIter() { // private: Delete list of nodes. Publicly call deleteTree() instead. // Audited to make sure this is never NULL diff --git a/src/V3Ast.h b/src/V3Ast.h index 0ecc0093a..84dec6e13 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1229,7 +1229,7 @@ public: bool brokeExistsAbove() const; // CONSTRUCTORS - virtual ~AstNode(); + virtual ~AstNode() {} #ifdef VL_LEAK_CHECKS static void* operator new(size_t size); static void operator delete(void* obj, size_t size); diff --git a/src/V3GraphTest.cpp b/src/V3GraphTest.cpp index a69feb9ec..c5ea3635b 100644 --- a/src/V3GraphTest.cpp +++ b/src/V3GraphTest.cpp @@ -327,8 +327,11 @@ public: class V3GraphTestImport : public V3GraphTest { - // cppcheck-suppress functionConst +#ifdef GRAPH_IMPORT void dotImport(); +#else + void dotImport() {} +#endif public: virtual string name() { return "import"; } @@ -344,11 +347,8 @@ public: } }; -#if 0 +#ifdef GRAPH_IMPORT # include "graph_export.cpp" -#else -void V3GraphTestImport::dotImport() { -} #endif //====================================================================== diff --git a/src/V3Number.cpp b/src/V3Number.cpp index 2661db490..cc8a1e1e9 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -287,8 +287,8 @@ void V3Number::setNames(AstNode* nodep) { int V3Number::log2b(uint32_t num) { // See also opCLog2 - for (int bit=31; bit>0; bit--) if (num & (VL_ULL(1)<0; bit--) if (num & (VL_ULL(1)<v3errorEnd(str); } - const char* tokenName(int tok); + static const char* tokenName(int tok); void debugToken(int tok, const char* cmtp); void parseTop(); void parseUndef();