void-packages/srcpkgs/chroot-make/patches/make-3.82-warn_undefined_function.patch

84 lines
3 KiB
Diff

diff --git a/make-3.82-gbuild/function.c b/make-3.82-gbuild/function.c
index e2f6c8c..ff0527f 100644
--- function.c
+++ function.c
@@ -2333,8 +2333,10 @@ func_call (char *o, char **argv, const char *funcname UNUSED)
v = lookup_variable (fname, flen);
if (v == 0)
- warn_undefined (fname, flen);
-
+ {
+ warn_undefined (fname, flen);
+ warn_undefined_function (fname, flen);
+ }
if (v == 0 || *v->value == '\0')
return o;
diff --git a/make-3.82-gbuild/main.c b/make-3.82-gbuild/main.c
index c6989e3..2f545a7 100644
--- main.c
+++ main.c
@@ -275,6 +275,11 @@ static int print_usage_flag = 0;
int warn_undefined_variables_flag;
+/* If nonzero, we should print a warning message
+ for each attemtp to call an undefined user function. */
+
+int warn_undefined_functions_flag;
+
/* If nonzero, always build all targets, regardless of whether
they appear out of date or not. */
@@ -368,6 +373,8 @@ static const char *const usage[] =
Consider FILE to be infinitely new.\n"),
N_("\
--warn-undefined-variables Warn when an undefined variable is referenced.\n"),
+ N_("\
+ --warn-undefined-functions Warn when an undefined user function is called.\n"),
NULL
};
@@ -424,6 +431,8 @@ static const struct command_switch switches[] =
{ CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
"warn-undefined-variables" },
{ CHAR_MAX+6, string, &eval_strings, 1, 0, 0, 0, 0, "eval" },
+ { CHAR_MAX+7, flag, &warn_undefined_functions_flag, 1, 1, 0, 0, 0,
+ "warn-undefined-functions" },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
diff --git a/make-3.82-gbuild/make.h b/make-3.82-gbuild/make.h
index 60ade4c..f2ebb56 100644
--- make.h
+++ make.h
@@ -513,7 +513,7 @@ extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;
extern int print_version_flag, print_directory_flag, check_symlink_flag;
extern int warn_undefined_variables_flag, posix_pedantic, not_parallel;
extern int second_expansion, clock_skew_detected, rebuilding_makefiles;
-extern int one_shell;
+extern int one_shell, warn_undefined_functions_flag;
/* can we run commands via 'sh -c xxx' or must we use batch files? */
extern int batch_mode_shell;
diff --git a/make-3.82-gbuild/variable.h b/make-3.82-gbuild/variable.h
index c215867..02713c1 100644
--- variable.h
+++ variable.h
@@ -220,6 +220,13 @@ void undefine_variable_in_set (const char *name, unsigned int length,
(int)(l), (n)); \
}while(0)
+#define warn_undefined_function(n,l) do{\
+ if (warn_undefined_functions_flag) \
+ error (reading_file, \
+ _("warning: undefined function `%.*s'"), \
+ (int)(l), (n)); \
+ }while(0)
+
char **target_environment (struct file *file);
struct pattern_var *create_pattern_var (const char *target,
--
cgit v0.9.0.2-2-gbebe