Bug 157664 - Drop operator !=, where respective operator == is defined
Summary: Drop operator !=, where respective operator == is defined
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0 target:24.8.0
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2023-10-09 08:31 UTC by Mike Kaganski
Modified: 2024-03-23 10:17 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 Mike Kaganski 2023-10-09 08:31:54 UTC
In C++20, operator != is auto-generated, when operator == is present. It means that the explicit declaration/definition of operator != is useless; and in cases where the definition is not a trivial call of negated operator ==, it is also a maintenance burden - meaning that every time operator == is modified (e.g., as a result of adding new members), the operator != needs a corresponding change.

The codebase uses C++20 since commit 1eef07805021b7ca26a1a8894809b6d995747ba1.

This easyhack is about finding all operator != instances, and removing those that have corresponding operator ==.

In some cases, there is no corresponding operator == - e.g., in case where the operator != was added explicitly to enable use of the class in an algorithm. In these cases, the class should not change.

In some cases, the removal of operator != would break code that explicitly calls operator !=. In these cases, the calling code needs to be changed to call operator ==, or something similar.

In some cases, such a removal can not compile, because of problems in corresponding operator ==. E.g., such an operator can be non-const; and automatically generated operator != is always const, so it can't use a non-const operator ==. The compilation failures in this case could be cryptic.

This is an easyhack that can be worked on in parallel. Please don't do a large-scale change over the whole codebase; only change one or two files at a time. Do not assign this issue to you, because of the parallel nature of the task.
Comment 1 Commit Notification 2023-11-03 06:48:47 UTC
Ankit_Jaipuriar committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/47e06b18ede70f3496bc7da97e1761fe1dbf629c

tdf#157664 Drop operator !=, where respective operator == is defined

It will be available in 24.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 2 Commit Notification 2024-01-21 03:46:44 UTC
AkshayWarrier committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/dad0ea5c75445dc8ca316c4e5af1a9d6875699c1

tdf#157664 Drop operator != where respective == is defined

It will be available in 24.8.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2024-02-09 03:11:53 UTC
Rafał Dobrakowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3d2134c0116bc563d366f8cf23aae51de1e53938

tdf#157664 Drop operator !=, where respective operator == is defined

It will be available in 24.8.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2024-03-11 04:40:12 UTC
Tuukka Orava committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c5bb6b0972f8f03b6c9d397d2d0f16c154c58e1c

tdf#157664 Drop operator != where respective operator == is defined

It will be available in 24.8.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2024-03-23 10:17:51 UTC
RMZeroFour committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/64a55911eae1cf5f913f07b45a7c8379b325e471

tdf#157664 Drop redundant operator != in basegfx module

It will be available in 24.8.0.

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

Affected users are encouraged to test the fix and report feedback.