Bug 43157

Summary: Clean up OSL_ASSERT, DBG_ASSERT, etc.
Product: LibreOffice Reporter: Stephan Bergmann <sbergman>
Component: LibreofficeAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium CC: ashodnakashian, bjoern.michaelsen, dtardon, libreoffice, m.weghorn, thumperward
Version: Master old -3.6   
Hardware: Other   
OS: All   
URL: https://wiki.documentfoundation.org/Development/GeneralProgrammingGuidelines#Assertions_and_Logging
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=39425
Whiteboard: EasyHack DifficultyBeginner SkillCpp TopicCleanup target:4.1.0 target:4.2.0 target:4.3.0 target:4.4.0
i915 platform: i915 features:

Description Stephan Bergmann 2011-11-22 01:27:23 UTC
The assertion/logging functionality from osl/diagnose.h (OSL_TRACE, OSL_ASSERT, OSL_ENSURE, OSL_FAIL) and tools/debug.hxx (DBG_ASSERTWARNING, DBG_ASSERT, DBG_BF_ASSERT, DBG_WARNING, DBG_WARNING1--5, DBG_WARNINGFILE, DBG_ERRORFILE) is obsolete and needs to be cleaned up:

* To assert invariants of the code (that can only be violated if there are programming errors) use standard C/C++ assert.

* To log warnings about unusual events (that the code nevertheless needs to handle in some way, like malformed input or I/O failures), use the SAL_WARN... macros from sal/log.h.

* To log other information useful for debugging, use the SAL_INFO... macros.

See <https://wiki.documentfoundation.org/Development#Assertions_and_Logging>, the mail thread at <http://lists.freedesktop.org/archives/libreoffice/2011-November/020864.html>, and the documentation in the sal/log.h header for further information.
Comment 1 Stephan Bergmann 2011-11-22 01:34:07 UTC
Further, sal_detail_logFormat in sal/log.h has a commented-out GCC __attribute__((format)), to catch misuses of its printf-style message composition.  It is used by the SAL_WARN and SAL_INFO macros, which in turn is used by the obsoleted OSL_TRACE, for which many calls currently use ill-formed format strings.  Once those uses are cleaned up (preferably by replacing them with SAL_INFO_S), the __attribute__((format)) should be enabled.
Comment 2 Not Assigned 2012-12-31 12:23:39 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 Not Assigned 2013-01-14 08:53:40 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 4 Mathias Hasselmann 2013-01-22 10:42:03 UTC
How does this bug relate to bug 39425?
Comment 5 Thomas Arnhold 2013-01-22 11:42:34 UTC
*** Bug 39425 has been marked as a duplicate of this bug. ***
Comment 6 Not Assigned 2013-01-31 14:16:45 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 Not Assigned 2013-02-05 15:00:58 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 Not Assigned 2013-02-19 16:04:42 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 2013-03-12 23:21:49 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 2013-04-08 08:30:37 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT



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 Commit Notification 2013-04-17 20:34:14 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 2013-04-22 08:21:06 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 2013-05-14 14:05:50 UTC
Radu Ioan committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 Commit Notification 2013-07-30 13:52:23 UTC
Honza HavliÄek committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ENSURE



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 15 Commit Notification 2013-09-30 13:36:02 UTC
Jacobo Aragunde Perez committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ENSURE



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 Björn Michaelsen 2013-10-04 18:46:29 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 17 Commit Notification 2014-02-05 12:41:28 UTC
Timothy Markle committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT



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 Stephan Bergmann 2014-02-05 14:38:33 UTC
(In reply to comment #0)
> See
> <https://wiki.documentfoundation.org/Development#Assertions_and_Logging>,
> the mail thread at
> <http://lists.freedesktop.org/archives/libreoffice/2011-November/020864.
> html>, and the documentation in the sal/log.h header for further information.

The first of those links got stale, use <https://wiki.documentfoundation.org/Development/GeneralProgrammingGuidelines#Assertions_and_Logging> now (as reflected in this issue's URL field now).  Thanks to Caolán for spotting.
Comment 19 Commit Notification 2014-04-03 11:24:53 UTC
Michaël Lefèvre committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 : clean up OSL_POSTCOND



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 20 Commit Notification 2014-04-04 12:24:52 UTC
Michaël Lefèvre committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 : clean up more OSL_POSTCOND



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 21 Commit Notification 2014-04-05 08:48:16 UTC
Michaël Lefèvre committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 : clean up OSL_DEBUG_ONLY



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 22 Commit Notification 2014-04-08 09:24:15 UTC
Michaël Lefèvre committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 [API CHANGE] Remove deprecated _OSL_GLOBAL



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 23 Commit Notification 2014-04-25 09:58:05 UTC
Michaël Lefèvre committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 : [API CHANGE] Remove OSL_THIS_FILE



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 24 Commit Notification 2014-05-12 09:33:47 UTC
Michaël Lefèvre committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 Remove OSL_POSTCOND, prefer SAL_WARN_IF



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 25 Mukhiddin Yusupov 2014-05-15 23:12:33 UTC
(In reply to comment #0)
> The assertion/logging functionality from osl/diagnose.h (OSL_TRACE,
> OSL_ASSERT, OSL_ENSURE, OSL_FAIL) and tools/debug.hxx (DBG_ASSERTWARNING,
> DBG_ASSERT, DBG_BF_ASSERT, DBG_WARNING, DBG_WARNING1--5, DBG_WARNINGFILE,
> DBG_ERRORFILE) is obsolete and needs to be cleaned up:
> 
> * To assert invariants of the code (that can only be violated if there are
> programming errors) use standard C/C++ assert.
> 
> * To log warnings about unusual events (that the code nevertheless needs to
> handle in some way, like malformed input or I/O failures), use the
> SAL_WARN... macros from sal/log.h.
> 
> * To log other information useful for debugging, use the SAL_INFO... macros.
> 
> See
> <https://wiki.documentfoundation.org/Development#Assertions_and_Logging>,
> the mail thread at
> <http://lists.freedesktop.org/archives/libreoffice/2011-November/020864.
> html>, and the documentation in the sal/log.h header for further information.

In spite of the fact that many people uploaded commits I found that in some files these obsolete assertions/logging. I am going to change as many of these files as I can.
Comment 26 Commit Notification 2014-05-20 13:17:14 UTC
Mukhiddin Yusupov committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 27 Commit Notification 2014-05-20 13:48:04 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

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

Revert "fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT"



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 28 Commit Notification 2014-05-22 06:34:51 UTC
Mukhiddin Yusupov committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT



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 29 Björn Michaelsen 2014-07-12 20:25:01 UTC
NEEDINFO->NEW: The NEEDINFO state seems to have happened accidentally.
Comment 30 Commit Notification 2014-10-29 11:37:48 UTC
Naruhiko Ogasawara committed a patch related to this issue.
It has been pushed to "master":

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

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

It will be available in 4.4.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 31 Stephan Bergmann 2015-01-16 09:31:33 UTC
*** Bug 88309 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.