KDE/kdevelop/languages/cpp

Andreas Pakulat apaku at gmx.de
Thu Mar 19 07:31:38 UTC 2009


On 18.03.09 23:30:23, Andrew Coles wrote:
> SVN commit 941152 by coles:
> 
> Fixed a whole bunch of compiler warnings of various degrees of concern.
> --- trunk/KDE/kdevelop/languages/cpp/codegen/simplerefactoring.cpp #941151:941152
> @@ -116,12 +116,13 @@
>    if(action) {
>      ProjectBaseItem* item = action->data().value<ProjectBaseItem*>();
>      KUrl url;
> -    ProjectFolderItem* folder;
> +    ProjectFolderItem* folder = 0;
>      if(item->folder()) {
>        folder=item->folder();
>      } else if(item->target()) {
>        folder=static_cast<ProjectBaseItem*>(item->parent())->folder();
>      }
> +    Q_ASSERT(folder);
>      CppNewClass newClassWizard(qApp->activeWindow(), folder->url());

Didn't we agree that this code should be rewritten so it doesn't need the
folder? Because folder might actually be 0.


> --- trunk/KDE/kdevelop/languages/cpp/cppduchain/templatedeclaration.cpp #941151:941152
> @@ -507,9 +507,11 @@
>  
>        foreach(Declaration* decl, context->localDeclarations())
>        {
> +#ifdef QT_DEBUG
>          TemplateDeclaration* tempDecl = dynamic_cast<TemplateDeclaration*>(decl);
>          Q_ASSERT(tempDecl);
>  //         tempDecl->instantiate(parameterInstantiationInformation, source, true);
> +#endif

We already said that stuff like this is not acceptable, it uglifies the
code for the very minor reason of having 1 warning less for unused
variables.

BTW: Somebody still needs to revert the patch to the platform.

> @@ -1006,8 +1008,11 @@
>  
>    Declaration* clone = decl->clone();
>    Q_ASSERT(clone);
> +
> +#ifdef QT_DEBUG
>    TemplateDeclaration* cloneTemplateDecl = dynamic_cast<TemplateDeclaration*>(clone);
>    Q_ASSERT(cloneTemplateDecl);
> +#endif

Same here.
  
> -  int kind = editor()->parseSession()->token_stream->kind(node->class_key);
> +  /*int kind = */editor()->parseSession()->token_stream->kind(node->class_key);

Hmm, why not simply remove the variable if its not used? (IIRC there's
another such case in the original patch further up - which I already
deleted here).

Also I think you should start posting your patches to our development
mailinglist via reviewboard.kde.org and not commit to code you've never
touched before, even if its just about fixing warnings from gcc.

Andreas

-- 
Tonight you will pay the wages of sin; Don't forget to leave a tip.




More information about the KDevelop-devel mailing list