Home > OS >  Are there any good mappings between GCC and MSVC warnings? E.g. -Wredundant-move on MSVC
Are there any good mappings between GCC and MSVC warnings? E.g. -Wredundant-move on MSVC

Time:05-07

This question is somewhat two fold, one being more general than the other. The specific question is; does MSVC have equivalent warnings to -Wredundant-move? More generally, is there anywhere online, even if it's someone's blog, that has a reasonable mapping between GCC and MSVC warnings?

I'm aware that warnings don't have any requirement to be similar accross platforms, or even exist at all - that's why I'm interested to find out if there is any reasonable correlation?

For a small bit of background, I'm looking to enable specific -Werrors on a cross-platform project, and would prefer if each platform looked after roughly the same warnings instead of relying on the user to check on both platforms manually.

CodePudding user response:

The specific question is; does MSVC have equivalent warnings to -Wredundant-move?

From what I've found, no, MSVC doesn't.

This implicitly answers the more general question if there's a good mapping between gcc and MSVC warnings.

But - the future looks promising for the particular kind of warning you asked about:
Under Review - Pessimizing Move Compiler Warning:

"LLVM supports a pessimizing-move compiler warning. In C 17 and newer, this fires when invoking std::move() on a temporary, this results in copy elision not occurring on the temporary. This seems a high value warning that is supported in Clang and GCC, but not MSVC."

  • Related