Notes on compilerplugins/clang/store/salbool.cxx
Stephan Bergmann
sbergman at redhat.com
Tue Feb 25 02:28:38 PST 2014
...introduced with
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=cc478960dceea17858ba88067dc3ecf07a07d291>
"salbool: a rewriting plugin that flags most uses of sal_Bool."
If you want to use it to clean up uses of sal_Bool in some module M:
After a full build, do
> make $M.clean
> cp compilerplugins/clang/store/salbool.cxx compilerplugins/clang/
> make -k $M
> make -k PARALLELISM=1 COMPILER_PLUGIN_TOOL='literaltoboolconversion salbool' UPDATE_FILES=$M $M
> make -k $M
> make -k PARALLELISM=1 COMPILER_PLUGIN_TOOL='literaltoboolconversion salbool' UPDATE_FILES=$M $M
> ...
> rm compilerplugins/clang/salbool.cxx
> make -k check
> make -k COMPILER_PLUGIN_TOOL=literaltoboolconversion check
> make -k check
> make -k COMPILER_PLUGIN_TOOL=literaltoboolconversion check
> ...
i.e., first use enough iterations of running the salbool rewriter over
module M to get that module cleaned up. Also use the
literaltoboolconversion rewriter in those runs, to automatically fix
cases like salbool rewrote
sal_Bool b = sal_False;
to
bool b = sal_False;
which literatltoboolconversion on the next run rewrites to
bool b = false;
Use UPDATE_FILES=$M to also do the rewriting in the include files of
module M (requires PARALLELISM=1). Interleave with non-rewriting "make
-k $M" runs, to generate .o files for those .cxx files that have no more
errors (as rewriting runs don't generate .o files, so would needlessly
re-process those .cxx files again and again).
Once the module itself is clean, disable the salbool plugin again and
clean up any problems introduced into dependent modules (like a virtual
function override derived from module M needs to change its return type
from sal_Bool to bool).
Some errors cannot be rewritten, so you need to fix those manually
between runs. But note that salbool will rewrite a function declaration
in an include file only when working on a .cxx file where it also sees a
definition (to avoid some needless temporary compilation errors that
prevent the rewriter from doing its work), and will otherwise flag the
function declaration in the include file as a warning/error, so don't
fix such a case manually but wait for a (subsequent) run to get to the
corresponding .cxx and rewrite the include file automatically.
Modules up to toolkit have already been processed. (See "make
dump-deps-sort" for a rough estimate of "up to.")
Stephan
More information about the LibreOffice
mailing list