From 50094ca296f23dba16fd6947a1e11a8440895902 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 9 Jan 2022 16:49:38 -0500 Subject: [PATCH] Internals: Add cpplint control file and related cleanups --- CPPLINT.cfg | 17 +++++++++++++++++ include/verilated_cov.cpp | 1 + include/verilated_fst_c.cpp | 4 ++-- include/verilated_fst_sc.h | 2 ++ include/verilated_funcs.h | 14 ++++++++------ include/verilated_imp.h | 8 ++++++-- include/verilated_profiler.h | 3 +++ include/verilated_threads.cpp | 2 ++ include/verilated_trace.h | 1 + include/verilated_types.h | 8 ++++++++ include/verilated_vcd_c.cpp | 3 ++- include/verilated_vcd_sc.h | 2 ++ include/verilated_vpi.cpp | 4 ++++ include/verilatedos.h | 4 ++-- src/V3Simulate.h | 1 + 15 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 CPPLINT.cfg diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 000000000..3b872606e --- /dev/null +++ b/CPPLINT.cfg @@ -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 diff --git a/include/verilated_cov.cpp b/include/verilated_cov.cpp index 0cd9f8d67..6a1fcf69a 100644 --- a/include/verilated_cov.cpp +++ b/include/verilated_cov.cpp @@ -29,6 +29,7 @@ #include #include #include +#include //============================================================================= // VerilatedCovConst diff --git a/include/verilated_fst_c.cpp b/include/verilated_fst_c.cpp index 5c54dce11..4c8df71b2 100644 --- a/include/verilated_fst_c.cpp +++ b/include/verilated_fst_c.cpp @@ -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 fstWriterSetScope(m_fst, static_cast(new_it->back() & 0x7f), tmpModName.c_str(), nullptr); - } else + } else { fstWriterSetScope(m_fst, FST_ST_VCD_SCOPE, new_it->c_str(), nullptr); - + } m_curScope.push_back(*new_it); new_it = tokens.erase(new_it); } diff --git a/include/verilated_fst_sc.h b/include/verilated_fst_sc.h index fbcab1b6b..e0958db9e 100644 --- a/include/verilated_fst_sc.h +++ b/include/verilated_fst_sc.h @@ -26,6 +26,8 @@ #include "verilated_sc.h" #include "verilated_fst_c.h" +#include + //============================================================================= // VerilatedFstSc /// diff --git a/include/verilated_funcs.h b/include/verilated_funcs.h index 3e30d4718..ac241fd34 100644 --- a/include/verilated_funcs.h +++ b/include/verilated_funcs.h @@ -28,6 +28,8 @@ #error "verilated_funcs.h should only be included by verilated.h" #endif +#include + //========================================================================= // 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, EData d0) VL_MT_SAFE { 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, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { 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, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[4] = d4; - VL_C_END_(obits,5); + VL_C_END_(obits, 5); } static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; 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, EData d6, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; 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, EData d7, EData d6, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; 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, diff --git a/include/verilated_imp.h b/include/verilated_imp.h index eccb0487b..b14876fac 100644 --- a/include/verilated_imp.h +++ b/include/verilated_imp.h @@ -32,10 +32,14 @@ #include "verilated.h" #include "verilated_syms.h" +#include #include -#include -#include +#include #include +#include +#include +#include +#include #ifdef VL_THREADED # include # include diff --git a/include/verilated_profiler.h b/include/verilated_profiler.h index 1914fd5aa..46df1c249 100644 --- a/include/verilated_profiler.h +++ b/include/verilated_profiler.h @@ -25,6 +25,9 @@ #include "verilatedos.h" #include "verilated.h" // for VerilatedMutex and clang annotations +#include +#include + // Profile record, private class used only by this header class VerilatedProfilerRec final { const std::string m_name; // Hashed name of mtask/etc diff --git a/include/verilated_threads.cpp b/include/verilated_threads.cpp index 2da58778c..6051b8967 100644 --- a/include/verilated_threads.cpp +++ b/include/verilated_threads.cpp @@ -26,6 +26,8 @@ #include #include +#include +#include //============================================================================= // Globals diff --git a/include/verilated_trace.h b/include/verilated_trace.h index 31db7fd0f..3b1426dd6 100644 --- a/include/verilated_trace.h +++ b/include/verilated_trace.h @@ -27,6 +27,7 @@ #include "verilated.h" #include "verilated_trace_defs.h" +#include #include #include diff --git a/include/verilated_types.h b/include/verilated_types.h index 1a340400c..39592db96 100644 --- a/include/verilated_types.h +++ b/include/verilated_types.h @@ -28,6 +28,14 @@ #error "verilated_types.h should only be included by verilated.h" #endif +#include +#include +#include +#include +#include +#include +#include + //=================================================================== // String formatters (required by below containers) diff --git a/include/verilated_vcd_c.cpp b/include/verilated_vcd_c.cpp index f3707af1c..d299f2001 100644 --- a/include/verilated_vcd_c.cpp +++ b/include/verilated_vcd_c.cpp @@ -426,8 +426,9 @@ void VerilatedVcd::dumpHeader() { case VLT_TRACE_SCOPE_UNION: printStr("union "); break; default: printStr("module "); } - } else + } else { printStr("module "); + } for (; *np && *np != ' ' && *np != '\t'; np++) { if (*np == '[') { diff --git a/include/verilated_vcd_sc.h b/include/verilated_vcd_sc.h index ee47c0182..beb153e98 100644 --- a/include/verilated_vcd_sc.h +++ b/include/verilated_vcd_sc.h @@ -26,6 +26,8 @@ #include "verilated_sc.h" #include "verilated_vcd_c.h" +#include + //============================================================================= // VerilatedVcdSc /// diff --git a/include/verilated_vpi.cpp b/include/verilated_vpi.cpp index 82fb58233..365d0e520 100644 --- a/include/verilated_vpi.cpp +++ b/include/verilated_vpi.cpp @@ -33,6 +33,10 @@ #include #include #include +#include +#include +#include +#include //====================================================================== // Internal constants diff --git a/include/verilatedos.h b/include/verilatedos.h index 1392ce6ab..bf1731a34 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -92,7 +92,7 @@ # define VL_ATTR_NORETURN ///< Attribute that function does not ever return #endif #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 #ifndef VL_ATTR_PRINTF # 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__ # define VL_X86_64 1 # endif -#endif // VL_PORTABLE_ONLY +#endif // VL_PORTABLE_ONLY // clang-format on //========================================================================= diff --git a/src/V3Simulate.h b/src/V3Simulate.h index 18a866566..9262e1ed3 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include