Blame SOURCES/make-3.82-warn_undefined_function.patch

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