r216267 - Fixing MSVC warning: "warning C4373: 'blah': virtual function overrides 'blah', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers."

David Blaikie dblaikie at gmail.com
Fri Aug 22 10:50:07 PDT 2014


On Fri, Aug 22, 2014 at 6:26 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> Author: aaronballman
> Date: Fri Aug 22 08:26:37 2014
> New Revision: 216267
>
> URL: http://llvm.org/viewvc/llvm-project?rev=216267&view=rev
> Log:
> Fixing MSVC warning: "warning C4373: 'blah': virtual function overrides 'blah', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers."
>
> This warning is basically useless because the "previous versions" being referred to is MSVC 2005 and earlier, and we obviously do not care about them. However, this warning isn't particularly chatty (I don't recall ever seeing it previously), and it has the opportunity to point out cases where the cv-qualifiers differ unintentionally (like this case), so I am leaving it enabled for now.

I'll put in a vote to disable it - the mismatch isn't at all
important. It's an implementation detail - if someone wants to make
their parameters locally const to ensure they don't accidentally
modify them, that's OK.

(but, I agree - I doubt anyone made the conscious choice to do that in
this instance - probably just muscle memory of "const char"[*])

One fewer thing to have the MSVC build break because of.

>
> Modified:
>     cfe/trunk/lib/Basic/Targets.cpp
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=216267&r1=216266&r2=216267&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 22 08:26:37 2014
> @@ -4146,8 +4146,7 @@ public:
>      return R;
>    }
>    bool
> -  validateConstraintModifier(StringRef Constraint, const char Modifier,
> -                             unsigned Size,
> +  validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size,
>                               std::string &SuggestedModifier) const override {
>      bool isOutput = (Constraint[0] == '=');
>      bool isInOut = (Constraint[0] == '+');
> @@ -4595,8 +4594,7 @@ public:
>    }
>
>    bool
> -  validateConstraintModifier(StringRef Constraint, const char Modifier,
> -                             unsigned Size,
> +  validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size,
>                               std::string &SuggestedModifier) const override {
>      // Strip off constraint modifiers.
>      while (Constraint[0] == '=' || Constraint[0] == '+' || Constraint[0] == '&')
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list