tdf#124990: DnD operation can be set to fail in dropComplete
[LibreOffice.git] / compilerplugins / README
blobc48341e0f0d21dc6cce92b95efe255c6c0dba788
1 Compiler plugins.
4 == Overview ==
6 This directory contains code for compiler plugins. These are used to perform
7 additional actions during compilation (such as additional warnings) and
8 also to perform mass code refactoring.
10 Currently only the Clang compiler is supported (http://wiki.documentfoundation.org/Development/Clang).
13 == Usage ==
15 Compiler plugins are enabled automatically by --enable-dbgutil if Clang headers
16 are found or explicitly using --enable-compiler-plugins.
19 == Functionality ==
21 There are two kinds of plugin actions:
22 - compile checks - these are run during normal compilation
23 - rewriters - these must be run manually and modify source files
25 Each source has a comment saying whether it's compile check or a rewriter
26 and description of functionality.
28 === Compile checks ===
30 Used during normal compilation to perform additional checks.
31 All warnings and errors are marked '[loplugin]' in the message.
34 === Rewriters ===
36 Rewriters analyse and possibly modify given source files.
37 Usage: make COMPILER_PLUGIN_TOOL=<rewriter_name>
38 Additional optional make arguments:
39 - it is possible to also pass FORCE_COMPILE_ALL=1 to make to trigger rebuild of all source files,
40     even those that are up to date.
41 - UPDATE_FILES=<scope> - limits which modified files will be actually written back with the changes
42     - mainfile - only the main .cxx file will be modified (default)
43     - all - all source files involved will be modified (possibly even header files from other LO modules),
44         3rd party header files are however never modified
45     - <module> - only files in the given LO module (toplevel directory) will be modified (including headers)
47 Modifications will be written directly to the source files.
49 Some rewriter plugins are dual-mode and can also be used in a non-rewriting mode
50 in which they emit warnings for problematic code that they would otherwise
51 automatically rewrite.  When any rewriter is enabled explicitly via "make
52 COMPILER_PLUGIN_TOOL=<rewriter_name>" it works in rewriting mode (and all other
53 plugins are disabled), but when no rewriter is explicitly enabled (i.e., just
54 "make"), all dual-mode rewriters are enabled in non-rewriting mode (along with
55 all non-rewriter plugins; and all non--dual-mode plugins are disabled).  The
56 typical process to use such a dual-mode rewriter X in rewriting mode is
58   make COMPILER_PLUGIN_WARNINGS_ONLY=X \
59   && make COMPILER_PLUGIN_TOOL=X FORCE_COMPILE_ALL=1 UPDATE_FILES=all
61 which first generates a full build without failing due to warnings from plugin
62 X in non-rewriting mode (in case of --enable-werror) and then repeats the build
63 in rewriting mode (during which no object files are generate).
66 == Code documentation / howtos ==
68 http://wiki.documentfoundation.org/Clang_plugins