D7876: Append project compiler arguments after arguments from build system anddisable warning as error

Kevin Funk noreply at phabricator.kde.org
Tue Sep 19 07:29:41 UTC 2017


kfunk added a comment.


  I've almost had the same patch locally. So +1 in general.
  
  I'm just wondering if we should rather append the "extraArguments" *after* the project-specific ones.  My idea: If e.g. the CMake manager dictates `-std=c++14`, with my patch this would be part of extraArguments and then the standard version in use by libclang.
  
  With your patch, we would use the `-std=...` argument used from the parser settings, which might not match what the user wants. IMO we should try to get everything working 'out of the box' as much as possible.
  
  For the record, my patch:
  
    diff --git a/plugins/custom-definesandincludes/definesandincludesmanager.cpp b/plugins/custom-definesandincludes/definesandincludesmanager.cpp
    index de317ae977..02b5f48f12 100644
    --- a/plugins/custom-definesandincludes/definesandincludesmanager.cpp
    +++ b/plugins/custom-definesandincludes/definesandincludesmanager.cpp
    @@ -356,16 +356,18 @@ QString DefinesAndIncludesManager::parserArguments(KDevelop::ProjectBaseItem* it
     
         Q_ASSERT(QThread::currentThread() == qApp->thread());
     
    +    auto cfg = item->project()->projectConfiguration().data();
    +    const auto parserArguments = findConfigForItem(m_settings->readPaths(cfg), item).parserArguments;
    +    auto arguments = argumentsForPath(item->path(), parserArguments);
    +
         auto buildManager = item->project()->buildSystemManager();
    -    if ( buildManager ) {
    -        const auto args = buildManager->extraArguments(item);
    -        if (!args.isEmpty())
    -            return args;
    +    if (buildManager) {
    +        const auto extraArguments = buildManager->extraArguments(item);
    +        if (!extraArguments.isEmpty())
    +            arguments += ' ' + extraArguments;
         }
     
    -    auto cfg = item->project()->projectConfiguration().data();
    -    const auto arguments = findConfigForItem(m_settings->readPaths(cfg), item).parserArguments;
    -    return argumentsForPath(item->path(), arguments);
    +    return arguments;
     }
     
     QString DefinesAndIncludesManager::parserArguments(const QString& path) const

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D7876

To: gracicot, #kdevelop, kfunk
Cc: kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170919/97ad55ce/attachment-0001.html>


More information about the KDevelop-devel mailing list