Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[modernize] use-equals-default #16669

Merged
merged 1 commit into from Sep 26, 2019
Merged

Conversation

Rechi
Copy link
Member

@Rechi Rechi commented Sep 24, 2019

Description

run clang-tidy modernize-use-equals-default and applied the suggested fixes

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@Rechi Rechi added Type: Improvement non-breaking change which improves existing functionality v19 Matrix labels Sep 24, 2019
@Rechi Rechi added this to the Matrix 19.0-alpha 1 milestone Sep 24, 2019
@ksooo
Copy link
Member

ksooo commented Sep 24, 2019

Moving default/empty ctors/dtors/... from cpp to h can have side effects (compiler errors), because you make the ctors/dtors/... inline with this.

@notspiff
Copy link
Contributor

yes, it can have consequences, in particular if you have forwarded members.

@ksooo
Copy link
Member

ksooo commented Sep 24, 2019

What I said! Look at Jenkins' state.

@ksooo
Copy link
Member

ksooo commented Sep 24, 2019

14:34:31 /Applications/Xcode10.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2331:19: error: invalid application of 'sizeof' to an incomplete type 'ADDON::CBinaryAddonCache'
14:34:31     static_assert(sizeof(_Tp) > 0,
14:34:31                   ^~~~~~~~~~~
14:34:31 /Applications/Xcode10.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2648:7: note: in instantiation of member function 'std::__1::default_delete<ADDON::CBinaryAddonCache>::operator()' requested here
14:34:31       __ptr_.second()(__tmp);
14:34:31       ^
14:34:31 /Applications/Xcode10.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2602:19: note: in instantiation of member function 'std::__1::unique_ptr<ADDON::CBinaryAddonCache, std::__1::default_delete<ADDON::CBinaryAddonCache> >::reset' requested here
14:34:31   ~unique_ptr() { reset(); }
14:34:31                   ^
14:34:31 /Users/Shared/jenkins/workspace/OSX-64/xbmc/ServiceManager.h:77:3: note: in instantiation of member function 'std::__1::unique_ptr<ADDON::CBinaryAddonCache, std::__1::default_delete<ADDON::CBinaryAddonCache> >::~unique_ptr' requested here
14:34:31   CServiceManager() = default;
14:34:31   ^
14:34:31 /Users/Shared/jenkins/workspace/OSX-64/xbmc/ServiceBroker.h:16:7: note: forward declaration of 'ADDON::CBinaryAddonCache'
14:34:31 class CBinaryAddonCache;

I dont think it is good to include the header for CBinaryAddonCache in ServiceBroker.h.
I opt for CServiceManager ctor declaration in header and definition as default in cpp.

@notspiff
Copy link
Contributor

i totally agree, if the c/dtor need to be in cpp to avoid includes, that's what you do. just, if there is no reason, i prefer to see it in the header (cause that's what i look at to study classes, and the indirection to find = default in the cpp is then confusing (i expect an implementation in that case).

@ksooo
Copy link
Member

ksooo commented Sep 24, 2019

if the c/dtor need to be in cpp to avoid includes, that's what you do.

+1

just, if there is no reason, i prefer to see it in the header

+1

@Rechi Rechi force-pushed the modernize/use-equals-default branch from 5aea93c to 390825e Compare September 24, 2019 19:02
xbmc/AppParamParser.h Outdated Show resolved Hide resolved
@Rechi Rechi force-pushed the modernize/use-equals-default branch from 390825e to 4372ea9 Compare September 25, 2019 09:43
@Rechi
Copy link
Member Author

Rechi commented Sep 25, 2019

@ksooo @notspiff it now compiles on all platforms. I've moved the constructors and destructors back to the cpp files where it was required.

Is this now okay to get merged, after squashing?

@ksooo
Copy link
Member

ksooo commented Sep 25, 2019

Is this now okay to get merged, after squashing?

Fine by me.

@notspiff
Copy link
Contributor

notspiff commented Sep 25, 2019 via email

@Rechi Rechi force-pushed the modernize/use-equals-default branch from 4372ea9 to 7498e0b Compare September 25, 2019 21:13
@Rechi Rechi force-pushed the modernize/use-equals-default branch from 7498e0b to eecc666 Compare September 26, 2019 13:06
@Rechi Rechi merged commit f7c59fc into xbmc:master Sep 26, 2019
@Rechi Rechi deleted the modernize/use-equals-default branch September 26, 2019 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement non-breaking change which improves existing functionality v19 Matrix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants