This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] C++0x, fixes for override/final


Hi!

Just small style nits:

On Tue, May 10, 2011 at 09:35:42AM +0300, Ville Voutilainen wrote:
> --- a/gcc/cp/class.c
> +++ b/gcc/cp/class.c
> @@ -2453,6 +2453,7 @@ get_basefndecls (tree name, tree t)
>  void
>  check_for_override (tree decl, tree ctype)
>  {
> +  int overrides_found = 0;

s/int/bool/;s/0/false/;s/1/true/
IMHO.

>    if (TREE_CODE (decl) == TEMPLATE_DECL)
>      /* In [temp.mem] we have:
>  
> @@ -2467,7 +2468,10 @@ check_for_override (tree decl, tree ctype)
>      /* Set DECL_VINDEX to a value that is neither an INTEGER_CST nor
>         the error_mark_node so that we know it is an overriding
>         function.  */
> -    DECL_VINDEX (decl) = decl;
> +    {
> +      DECL_VINDEX (decl) = decl;
> +      overrides_found = 1;
> +    }
>  
>    if (DECL_VIRTUAL_P (decl))
>      {

> +  else if (DECL_FINAL_P (decl))
> +        error ("%q+#D marked final, but is not virtual", decl);
> +  if (DECL_OVERRIDE_P (decl)
> +      && !overrides_found)

And the above condition is short enough that it could be on one line.

> +    error ("%q+#D marked override, but does not override", decl);
>  }
>  

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]