Internals: Add cpplint control file and related cleanups

This commit is contained in:
Wilson Snyder 2022-01-09 16:49:38 -05:00
parent 15b32dc140
commit 50094ca296
15 changed files with 61 additions and 13 deletions

17
CPPLINT.cfg Normal file
View File

@ -0,0 +1,17 @@
set noparent
linelength=100
filter=-build/c++11
filter=-build/header_guard
filter=-build/include_order
filter=-build/include_subdir
filter=-readability/inheritance
filter=-readability/nolint
filter=-readability/todo
filter=-runtime/references
filter=-whitespace/blank_line
filter=-whitespace/empty_if_body
filter=-whitespace/indent
filter=-whitespace/newline
filter=-whitespace/braces
filter=-whitespace/parens
filter=-whitespace/todo

View File

@ -29,6 +29,7 @@
#include <deque> #include <deque>
#include <fstream> #include <fstream>
#include <map> #include <map>
#include <utility>
//============================================================================= //=============================================================================
// VerilatedCovConst // VerilatedCovConst

View File

@ -195,9 +195,9 @@ void VerilatedFst::declare(vluint32_t code, const char* name, int dtypenum, fstV
// If the scope ends with a non-ascii character, it will be 0x80 + fstScopeType // If the scope ends with a non-ascii character, it will be 0x80 + fstScopeType
fstWriterSetScope(m_fst, static_cast<fstScopeType>(new_it->back() & 0x7f), fstWriterSetScope(m_fst, static_cast<fstScopeType>(new_it->back() & 0x7f),
tmpModName.c_str(), nullptr); tmpModName.c_str(), nullptr);
} else } else {
fstWriterSetScope(m_fst, FST_ST_VCD_SCOPE, new_it->c_str(), nullptr); fstWriterSetScope(m_fst, FST_ST_VCD_SCOPE, new_it->c_str(), nullptr);
}
m_curScope.push_back(*new_it); m_curScope.push_back(*new_it);
new_it = tokens.erase(new_it); new_it = tokens.erase(new_it);
} }

View File

@ -26,6 +26,8 @@
#include "verilated_sc.h" #include "verilated_sc.h"
#include "verilated_fst_c.h" #include "verilated_fst_c.h"
#include <string>
//============================================================================= //=============================================================================
// VerilatedFstSc // VerilatedFstSc
/// ///

View File

