Download it now!
Bug 82088 - EasyHack: Clean up starutil namespace alias
Summary: EasyHack: Clean up starutil namespace alias
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.4.0.0.alpha0+ Master
Hardware: Other All
: medium normal
Assignee: Thomas Arnhold
URL:
Whiteboard: target:4.4.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2014-08-03 12:28 UTC by Thomas Arnhold
Modified: 2015-12-15 23:57 UTC (History)
2 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 Thomas Arnhold 2014-08-03 12:28:30 UTC
There is a namespace alias "starutil":

namespace starutil = ::com::sun::star::util;

find them:

git grep -w starutil

starutil should be replaced by "css::util" which is obvious to everyone.

For example:

starutil::Date should become css::util::Date

Please leave this EasyHack for real beginners!!! If you are one please feel free to catch it.
Comment 1 Stefan Weiberg 2014-08-28 06:42:21 UTC
It seems like someone already fixed all of the occurrences. I found one additional namespace alias "utl" for the same namespace and changed it (dbconversion.cxx).

In addition there are some other inconsistencies with namespace aliases for "::com::sun::star::util::NumberFormat" and "::com::sun::star::util::MeasureUnit" by sometimes using an alias and sometimes not using it. Shall I fix them as well?

As I am new to LibreOffice and C++ I'd like to offer my patch for this bug. Do I have to follow these steps (https://wiki.documentfoundation.org/Development/gerrit) after testing my changes?

Best regards, Stefan
Comment 2 Thomas Arnhold 2014-08-28 07:26:49 UTC
Oups, you're right. I accidentally converted this while converting some other star* aliases.

Aliases in sources files are ok, but there are many alias definitions inside header files. Those are problematic, because if you rely on this definition in your source (cxx) file you have to always include this header. And much worse: If some other header use this definition you have to account for the order of header includes... Otherwise the build breaks.
Commit 150df3c020613bd956c4ad38ab4b5e247801296b fixed such occurrences (those aliases were formerly defined in comphelper...).

Here you get a list of all com::sun:: aliases in header files:

git grep 'namespace.*=.*com::sun' -- '*.hxx'

To your gerrit question: Yes, it is the best way to get your patches in the tree :) So please do it :)
Comment 3 Stefan Weiberg 2014-08-28 09:05:07 UTC
1. Shall I fix these headers or are these the fixed ones? :)
2. Ok, I will use the gerrit tutorial to commit my small changes (shall I open a separate bug or is it fixed with this ticket?)
Comment 4 Thomas Arnhold 2014-08-28 10:11:32 UTC
1. Yes, those headers shall be fixed :)
2. You can refer to this ticket "Related fdo#82088: remove using namespace in headers" or something else :)
Comment 5 Stefan Weiberg 2014-08-28 12:13:49 UTC
I committed my small changes and will start with the header files right now.

https://gerrit.libreoffice.org/#/c/11171/
Comment 6 Commit Notification 2014-08-28 13:57:04 UTC
Stefan Weiberg committed a patch related to this issue.
It has been pushed to "master":

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

fdo#82088: changed namespace from utl to css::util



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 7 Commit Notification 2014-09-02 09:03:47 UTC
Stefan Weiberg committed a patch related to this issue.
It has been pushed to "master":

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

Related fdo#82088: removing namespace alias in hxx



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 2014-09-02 09:08:47 UTC
Stefan Weiberg committed a patch related to this issue.
It has been pushed to "master":

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

Related fdo#82088: removing and shortening aliases



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 Stefan Weiberg 2014-09-02 17:44:10 UTC
With my last push there are about 20 headers to fix.
Comment 10 Thomas Arnhold 2014-09-02 18:04:48 UTC
Sounds great! Feel free to fix some more :)
Comment 11 Commit Notification 2014-09-03 07:04:39 UTC
Stefan Weiberg committed a patch related to this issue.
It has been pushed to "master":

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

Related fdo#82088: removing another bunch of alias



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 12 Commit Notification 2014-09-06 20:55:49 UTC
Stefan Weiberg committed a patch related to this issue.
It has been pushed to "master":

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

Related fdo#82088: removing aliases in headers



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 13 Commit Notification 2014-09-06 20:57:46 UTC
Stefan Weiberg committed a patch related to this issue.
It has been pushed to "master":

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

Related fdo#82088: dropping aliases again :)



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 14 Stefan Weiberg 2014-09-08 12:48:15 UTC
I removed all but one header alias that is pretty persistent through the whole system. Can I close this bug?
Comment 15 Thomas Arnhold 2014-09-08 12:51:15 UTC
Leave it, if it's too much work. This bug is already closed. Thanks for your great work! :)
Comment 16 Stefan Weiberg 2014-09-08 13:21:02 UTC
Thanks for your help and feedback.

I don't think it is too hard to fix, but as far as if have seen there are way to many source files depending on this namespace.
Comment 17 Thomas Arnhold 2014-09-08 14:11:02 UTC
You could also move the namespace alias definition from the header into the source files. That's ok.
Comment 18 Robinson Tryon (qubit) 2015-12-15 23:57:28 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillCpp TopicCleanup)
[NinjaEdit]