Skip to content

fix(clang-cl): reduce warnings #900

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,12 @@ if (WIN32)
target_compile_options(
mrdocs-core
PUBLIC
/permissive- # strict C++
/W4 # enable all warnings
/MP # multi-processor compilation
/EHs # C++ Exception handling
$<$<CONFIG:Debug>:/Oy-> # Disable frame pointer omission
/permissive- # strict C++
/W4 # enable all warnings
$<$<CXX_COMPILER_ID:MSVC>:/MP> # multi-processor compilation
/EHs # C++ Exception handling
$<$<CONFIG:Debug>:/Oy-> # Disable frame pointer omission
$<$<CXX_COMPILER_ID:Clang>:-Wno-unused-parameter> # ClangCL warning enabled with /W4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we fix the code triggering the warning instead of disabling the warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a separate commit now. I initially added this because the warnings weren't present in the output of GCC and Clang on macOS/Linux.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. At some point we have to enable all these warnings there too. It's just that the project started without the these warnings and we always have higher priority stuff to work on.

)
endif()
endif ()
Expand Down
2 changes: 1 addition & 1 deletion include/mrdocs/Metadata/Info/Friend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ merge(FriendInfo& I, FriendInfo&& Other);
template <class IO>
void
tag_invoke(
dom::LazyObjectMapTag t,
dom::LazyObjectMapTag,
IO& io,
FriendInfo const& I,
DomCorpus const* domCorpus)
Expand Down
2 changes: 1 addition & 1 deletion include/mrdocs/Metadata/Javadoc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ void merge(Javadoc& I, Javadoc&& other)
template <class IO>
void
tag_invoke(
dom::LazyObjectMapTag t,
dom::LazyObjectMapTag,
IO& io,
Javadoc const& I,
DomCorpus const* domCorpus)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Lib/CorpusImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ findFirstParentInfo(
MRDOCS_CHECK_OR(contextUniquePtr, SymbolID::invalid);
auto& context = *contextUniquePtr;
bool const isParent = visit(context, []<typename InfoTy>(
InfoTy const& I) -> bool
InfoTy const&) -> bool
{
return InfoParent<InfoTy>;
});
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Metadata/Finalizers/Javadoc/Function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ innermostTypenameString(Polymorphic<TypeInfo> const& T)
}

bool
populateFunctionBriefFromClass(FunctionInfo& I, CorpusImpl const& corpus)
populateFunctionBriefFromClass(FunctionInfo& I)
{
switch (I.Class)
{
Expand Down Expand Up @@ -237,10 +237,10 @@ populateFunctionBriefFromOperator(FunctionInfo& I)
}

void
populateFunctionBrief(FunctionInfo& I, CorpusImpl const& corpus)
populateFunctionBrief(FunctionInfo& I)
{
MRDOCS_CHECK_OR(!I.javadoc->brief);
MRDOCS_CHECK_OR(!populateFunctionBriefFromClass(I, corpus));
MRDOCS_CHECK_OR(!populateFunctionBriefFromClass(I));
MRDOCS_CHECK_OR(!populateFunctionBriefFromOperator(I));
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/Metadata/Finalizers/JavadocFinalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ populateFunctionJavadoc(FunctionInfo& I) const
}

// Populate a missing javadoc brief
populateFunctionBrief(I, corpus_);
populateFunctionBrief(I);

// Populate a missing javadoc returns
populateFunctionReturns(I, corpus_);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Support/Handlebars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2144,7 +2144,7 @@ parseBlock(
HandlebarsOptions const& opt,
detail::RenderState const& state,
std::string_view &templateText,
OutputRef &out,
OutputRef &,
std::string_view &fnBlock,
std::string_view &inverseBlocks,
Handlebars::Tag &inverseTag,
Expand Down Expand Up @@ -3664,7 +3664,7 @@ each_fn(dom::Value context, dom::Value const& options)
{
dom::Value priorKey;
auto exp = context.getObject().visit([&](
dom::String const& key, dom::Value const& value) -> Expected<void>
dom::String const& key, dom::Value const&) -> Expected<void>
{
if (!priorKey.isUndefined())
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Support/LegibleNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class LegibleNames::Impl
If the symbolhas no name, then a reserved name based
on the type is returned instead.
*/
std::string_view
std::string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

getRawUnqualified(SymbolID const& id)
{
Info const* I = corpus_.find(id);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Support/Lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static
void
luaM_report(
Error const& err,
source_location loc =
source_location =
source_location::current())
{
SourceLocation Loc(err.location());
Expand Down Expand Up @@ -605,7 +605,7 @@ domValue_push(
static
char const*
Reader(
lua_State *L,
lua_State *,
void* data,
size_t* size)
{
Expand Down Expand Up @@ -675,7 +675,7 @@ Expected<Value>
Scope::
getGlobal(
std::string_view key,
source_location loc)
source_location)
{
Access A(*this);
lua_pushglobaltable(A);
Expand Down
7 changes: 3 additions & 4 deletions src/test/ADT/Polymorphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ struct Polymorphic_test
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
#if defined(__GNUC__)
#pragma clang diagnostic ignored "-Wself-move"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wself-move"
#endif
Expand All @@ -255,8 +255,7 @@ struct Polymorphic_test
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#if defined(__GNUC__)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

Expand Down
10 changes: 5 additions & 5 deletions src/test/lib/Support/Handlebars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3863,7 +3863,7 @@ helpers()
// pathed lambas with parameters
{
dom::Object hash;
dom::Function helper = dom::makeInvocable([](dom::Value const& arg) {
dom::Function helper = dom::makeInvocable([](dom::Value const&) {
return dom::Value("winning");
});
hash.set("helper", helper);
Expand Down Expand Up @@ -4457,7 +4457,7 @@ helpers()
// should take precedence over helper values
{
std::string string = "{{#goodbyes as |value|}}{{value}}{{/goodbyes}}{{value}}";
hbs.registerHelper("value", [](dom::Value const& options) {
hbs.registerHelper("value", [](dom::Value const&) {
return "foo";
});
hbs.registerHelper("goodbyes", [](dom::Value const& options) {
Expand Down Expand Up @@ -4668,8 +4668,8 @@ track_ids()
hbs.registerHelper("wycats", [](
dom::Value const& passiveVoice,
dom::Value const& noun,
dom::Value const& thiz,
dom::Value const& thiz2,
dom::Value const&,
dom::Value const&,
dom::Value const& options) {
BOOST_TEST(options.get("ids").get(0) == "is.a");
BOOST_TEST(options.get("ids").get(1) == "../slave.driver");
Expand Down Expand Up @@ -4768,7 +4768,7 @@ track_ids()
hbs.registerHelper("wycats", [](
dom::Value const& passiveVoice,
dom::Value const& noun,
dom::Value const& blah,
dom::Value const&,
dom::Value const& options)
{
BOOST_TEST(options.get("ids").get(0) == "zomg.a");
Expand Down
2 changes: 1 addition & 1 deletion src/test_suite/test_suite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ int run(std::ostream& out)

// Simple main used to produce standalone
// executables that run unit tests.
int unit_test_main(int argc, char const* const* argv)
int unit_test_main(int, char const* const*)
{
#if 0
#if defined(_MSC_VER) && !defined(__clang__)
Expand Down
Loading