@ -28,6 +28,8 @@
#error "verilated_funcs.h should only be included by verilated.h" #error "verilated_funcs.h should only be included by verilated.h"
#endif #endif
#include <string>
//========================================================================= //=========================================================================
// Extern functions -- User may override -- See verilated.cpp // Extern functions -- User may override -- See verilated.cpp
@ -2036,40 +2038,40 @@ static inline WDataOutP VL_CONST_W_2X(int obits, WDataOutP o, EData d1, EData d0
static inline WDataOutP VL_CONST_W_3X(int obits, WDataOutP o, EData d2, EData d1, static inline WDataOutP VL_CONST_W_3X(int obits, WDataOutP o, EData d2, EData d1,
EData d0) VL_MT_SAFE { EData d0) VL_MT_SAFE {
o[0] = d0; o[1] = d1; o[2] = d2; o[0] = d0; o[1] = d1; o[2] = d2;
VL_C_END_(obits,3); VL_C_END_(obits, 3);
} }
static inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o, static inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o,
EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE {
o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3;
VL_C_END_(obits,4); VL_C_END_(obits, 4);
} }
static inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o, static inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o,
EData d4, EData d4,
EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE {
o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3;
o[4] = d4; o[4] = d4;
VL_C_END_(obits,5); VL_C_END_(obits, 5);
} }
static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o, static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o,
EData d5, EData d4, EData d5, EData d4,
EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE {
o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3;
o[4] = d4; o[5] = d5; o[4] = d4; o[5] = d5;
VL_C_END_(obits,6); VL_C_END_(obits, 6);
} }
static inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o, static inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o,
EData d6, EData d5, EData d4, EData d6, EData d5, EData d4,
EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE {
o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3;
o[4] = d4; o[5] = d5; o[6] = d6; o[4] = d4; o[5] = d5; o[6] = d6;
VL_C_END_(obits,7); VL_C_END_(obits, 7);
} }
static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o, static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o,
EData d7, EData d6, EData d5, EData d4, EData d7, EData d6, EData d5, EData d4,
EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE {
o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3;
o[4] = d4; o[5] = d5; o[6] = d6; o[7] = d7; o[4] = d4; o[5] = d5; o[6] = d6; o[7] = d7;
VL_C_END_(obits,8); VL_C_END_(obits, 8);
} }
// //
static inline WDataOutP VL_CONSTHI_W_1X(int obits, int lsb, WDataOutP obase, static inline WDataOutP VL_CONSTHI_W_1X(int obits, int lsb, WDataOutP obase,

View File

@ -32,10 +32,14 @@
#include "verilated.h" #include "verilated.h"
#include "verilated_syms.h" #include "verilated_syms.h"
#include <algorithm>
#include <deque> #include <deque>
#include <set> #include <map>
#include <vector>
#include <numeric> #include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>
#ifdef VL_THREADED #ifdef VL_THREADED
# include <functional> # include <functional>
# include <queue> # include <queue>

View File

@ -25,6 +25,9 @@
#include "verilatedos.h" #include "verilatedos.h"
#include "verilated.h" // for VerilatedMutex and clang annotations #include "verilated.h" // for VerilatedMutex and clang annotations
#include <deque>
#include <string>
// Profile record, private class used only by this header // Profile record, private class used only by this header
class VerilatedProfilerRec final { class VerilatedProfilerRec final {
const std::string m_name; // Hashed name of mtask/etc const std::string m_name; // Hashed name of mtask/etc

View File

@ -26,6 +26,8 @@
#include <cstdio> #include <cstdio>
#include <fstream> #include <fstream>
#include <memory>
#include <string>
//============================================================================= //=============================================================================
// Globals // Globals

View File

@ -27,6 +27,7 @@
#include "verilated.h" #include "verilated.h"
#include "verilated_trace_defs.h" #include "verilated_trace_defs.h"
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -28,6 +28,14 @@
#error "verilated_types.h should only be included by verilated.h" #error "verilated_types.h should only be included by verilated.h"
#endif #endif
#include <algorithm>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <unordered_set>
#include <utility>
//=================================================================== //===================================================================
// String formatters (required by below containers) // String formatters (required by below containers)

View File

@ -426,8 +426,9 @@ void VerilatedVcd::dumpHeader() {
case VLT_TRACE_SCOPE_UNION: printStr("union "); break; case VLT_TRACE_SCOPE_UNION: printStr("union "); break;
default: printStr("module "); default: printStr("module ");
} }
} else } else {
printStr("module "); printStr("module ");
}
for (; *np && *np != ' ' && *np != '\t'; np++) { for (; *np && *np != ' ' && *np != '\t'; np++) {
if (*np == '[') { if (*np == '[') {

View File

@ -26,6 +26,8 @@
#include "verilated_sc.h" #include "verilated_sc.h"
#include "verilated_vcd_c.h" #include "verilated_vcd_c.h"
#include <string>
//============================================================================= //=============================================================================
// VerilatedVcdSc // VerilatedVcdSc
/// ///

View File

@ -33,6 +33,10 @@
#include <list> #include <list>
#include <map> #include <map>
#include <set> #include <set>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
//====================================================================== //======================================================================
// Internal constants // Internal constants

View File

@ -92,7 +92,7 @@
# define VL_ATTR_NORETURN ///< Attribute that function does not ever return # define VL_ATTR_NORETURN ///< Attribute that function does not ever return
#endif #endif
#ifndef VL_ATTR_NO_SANITIZE_ALIGN #ifndef VL_ATTR_NO_SANITIZE_ALIGN
# define VL_ATTR_NO_SANITIZE_ALIGN ///< Attribute that the function contains intended unaligned access # define VL_ATTR_NO_SANITIZE_ALIGN ///< Attribute that function contains intended unaligned access
#endif #endif
#ifndef VL_ATTR_PRINTF #ifndef VL_ATTR_PRINTF
# define VL_ATTR_PRINTF(fmtArgNum) ///< Attribute for function with printf format checking # define VL_ATTR_PRINTF(fmtArgNum) ///< Attribute for function with printf format checking
@ -499,7 +499,7 @@ using ssize_t = uint32_t; ///< signed size_t; returned from read()
# ifdef __x86_64__ # ifdef __x86_64__
# define VL_X86_64 1 # define VL_X86_64 1
# endif # endif
#endif // VL_PORTABLE_ONLY #endif // VL_PORTABLE_ONLY
// clang-format on // clang-format on
//========================================================================= //=========================================================================

View File

@ -43,6 +43,7 @@
#include <deque> #include <deque>
#include <sstream> #include <sstream>
#include <stack> #include <stack>
#include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>