@@ -1351,6 +1351,20 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list
*/
protect_token_alloc();
}
+ /*
+ * Evaluate the complete symbol list
+ * Note: This is not needed for normal cases.
+ * These symbols should only be predefined defines and
+ * declaratons which will be evaluated later, when needed.
+ * This is also the case when a file is directly included via
+ * '-include <file>' on the command line *AND* the file only
+ * contains defines, declarations and inline definitions.
+ * However, in the rare cases where the given file should
+ * contain some definitions, these will never be evaluated
+ * and thus won't be able to be linearized correctly.
+ * Hence the evaluate_symbol_list() here under.
+ */
+ evaluate_symbol_list(list);
return list;
}
@@ -3,5 +3,4 @@
/*
* check-name: include-eval.c
* check-command: sparse -include ./include-eval.inc $file
- * check-known-to-fail
*/
Symbols declared or defined in files directly or indirectly given in the command line and thus processed via sparse() are always automatically evaluated. Symbols processed via sparse_initialize(), thus the predefined ones, are not systematically evaluated, which is normaly fine as they are just declarations and will be evaluated when needed. However, if the command line include a file via '-include <file>', the symbols of this file will also not be evaluated, which is still fine as long as it's only definitions. But, in the rare and odd cases where the file should contains a function definition, this function will not be evaluated and it's expansion and linearization won't happen as it should have. Fix this by evaluating the symbols issued from sparse_intialize() like it is done for sparse(). Reported-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- lib.c | 14 ++++++++++++++ validation/include-eval.c | 1 - 2 files changed, 14 insertions(+), 1 deletion(-)