Bug Hunting Session
Bug 39425 - align ASSERT and friends debug macro foo
Summary: align ASSERT and friends debug macro foo
Status: RESOLVED DUPLICATE of bug 43157
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:3.7.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2011-07-21 06:36 UTC by Björn Michaelsen
Modified: 2015-12-15 23:50 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Perl script which helped me to convert some stuff. (2.68 KB, text/x-perl)
2011-08-02 04:16 UTC, Thomas Arnhold
Details
Replace DBG_ macros with OSL_ equivalents in accessibility/ (19.28 KB, patch)
2011-08-21 01:46 UTC, Jacek Wolszczak
Details
Follow-up of the previous patch in accessibility/ (37.21 KB, patch)
2011-08-21 01:53 UTC, Jacek Wolszczak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Michaelsen 2011-07-21 06:36:34 UTC
=== align ASSERT (& friends) macro foo ===

'''Background:''' Two families of debug type macros exist in the openoffice code base, the OSL family ( OSL_TRACE, OSL_ASSERT, OSL_ENSURE etc. ) defined http://opengrok.go-oo.org/xref/ure/sal/inc/osl/diagnose.h and the DBG family ( DBG_ASSERT, DBG_TRACE etc. ) defined http://opengrok.go-oo.org/xref/libs-gui/tools/inc/tools/debug.hxx. The OSL family of macros are enabled when you build with debug ( --enable-debug configure option ) and the DBG family with ( --enable-dbgutil ) The OSL family should be considered to be the desired variant. <strike>Some local ASSERT variants also exist such as 'ASSERT' &amp; ASSERT_ID' http://opengrok.go-oo.org/xref/writer/sw/inc/errhdl.hxx#58, these should be replaced with OSL_ASSERT. Also in there is VOS_ASSERT ( which is actually defined to be OSL_ASSERT ) Directly replacing occurrences of VOS_ASSERT with OSL_ASSERT should also be done.</strike> Eventually we should remove/replace the DBG family of macros with OSL variants.

'''Skills:''' building, simple C++ programming

'''Working on it:''' Thomas Arnhold, 2011-02-21

'''Status:''' converted all DBG_ERROR to OSL_* locally, currently test building, 2011-03-04
Comment 1 Thomas Arnhold 2011-08-02 04:16:17 UTC
Created attachment 49825 [details]
Perl script which helped me to convert some stuff.
Comment 2 Jacek Wolszczak 2011-08-21 01:46:31 UTC
Created attachment 50418 [details]
Replace DBG_ macros with OSL_ equivalents in accessibility/
Comment 3 Jacek Wolszczak 2011-08-21 01:53:23 UTC
Created attachment 50419 [details]
Follow-up of the previous patch in accessibility/

Since the removal of debug.hxx altogether is the ultimate goal this patch removes DBG_NAME, DBG_CTOR, DBG_DTOR in accessibility which in result allows to delete all debug.hxx occurences in the same folder. 

The question is whether someone does need statistical information provided by functions like "DBG_DTOR( VCLXAccessibleToolBoxItem, NULL );". I asked a similar question on the mailing list and a suggestion was that DBG_CTOR/DBG_DTOR with empty argument can be removed, whereas when the second argument is not NULL some different solution has to be applied. Nevertheless, this patch should be regarded as a question that will help me to prepare similar patches in the future.
Comment 4 Caolán McNamara 2011-11-16 03:05:20 UTC
caolanm->sbergman: worth factoring this easy-hack into the "what we should do with asserts, traces, warnings" plan. i.e. mass convert DBG_FOO things ?
Comment 5 Björn Michaelsen 2011-12-21 02:29:28 UTC
Removing EasyHack status for now until the debugging facility discussion has settled and is linked here in concise summary form.
Comment 6 Michael Meeks 2012-05-08 12:48:43 UTC
Stephan - did we settle the debugging thing yet ? :-)
Comment 7 Stephan Bergmann 2012-05-09 00:05:22 UTC
(In reply to comment #6)
> Stephan - did we settle the debugging thing yet ? :-)

The <cassert> and "sal/log.hxx" functionality (assert, SAL_INFO, SAL_WARN, etc.) is nowadays the functionality of choice, see <http://wiki.documentfoundation.org/Development#Assertions_and_Logging>.  ("The functionality offered by osl/diagnose.h and tools/debug.hxx is obsoleted by sal/log.hxx.")

Lubos once stated he would like to revisit the sal/log.hxx interface again, but I don't think he still plans to do so.

This easy hack is slightly different from easy hack bug 43157, where the latter only concentrates on removing the osl/diagnose.h and tools/debug.hxx functionality that is directly obsoleted by sal/log.hxx, while this bug also addresses further old functionality like DBG_NAME, DBG_CTOR, etc., cf. comment 3.  We can either make one bug a duplicate of the other or keep both.
Comment 8 Luboš Luňák 2012-05-09 05:26:58 UTC
(In reply to comment #7)
> Lubos once stated he would like to revisit the sal/log.hxx interface again, but
> I don't think he still plans to do so.

I would still theoretically like to do something about the ostream usage there, but with all the other things on my plate I don't see this important enough for the foreseeable future, so I can live with the current log.hxx functionality as it is.
Comment 9 Michael Stahl (CIB) 2012-06-29 14:35:27 UTC
Comment on attachment 50418 [details]
Replace DBG_ macros with OSL_ equivalents in accessibility/

thanks for the patch, i've just pushed it to master, and mark this patch as "obsolete" so it does not clutter up bugzilla searches

PS: for future work, please send it to the mailing list directly, and please use SAL_WARN instead of OSL_ENSURE
Comment 10 Michael Stahl (CIB) 2012-06-29 14:35:59 UTC
Comment on attachment 50419 [details]
Follow-up of the previous patch in accessibility/

thanks for the patch, i've just pushed it to master, and mark this patch as "obsolete" so it does not clutter up bugzilla searches
Comment 11 Not Assigned 2012-06-29 14:38:29 UTC
Jacek Wolszczak committed a patch related to this issue.
It has been pushed to "master":

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

fdo#39425: Replace DBG_ASSERT macros with OSL_ equivalents in accessibility
Comment 12 Not Assigned 2012-06-29 14:38:55 UTC
Jacek Wolszczak committed a patch related to this issue.
It has been pushed to "master":

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

fdo#39425: Remove DBG_NAME, DBG_CTOR, DBG_DTOR and debug.hxx in accessibility
Comment 13 Thorsten Behrens (CIB) 2012-07-25 19:05:50 UTC
(In reply to comment #0)
> === align ASSERT (&amp; friends) macro foo ===
> 
Björn, is this still sufficiently clear in definition and scope for an easy hack? I had some trouble following the train of thoughts - maybe distill the remainder into a new bug?
Comment 14 Björn Michaelsen 2012-07-25 21:34:57 UTC
@thb: I just copied this one over from the wiki back in the dawn of time. I would assume sberg to be the guy to best judge how to formulate the the remaining goals of this beast.
Comment 15 Mathias Hasselmann 2013-01-22 10:41:59 UTC
How does this bug relate to bug 43157?
Comment 16 Thomas Arnhold 2013-01-22 11:42:34 UTC
Bug #43157 makes this one obsolete.

*** This bug has been marked as a duplicate of bug 43157 ***
Comment 17 Robinson Tryon (qubit) 2015-12-15 23:50:44 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup)
[NinjaEdit]