Download it now!
Bug 60148 - Clean up warnings from the Clang compiler plugin
Summary: Clean up warnings from the Clang compiler plugin
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:4.1.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2013-02-01 10:05 UTC by Luboš Luňák
Modified: 2015-12-15 23:56 UTC (History)
1 user (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 Luboš Luňák 2013-02-01 10:05:48 UTC
When LibreOffice is built using the Clang compiler, it can use also a compiler plugin to provide additional LO-specific warnings. Currently there are a number of warnings generated by this plugin and they should be all fixed.

See https://wiki.documentfoundation.org/Development/Clang for information on how to build LO with Clang.

See compilerplugins/README in the sources for information about the additional warnings. Currently these are:

- unused variable warnings - These are very similar to warnings about basic types the compilers provide on their own. It should be checked whether it's not a mistake that the variable is not used, and the code should be either fixed or the variable removed.

- incorrect block indentation - if several statements are in the body of if/while/for statements, they need to be inside {}. The warning points out code the possibly lacks these, although in many cases it is code that is technically correct but just poorly formatted (very common case is writing "else if" on two lines instead of just one). Such code should be either fixed or formatted properly.

- log areas - macros such as SAL_INFO and SAL_WARN have a log area as their first argument, which is a string, and this allows selective enabling/disabling. As a protection against mistyping and also to ensure some consistency, a warning is produced for areas that are not listed in sal/inc/sal/log-areas.dox . Code with unknown areas should have either them fixed or added to the list. Note that because of the selective enabling/disabling, there should be one areas for logical area of code, and it should not be overly generic (e.g. 'sw' for the whole of Writer is too broad).
Comment 1 Cao Cuong Ngo 2013-03-04 17:27:32 UTC
Hi, 

I've made a patch for this bug, you can find it here:

https://gerrit.libreoffice.org/2544
Comment 2 Commit Notification 2013-03-06 13:02:44 UTC
nccuong committed a patch related to this issue.
It has been pushed to "master":

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

fdo#60148 Clean up warnings from the Clang compiler plugin



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 Luboš Luňák 2013-03-13 16:59:10 UTC
This is not fixed yet, I can still see a number of warnings.
Comment 4 Cao Cuong Ngo 2013-03-13 19:26:36 UTC
As you can see from inline comments from https://gerrit.libreoffice.org/2544,
we intentionally left some unused variable warnings: all the mutex warnings and some other unused variables are left untouched for debug purpose. Beside, there's one or two false positive from the plugin.
Comment 5 Luboš Luňák 2013-03-15 16:02:39 UTC
As long as there are any warnings left, this bugreport is still valid by definition. If there are false warnings, those should get fixed.

But by the time I wrote comment #3 I did 9a4fb0643e51cb89649000493e8c5dac5a306bc4, which was a valid warning, so I expect there still are more valid warnings.

As for warnings left for debug or other purposes, those should be handled somehow too - we do not leave native compiler warnings in the code either.
Comment 6 Luboš Luňák 2013-05-02 16:13:08 UTC
I cannot see any warnings remaining in current master build, so assuming done, closing.
Comment 7 Robinson Tryon (qubit) 2015-12-15 23:56:09 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup)
[NinjaEdit]