Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2264: Add stricter warnings for apps that use them #2282

Merged
merged 21 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions ci/ctest_build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ build_dir=${2}
# Dependency versions, when fetched via git.
checkpoint_rev=develop

if test "${VT_DOXYGEN_ENABLED:-0}" -eq 1
then
token=${3}
else
target=${3:-install}
fi

export parallel_level=4
if [ -z ${4} ]; then
export dashj=""
Expand Down
19 changes: 6 additions & 13 deletions cmake/turn_on_warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,21 @@ endmacro()

if(NOT DEFINED VT_WARNING_FLAGS)
add_cxx_compiler_flag_if_supported("-Wall")
add_cxx_compiler_flag_if_supported("-pedantic")
add_cxx_compiler_flag_if_supported("-Wshadow")
add_cxx_compiler_flag_if_supported("-Wextra")
add_cxx_compiler_flag_if_supported("-Wno-unknown-pragmas")
add_cxx_compiler_flag_if_supported("-Wnon-virtual-dtor")
add_cxx_compiler_flag_if_supported("-Wshadow")
add_cxx_compiler_flag_if_supported("-Wsign-compare")
add_cxx_compiler_flag_if_supported("-Wsuggest-override")
add_cxx_compiler_flag_if_supported("-pedantic")
# Not really a warning, is still diagnostic related..
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL Intel OR
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021)
add_cxx_compiler_flag_if_supported("-ftemplate-backtrace-limit=100")
endif()

if (vt_werror_enabled) # Treat warning as errors
add_cxx_compiler_flag_if_supported("-Werror")
endif()

