Blame SOURCES/make-4.2-warn_undefined_function.patch

7a33d6
diff -Nrup a/main.c b/main.c
7a33d6
--- a/main.c	2017-06-11 10:01:27.874528811 -0400
7a33d6
+++ b/main.c	2017-06-11 10:08:13.235058577 -0400
7a33d6
@@ -310,6 +310,11 @@ static int print_usage_flag = 0;
7a33d6
 
7a33d6
 int warn_undefined_variables_flag;
7a33d6
 
7a33d6
+/* If nonzero, we should print a warning message
7a33d6
+   for each attemtp to call an undefined user function.  */
7a33d6
+
7a33d6
+int warn_undefined_functions_flag;
7a33d6
+
7a33d6
 /* If nonzero, always build all targets, regardless of whether
7a33d6
    they appear out of date or not.  */
7a33d6
 
7a33d6
@@ -408,6 +413,8 @@ static const char *const usage[] =
7a33d6
                               Consider FILE to be infinitely new.\n"),
7a33d6
     N_("\
7a33d6
   --warn-undefined-variables  Warn when an undefined variable is referenced.\n"),
7a33d6
+    N_("\
7a33d6
+  --warn-undefined-functions  Warn when an undefined user function is called.\n"),
7a33d6
     NULL
7a33d6
   };
7a33d6
 
7a33d6
@@ -471,6 +478,8 @@ static const struct command_switch switc
7a33d6
       "warn-undefined-variables" },
7a33d6
     { CHAR_MAX+6, strlist, &eval_strings, 1, 0, 0, 0, 0, "eval" },
7a33d6
     { CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, "sync-mutex" },
7a33d6
+    { CHAR_MAX+8, flag, &warn_undefined_functions_flag, 1, 1, 0, 0, 0,
7a33d6
+      "warn-undefined-functions" },
7a33d6
     { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
7a33d6
   };
7a33d6
 
7a33d6
diff -Nrup a/makeint.h b/makeint.h
7a33d6
--- a/makeint.h	2017-06-11 10:01:27.875528807 -0400
7a33d6
+++ b/makeint.h	2017-06-11 10:09:13.231845428 -0400
7a33d6
@@ -647,7 +647,7 @@ extern int env_overrides, no_builtin_rul
7a33d6
 extern int print_version_flag, print_directory_flag, check_symlink_flag;
7a33d6
 extern int warn_undefined_variables_flag, trace_flag, posix_pedantic;
7a33d6
 extern int not_parallel, second_expansion, clock_skew_detected;
7a33d6
-extern int rebuilding_makefiles, one_shell, output_sync, verify_flag;
7a33d6
+extern int rebuilding_makefiles, one_shell, output_sync, verify_flag, warn_undefined_functions_flag;
7a33d6
 
7a33d6
 extern const char *default_shell;
7a33d6
 
7a33d6
diff -Nrup a/variable.h b/variable.h
7a33d6
--- a/variable.h	2016-05-21 16:22:32.000000000 -0400
7a33d6
+++ b/variable.h	2017-06-11 10:10:40.957533767 -0400
7a33d6
@@ -225,6 +225,15 @@ void undefine_variable_in_set (const cha
7a33d6
                                        (int)(l), (n));                  \
7a33d6
                               }while(0)
7a33d6
 
7a33d6
+/* Warn that NAME is an undefined function.  */
7a33d6
+
7a33d6
+#define warn_undefined_function(n,l) do{\
7a33d6
+                              if (warn_undefined_functions_flag) \
7a33d6
+                                error (reading_file, \
7a33d6
+                                       _("warning: undefined function `%.*s'"), \
7a33d6
+                                (int)(l), (n)); \
7a33d6
+                              }while(0)
7a33d6
+
7a33d6
 char **target_environment (struct file *file);
7a33d6
 
7a33d6
 struct pattern_var *create_pattern_var (const char *target,