Bug 97499 - EasyHack: Clean up default arguments in uses of C++ unordered containers
Summary: EasyHack: Clean up default arguments in uses of C++ unordered containers
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Marian Scerbak
URL:
Whiteboard: ToBeReviewed target:5.2.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2016-02-02 10:11 UTC by Stephan Bergmann
Modified: 2017-02-14 08:57 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Bergmann 2016-02-02 10:11:20 UTC
The standard C++ unordered containers (like std::unordered_map) have additional template parameters Hash and Pred that default to std::hash<Key> and std::equal_to<Key>, respectively.

So these can be removed where they are redundantly specified in the code base, as in

> --- a/include/comphelper/numberedcollection.hxx
> +++ b/include/comphelper/numberedcollection.hxx
> @@ -61,9 +61,7 @@ class COMPHELPER_DLLPUBLIC NumberedCollection : private ::cppu::BaseMutex
>  
>          typedef std::unordered_map<
>                      long,
> -                    TNumberedItem,
> -                    ::std::hash<long>,
> -                    ::std::equal_to< long > > TNumberedItemHash;
> +                    TNumberedItem > TNumberedItemHash;
>  
>          typedef ::std::vector< long > TDeadItemList;
>
Comment 1 Robinson Tryon (qubit) 2016-02-18 14:51:24 UTC Comment hidden (obsolete)
Comment 2 Commit Notification 2016-03-07 12:53:27 UTC
Jaskaran committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=00ecf7899a97d09ecf4a8b6d81b10e1f66903f5a

tdf#97499 Remove some Default arguments in unordered container

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Pratishta 2016-03-11 17:29:05 UTC
Has this bug been fixed or can I try to work on this?
Comment 4 jani 2016-03-11 17:48:20 UTC
(In reply to Pratishta from comment #3)
> Has this bug been fixed or can I try to work on this?

I suggest you look yourself to see if there are more places, I suspect there are.
Comment 5 Marian Scerbak 2016-03-29 20:29:46 UTC
Looks like abandoned bug. Maybe I can pick it up, as a first task here. Do you agree?


(In reply to jan iversen from comment #4)
> (In reply to Pratishta from comment #3)
> > Has this bug been fixed or can I try to work on this?
> 
> I suggest you look yourself to see if there are more places, I suspect there
> are.
Comment 6 Stephan Bergmann 2016-03-30 07:03:15 UTC
(In reply to Marian Scerbak from comment #5)
> Looks like abandoned bug. Maybe I can pick it up, as a first task here. Do
> you agree?

Yes.  Look if you find places that can be updated, and if yes, send a patch to gerrit.
Comment 7 Commit Notification 2016-04-04 05:47:06 UTC
tymyjan committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=362ab03eb276fd7cf73a6882faa4e4f14fcab2a4

tdf#97499 Fixed containers parameters clearing #2

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2016-04-04 05:49:48 UTC
tymyjan committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=bfb9612226314cd037c8eda30cc6ebbb46dc8512

tdf#97499 Fixed containers parameters clearing #3

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2016-04-04 05:52:24 UTC
tymyjan committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c20cc7e79b3b3d8bcf9136bfdc2bab6dd6a4be06

tdf#97499 Fixed containers parameters clearing #4

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2016-04-15 21:36:22 UTC
tymyjan committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e2e35d56abc29f86b5f77e195a06a93caa3c60b0

tdf#97499 Fixed containers parameters clearing #5

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Marian Scerbak 2016-04-16 17:23:31 UTC
Have somebody found any others additional parameters for unordered containers which I can remove?
Comment 12 jani 2016-04-25 07:27:06 UTC
It seems there are nothing more to solve, if wrong please give a hint to where the missing parts are.
Comment 13 Stephan Bergmann 2016-04-25 08:35:30 UTC
(In reply to jan iversen from comment #12)
> It seems there are nothing more to solve, if wrong please give a hint to
> where the missing parts are.

For example, grepping the output of

  git grep -A3 unordered_

for "equal_to" still gives a handful of occurrences.
Comment 14 Marian Scerbak 2016-04-27 19:35:16 UTC
Yes, you are right. However, I tried to clean also those files you found, but they weren't verified, e.g. http://ci.libreoffice.org/job/lo_gerrit_master/14282/. So left this occurrences as it was in order to avoid failure during build (even build on my PC was ok) and I thought that they are not possible to change. 

But today I have tried do it again with few files, and build was successful for all platforms.
Comment 15 Commit Notification 2016-04-28 07:29:04 UTC
tymyjan committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6dbcebab6d6b82bed03dae2aedf774b7a4e9841e

tdf#97499 Fixed containers parameters clearing #6

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2016-04-28 07:29:08 UTC
tymyjan committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=12694155608762056d5cbf0f89dd1675a7aefb45

tdf#97499 Fixed containers parameters clearing #7

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2016-05-01 10:10:08 UTC
tymyjan committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8e4ee4bc68be0fd75636466864b3f6e2716b2748

tdf#97499 Fixed containers parameters clearing #9

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2016-05-01 10:13:07 UTC
tymyjan committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3acbc64869877868d30f7e1b8e5254282aed27f7

tdf#97499 Fixed containers parameters clearing #8

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Stephan Bergmann 2016-05-02 07:09:04 UTC
(In reply to Stephan Bergmann from comment #13)
> For example, grepping the output of
> 
>   git grep -A3 unordered_
> 
> for "equal_to" still gives a handful of occurrences.

This at least turns up no more occurrences now, so consider this easy hack done.  Thanks to all who worked on it!