diff --git a/Changes b/Changes index a30f5ff06..8cac9986a 100644 --- a/Changes +++ b/Changes @@ -23,6 +23,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix slice connections of arrays to ports, bug880. [Varun Koyyalagunta] +**** Fix clang compile warnings. + * Verilator 3.868 2014-12-20 diff --git a/configure.ac b/configure.ac index 6dbbaefd8..2f13a17a0 100644 --- a/configure.ac +++ b/configure.ac @@ -107,32 +107,46 @@ AC_DEFUN([_MY_CXX_CHECK_OPT], [# _MY_CXX_CHECK_OPT(flag) -- Check if compiler supports specific options ACO_SAVE_CXXFLAGS="$CXXFLAGS" # -Werror needed otherwise unknown -Wno-div-by-zero won't report problems - CXXFLAGS="$CXXFLAGS $1 -Werror" - AC_MSG_CHECKING([whether $CXX accepts $1]) + CXXFLAGS="$CXXFLAGS $2 -Werror" + AC_MSG_CHECKING([whether $CXX accepts $2]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([],[])], [_my_result=yes], [_my_result=no]) AC_MSG_RESULT($_my_result) if test "$_my_result" = "yes" ; then - CFG_CXXFLAGS_NO_UNUSED="$CFG_CXXFLAGS_NO_UNUSED $1" + $1="$$1 $2" fi CXXFLAGS="$ACO_SAVE_CXXFLAGS" ])# _MY_CXX_CHECK_OPT +# Flags for compiling Verilator internals including parser +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-char-subscripts) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Qunused-arguments) +AC_SUBST(CFG_CXXFLAGS_SRC) + +# Flags for compiling Verilator parser +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-unused) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-parentheses-equality) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-null-conversion) +AC_SUBST(CFG_CXXFLAGS_PARSER) + +# Flags for Verilated makefile # For example, -Wno-div-by-zero isn't in 4.1.2 -_MY_CXX_CHECK_OPT(-Wno-char-subscripts) -_MY_CXX_CHECK_OPT(-Wno-parentheses-equality) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-char-subscripts) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-parentheses-equality) # Random code often does / 0. Unfortunately VL_DIV_I(0,0) will warn # without this flag, even though there's a conditional to prevent the divide. # We still don't add no-div-by-zero as it throws message to stdout, though doesn't die. #_MY_CXX_CHECK_OPT(-Wno-div-by-zero) -_MY_CXX_CHECK_OPT(-Wno-sign-compare) -_MY_CXX_CHECK_OPT(-Wno-uninitialized) -_MY_CXX_CHECK_OPT(-Wno-unused-but-set-variable) -_MY_CXX_CHECK_OPT(-Wno-unused-parameter) -_MY_CXX_CHECK_OPT(-Wno-unused-variable) -_MY_CXX_CHECK_OPT(-fbracket-depth=4096) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-sign-compare) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-uninitialized) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-unused-but-set-variable) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-unused-parameter) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Wno-unused-variable) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-fbracket-depth=4096) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-Qunused-arguments) AC_SUBST(CFG_CXXFLAGS_NO_UNUSED) # Checks for library functions. diff --git a/include/verilated.cpp b/include/verilated.cpp index 4129d1527..37699000b 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -909,7 +909,7 @@ IData VL_SSCANF_IWX(int lbits, WDataInP lwp, const char* formatp, ...) { va_end(ap); return got; } -IData VL_SSCANF_INX(int lbits, const string& ld, const char* formatp, ...) { +IData VL_SSCANF_INX(int, const string& ld, const char* formatp, ...) { va_list ap; va_start(ap,formatp); IData got = _vl_vsscanf(NULL, ld.length()*8, NULL, ld, formatp, ap); diff --git a/include/verilated_heavy.h b/include/verilated_heavy.h index 12e9c42c7..79558fc8a 100644 --- a/include/verilated_heavy.h +++ b/include/verilated_heavy.h @@ -51,7 +51,7 @@ inline string VL_CVT_PACK_STR_NI(IData lhs) { inline string VL_CONCATN_NNN(const string& lhs, const string& rhs) { return lhs+rhs; } -inline string VL_REPLICATEN_NNQ(int,int,int rbits, const string& lhs, IData rep) { +inline string VL_REPLICATEN_NNQ(int,int,int, const string& lhs, IData rep) { string out; out.reserve(lhs.length() * rep); for (unsigned times=0; timesisTop()) puts("/// Trace signals in the model; called by application code\n"); puts("void trace (VerilatedVcdC* tfp, int levels, int options=0);\n"); + if (modp->isTop() && optSystemC()) { + puts("/// SC tracing; avoid overloaded virtual function lint warning\n"); + puts("virtual void trace (sc_trace_file* tfp) const { ::sc_core::sc_module::trace(tfp); }\n"); + } } puts("\n// USER METHODS\n");