[PATCH] Check -Werror options to see if a module should be rebuilt.

Ben Langmuir blangmuir at apple.com
Sat Apr 26 20:35:39 PDT 2014


As discussed here http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140414/103530.html

This patch checks whether the diagnostic options that could lead to errors (principally -Werror) are consistent between when a module was built and when it is loaded.  If there are new -Werror flags, then the module is rebuilt.  In order to canonicalize the options we do this check at the level of the constructed DiagnosticsEngine, which contains the final set of diag to diagnostic level mappings.  Currently we only rebuild with the new diagnostic options, but we intend to refine this in the future to include the union of the new and old flags, since we know the old ones did not cause errors.  System modules are only rebuilt when -Wsystem-headers is enabled.

One oddity is that unlike checking language options, we don’t perform this diagnostic option checking when loading from a precompiled header.  The reason for this is that the compiler cannot rebuild the PCH, so anything that requires it to be rebuilt effectively leaks into the build system.  And in this case, that would mean the build system understanding the complex relationship between diagnostic options and the underlying diagnostic mappings, which is unreasonable.  Skipping the check is safe, because these options do not affect the generated AST.  You simply won’t get new build errors due to changed -Werror options automatically, which is also true for non-module cases.

Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: werror-modules.patch
Type: application/octet-stream
Size: 16721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140426/30d222f9/attachment.obj>


More information about the cfe-commits mailing list