From cdddf131403120ca73c83fa8a63da6e71ab3dae4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 24 Apr 2022 16:35:21 +0200 Subject: Omit ignorable change detection for header units Since the checksum ignores preprocessor directives, this may cause us to ignore a change to an exported macro. --- libbuild2/cc/compile-rule.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libbuild2/cc/compile-rule.cxx') diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index ada0cc6..8e1cc81 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -5006,7 +5006,15 @@ namespace build2 // accurate (parts of the translation unit could have been // #ifdef'ed out; see __build2_preprocess). // - return reprocess ? string () : move (p.checksum); + // Also, don't use the checksum for header units since it ignores + // preprocessor directives and may therefore cause us to ignore a + // change to an exported macro. @@ TODO: maybe we should add a + // flag to the parser not to waste time calculating the checksum + // in these cases. + // + return reprocess || ut == unit_type::module_header + ? string () + : move (p.checksum); } // Fall through. -- cgit v1.1