# Silence some spurious warnings on older compilers
if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6)
list(APPEND VT_WARNING_FLAGS -Wno-unused-variable)
endif()
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6)
list(APPEND VT_WARNING_FLAGS -Wno-missing-braces)
add_cxx_compiler_flag_if_supported("-Werror")
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion examples/callback/callback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct MyObj {
struct MyCol : vt::Collection<MyCol, vt::Index1D> { };

// Collection handler callback endpoint
void colHan(MyCol* col, TestMsg* msg) {
void colHan([[maybe_unused]] MyCol* col, [[maybe_unused]] TestMsg* msg) {
printOutput(msg, "MyCol colHan (non-intrusive)");
}

Expand Down
2 changes: 1 addition & 1 deletion examples/collection/jacobi1d_vt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ struct LinearPb1DJacobi : vt::Collection<LinearPb1DJacobi,vt::Index1D> {

}

void doIter(BlankMsg *msg) {
void doIter([[maybe_unused]] BlankMsg *msg) {

//
// Treat the particular case of 1 object
Expand Down
2 changes: 1 addition & 1 deletion examples/collection/jacobi2d_vt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ struct LinearPb2DJacobi : vt::Collection<LinearPb2DJacobi,vt::Index2D> {

}

void doIter(BlankMsg *msg) {
void doIter([[maybe_unused]] BlankMsg *msg) {

//
// Treat the particular case of 1 object
Expand Down
4 changes: 3 additions & 1 deletion examples/collection/lb_iter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ struct IterCol : vt::Collection<IterCol, vt::Index1D> {

static double weight = 1.0f;

void IterCol::iterWork(int64_t work_amt, int64_t iter, int subphase) {
void IterCol::iterWork(
int64_t work_amt, [[maybe_unused]] int64_t iter, int subphase
) {
this->lb_data_.setSubPhase(subphase);
double val = 0.1f;
double val2 = 0.4f * work_amt;
Expand Down
6 changes: 4 additions & 2 deletions examples/collection/transpose.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct Block : vt::Collection<Block, vt::Index1D> {
}
}

void solve(SolveMsg<Block>* msg) {
void solve([[maybe_unused]] SolveMsg<Block>* msg) {
// Invoke initialize here so that the index is ready
initialize();
// Wait for all initializations to complete
Expand All @@ -190,7 +190,9 @@ struct Block : vt::Collection<Block, vt::Index1D> {

//using ActiveMapTypedFnType = NodeType(IndexT*, IndexT*, NodeType);
template <typename IndexT>
vt::NodeType my_map(IndexT* idx, IndexT* max_idx, vt::NodeType num_nodes) {
vt::NodeType my_map(
IndexT* idx, [[maybe_unused]] IndexT* max_idx, vt::NodeType num_nodes
) {
// simple round-robin for 1-d only.
return idx->x() % num_nodes;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/group/group_collective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/// [Collective group creation]
struct HelloGroupMsg : vt::Message { };

static void hello_group_handler(HelloGroupMsg* msg) {
static void hello_group_handler([[maybe_unused]] HelloGroupMsg* msg) {
fmt::print("{}: Hello from group handler\n", vt::theContext()->getNode());
}

Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/hello_world_functor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct MultipleFunctions {
fmt::print("{}: MultipleFunctions -> Hello from node {}\n", vt::theContext()->getNode(), msg->from);
}

void operator()(AnotherMsg* msg) const {
void operator()([[maybe_unused]] AnotherMsg* msg) const {
fmt::print("{}: MultipleFunctions with AnotherMsg\n", vt::theContext()->getNode());
}
};
Expand Down
2 changes: 1 addition & 1 deletion examples/rdma/rdma_simple_get.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static void tell_handle(HandleMsg* msg) {
static std::unique_ptr<double[]> my_data = nullptr;

static vt::RDMA_GetType test_get_fn(
vt::BaseMessage*, vt::ByteType num_bytes, vt::ByteType offset, vt::TagType tag,
vt::BaseMessage*, vt::ByteType num_bytes, [[maybe_unused]] vt::ByteType offset, vt::TagType tag,
bool
) {
vt::NodeType this_node = vt::theContext()->getNode();
Expand Down
6 changes: 2 additions & 4 deletions src/vt/collective/barrier/barrier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ Barrier::BarrierStateType& Barrier::insertFindBarrier(
return iter->second;
}

void Barrier::removeBarrier(
bool const& is_named, bool const& is_wait, BarrierType const& barrier
) {
void Barrier::removeBarrier(bool const& is_named, BarrierType const& barrier) {
auto& state = is_named ? named_barrier_state_ : unnamed_barrier_state_;

auto iter = state.find(barrier);
Expand Down Expand Up @@ -145,7 +143,7 @@ void Barrier::waitBarrier(
"waitBarrier: released: named={}, barrier={}\n", is_named, barrier
);

removeBarrier(is_named, is_wait, barrier);
removeBarrier(is_named, barrier);
}

void Barrier::contBarrier(
Expand Down
3 changes: 1 addition & 2 deletions src/vt/collective/barrier/barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ struct Barrier : virtual collective::tree::Tree {
* \internal \brief Remove the state of a barrier
*
* \param[in] is_named whether the barrier is named
* \param[in] is_wait whether the barrier is of waiting type
* \param[in] barrier the barrier ID
*/
void removeBarrier(
bool const& is_named, bool const& is_wait, BarrierType const& barrier
bool const& is_named, BarrierType const& barrier
);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/vt/collective/basic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void abort(std::string const str, int32_t const code) {
}

void output(
std::string const str, int32_t const code, bool error, bool formatted,
std::string const& str, int32_t const code, bool error, bool formatted,
bool decorate, bool abort_out
) {
#if !vt_check_enabled(trace_only)
Expand Down
2 changes: 1 addition & 1 deletion src/vt/collective/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace vt {

void abort(std::string const str = "", int32_t const code = 1);
void output(
std::string const str, int32_t const code = 1, bool error = false,
std::string const& str, int32_t const code = 1, bool error = false,
bool decorate = true, bool formatted = false, bool abort_out = false
);
int rerror(char const* str);
Expand Down
2 changes: 1 addition & 1 deletion src/vt/collective/reduce/operators/callback_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace vt { namespace collective { namespace reduce { namespace operators {

template <typename T = void>
struct ReduceCallback {
void operator()(T* t) const { /* do nothing */ }
void operator()([[maybe_unused]] T* t) const { /* do nothing */ }
};

}}}} /* end namespace vt::collective::reduce::operators */
Expand Down
2 changes: 1 addition & 1 deletion src/vt/collective/reduce/operators/functors/none_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct None {
"Must be empty data"
);

void operator()(T& v1, T const& v2) {}
void operator()([[maybe_unused]] T& v1, [[maybe_unused]] T const& v2) {}
};

}}}} /* end namespace vt::collective::reduce::operators */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ struct ApplyOp<Op, cur, max, std::enable_if_t<cur != max>> {
template <typename Op, int cur, int max>
struct ApplyOp<Op, cur, max, std::enable_if_t<cur == max>> {
template <typename Tuple1, typename Tuple2>
static void apply(Tuple1& t1, Tuple2 const& t2) { }
static void apply(
[[maybe_unused]] Tuple1& t1, [[maybe_unused]] Tuple2 const& t2
) { }
};

//
Expand Down
9 changes: 7 additions & 2 deletions src/vt/configs/arguments/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,10 @@ void addRuntimeArgs(CLI::App& app, AppConfig& appConfig) {
a3->group(configRuntime);
}

void addThreadingArgs(CLI::App& app, AppConfig& appConfig) {
void addThreadingArgs(
[[maybe_unused]] CLI::App& app,
[[maybe_unused]] AppConfig& appConfig
) {
#if (vt_feature_fcontext != 0)
auto ult_disable = "Disable running handlers in user-level threads";
auto stack_size = "The default stack size for user-level threads";
Expand All @@ -702,7 +705,9 @@ ArgConfig::construct(std::unique_ptr<ArgConfig> arg) {

class VtFormatter : public CLI::Formatter {
public:
std::string make_usage(const CLI::App *, std::string name) const override {
std::string make_usage(
const CLI::App *, [[maybe_unused]] std::string name
) const override {
std::stringstream u;
u << "\n"
"Usage:"
Expand Down
2 changes: 1 addition & 1 deletion src/vt/configs/error/assert_out.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
assertOut(
bool fail, std::string const cond, std::string const& str,
std::string const& file, int const line, std::string const& func,
ErrorCodeType error, std::tuple<Args...>&& tup
ErrorCodeType error, [[maybe_unused]] std::tuple<Args...>&& tup
) {
auto msg = "Assertion failed:";
auto assert_fail_str = stringizeMessage(msg,str,cond,file,line,func,error);
Expand Down
3 changes: 2 additions & 1 deletion src/vt/configs/error/assert_out_info.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
assertOutInfo(
bool fail, std::string const cond, std::string const& str,
std::string const& file, int const line, std::string const& func,
ErrorCodeType error, std::tuple<Args2...>&& tup, std::tuple<Args...>&& t2
ErrorCodeType error, [[maybe_unused]] std::tuple<Args2...>&& tup,
std::tuple<Args...>&& t2
) {
return assertOut(
fail,cond,str,file,line,func,error,std::forward<std::tuple<Args...>>(t2)
Expand Down
6 changes: 4 additions & 2 deletions src/vt/configs/error/error.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ namespace vt { namespace error {
template <typename... Args>
inline
std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
display(std::string const& str, ErrorCodeType error, Args&&... args) {
display(
std::string const& str, ErrorCodeType error, [[maybe_unused]] Args&&... args
) {
std::string const inf = ::fmt::format("FATAL ERROR: {}\n",str);
return ::vt::abort(inf,error);
}
Expand All @@ -81,7 +83,7 @@ std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
displayLoc(
std::string const& str, ErrorCodeType error,
std::string const& file, int const line, std::string const& func,
std::tuple<Args...>&& tup
[[maybe_unused]] std::tuple<Args...>&& tup
) {
auto msg = "vtAbort() Invoked";
auto const inf = debug::stringizeMessage(msg,str,"",file,line,func,error);
Expand Down
2 changes: 1 addition & 1 deletion src/vt/configs/error/soft_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ inline std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
warningImpl(
std::string const& str, ErrorCodeType error, bool quit,
std::string const& file, int const line, std::string const& func,
Args&&... args
[[maybe_unused]] Args&&... args
) {
auto msg = "vtWarn() Invoked";
auto inf = debug::stringizeMessage(msg,str,"",file,line,func,error);
Expand Down
12 changes: 0 additions & 12 deletions src/vt/configs/error/stack_out.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ DumpStackType dumpStack(int skip) {
for (auto i = skip; i < num_frames; i++) {
//printf("%s\n", symbols[i]);

std::string str = "";
Dl_info info;
if (dladdr(callstack[i], &info) && info.dli_sname) {
char *demangled = nullptr;
Expand All @@ -140,24 +139,13 @@ DumpStackType dumpStack(int skip) {
)
);

auto const& t = stack.back();
str = fmt::format(
"{:<4} {:<4} {:<15} {} + {}\n",
i, std::get<0>(t), std::get<1>(t), std::get<2>(t), std::get<3>(t)
);

std::free(demangled);
} else {
stack.emplace_back(
std::forward_as_tuple(
static_cast<int>(2 + sizeof(void*) * 2), reinterpret_cast<long>(callstack[i]), symbols[i], 0
)
);

auto const& t = stack.back();
str = fmt::format(
"{:10} {} {} {}\n", i, std::get<0>(t), std::get<1>(t), std::get<2>(t)
);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/vt/context/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct RunnableNew {};

namespace vt { namespace ctx {

Context::Context(bool const is_interop, MPI_Comm comm) {
Context::Context([[maybe_unused]] bool const is_interop, MPI_Comm comm) {
#if DEBUG_VT_CONTEXT
fmt::print(
"Context::Context is_interop={}, comm={}\n", print_bool(is_interop), comm
Expand Down
2 changes: 1 addition & 1 deletion src/vt/context/runnable_context/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct Trace {
struct Trace {

template <typename... Args>
Trace(Args&&... args) {}
Trace(Args&&...) {}

};

Expand Down
2 changes: 1 addition & 1 deletion src/vt/event/event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void AsyncEvent::finalize() {
event_container_.clear();
}

int AsyncEvent::progress(TimeType current_time) {
int AsyncEvent::progress([[maybe_unused]] TimeType current_time) {
theEvent()->testEventsTrigger();
return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions src/vt/group/base/group_info_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ struct InfoBase {
using TreeType = collective::tree::Tree;
using TreePtrType = std::unique_ptr<TreeType>;

virtual ~InfoBase() = default;

protected:
virtual GroupType getGroupID() const = 0;
virtual ActionType getAction() const = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/vt/group/collective/group_info_collective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void InfoColl::setupCollective() {
);
GroupOnlyTMsg::registerContinuationT(
new_tree_cont_,
[group_](MsgSharedPtr<GroupOnlyMsg> msg){
[group_]([[maybe_unused]] MsgSharedPtr<GroupOnlyMsg> msg){
auto iter = theGroup()->local_collective_group_info_.find(group_);
vtAssertExpr(iter != theGroup()->local_collective_group_info_.end());
auto const& from = theContext()->getFromNodeCurrentTask();
Expand Down Expand Up @@ -766,7 +766,7 @@ void InfoColl::finalizeTree(GroupOnlyMsg* msg) {
finalize();
}

void InfoColl::downTreeFinished(GroupOnlyMsg* msg) {
void InfoColl::downTreeFinished([[maybe_unused]] GroupOnlyMsg* msg) {
send_down_finished_++;
finalize();
}
Expand Down
2 changes: 2 additions & 0 deletions src/vt/group/collective/group_info_collective.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ struct InfoColl : virtual InfoBase {
{
}

virtual ~InfoColl() = default;

private:
/*
* Inner struct used as functor reduce target after the collective group is
Expand Down
Loading
Loading