[make] Apply two patches proposed upstream

Petr Machata pmachata at fedoraproject.org
Mon Mar 12 23:13:22 UTC 2012


commit e8bdb894720d42d1d7f804059614255a25cf1cdf
Author: Petr Machata <pmachata at redhat.com>
Date:   Tue Mar 13 00:12:30 2012 +0100

    Apply two patches proposed upstream

 make-3.82-trace.patch                   |  111 +++++++++++++++++++++++++++++++
 make-3.82-warn_undefined_function.patch |   84 +++++++++++++++++++++++
 make.spec                               |   18 +++++-
 3 files changed, 212 insertions(+), 1 deletions(-)
---
diff --git a/make-3.82-trace.patch b/make-3.82-trace.patch
new file mode 100644
index 0000000..b8cafa9
--- /dev/null
+++ b/make-3.82-trace.patch
@@ -0,0 +1,111 @@
+
+This patch add the support for --debug=c and --debug=e to make
+this option when activated will trace in stdout the activity of $(call and $(eval in the Makefile
+
+The trace use the format:
+ ### xxx -->
+ ### xxx <--
+the number of space before ### is at least 1 and increase with the nesting of eval/call
+
+usage: make --debug=c,e
+
+diff -r -u make-3.82/debug.h make-3.82-lo_trace/debug.h
+--- make-3.82/debug.h	2010-07-12 20:20:38.000000000 -0500
++++ make-3.82-lo_trace/debug.h	2011-06-22 12:06:37.000000000 -0500
+@@ -21,6 +21,8 @@
+ #define DB_JOBS         (0x004)
+ #define DB_IMPLICIT     (0x008)
+ #define DB_MAKEFILES    (0x100)
++#define DB_CALL       (0x01000)
++#define DB_EVAL       (0x02000)
+ 
+ #define DB_ALL          (0xfff)
+ 
+diff -r -u make-3.82/function.c make-3.82-lo_trace/function.c
+--- make-3.82/function.c	2011-06-23 01:01:35.000000000 -0500
++++ make-3.82-lo_trace/function.c	2011-06-23 01:40:05.000000000 -0500
+@@ -28,6 +28,8 @@
+ #include "amiga.h"
+ #endif
+ 
++static int depth = 0;
++
+ 
+ struct function_table_entry
+   {
+@@ -1371,7 +1373,12 @@
+ 
+   install_variable_buffer (&buf, &len);
+ 
++  depth += 1;
++  DBS( DB_EVAL, ("### eval -->\n"));
++  DB( DB_EVAL, ("%s\n", argv[0]));
+   eval_buffer (argv[0]);
++  DBS( DB_EVAL, ("### eval <--\n"));
++  depth -= 1;
+ 
+   restore_variable_buffer (buf, len);
+ 
+@@ -2338,6 +2345,7 @@
+   if (v == 0 || *v->value == '\0')
+     return o;
+ 
++  depth += 1;
+   body = alloca (flen + 4);
+   body[0] = '$';
+   body[1] = '(';
+@@ -2345,6 +2353,7 @@
+   body[flen+2] = ')';
+   body[flen+3] = '\0';
+ 
++  DBS(DB_CALL, ("### call %s -->\n", body));
+   /* Set up arguments $(1) .. $(N).  $(0) is the function name.  */
+ 
+   push_new_variable_scope ();
+@@ -2354,6 +2363,7 @@
+       char num[11];
+ 
+       sprintf (num, "%d", i);
++      DBS(DB_CALL, ("### arg %i for call %s is '%s'\n", i, body, *argv));
+       define_variable (num, strlen (num), *argv, o_automatic, 0);
+     }
+ 
+@@ -2367,6 +2377,7 @@
+       char num[11];
+ 
+       sprintf (num, "%d", i);
++      DBS(DB_CALL, ("### arg %i for call %s is implicit\n", i, body));
+       define_variable (num, strlen (num), "", o_automatic, 0);
+     }
+ 
+@@ -2377,7 +2388,14 @@
+ 
+   saved_args = max_args;
+   max_args = i;
++
+   o = variable_expand_string (o, body, flen+3);
++  DBS(DB_CALL, ("### call to %s expended into\n", body));
++  DB(DB_CALL, ("%s\n", o));
++  DBS(DB_CALL, ("### call %s <--\n", body));
++
++  depth -= 1;
++
+   max_args = saved_args;
+ 
+   v->exp_count = 0;
+diff -r -u make-3.82/main.c make-3.82-lo_trace/main.c
+--- make-3.82/main.c	2010-07-19 02:10:53.000000000 -0500
++++ make-3.82-lo_trace/main.c	2011-06-22 11:46:39.000000000 -0500
+@@ -634,6 +634,12 @@
+             case 'b':
+               db_level |= DB_BASIC;
+               break;
++            case 'c':
++              db_level |= DB_CALL;
++              break;
++            case 'e':
++              db_level |= DB_EVAL;
++              break;
+             case 'i':
+               db_level |= DB_BASIC | DB_IMPLICIT;
+               break;
diff --git a/make-3.82-warn_undefined_function.patch b/make-3.82-warn_undefined_function.patch
new file mode 100644
index 0000000..d4fd502
--- /dev/null
+++ b/make-3.82-warn_undefined_function.patch
@@ -0,0 +1,84 @@
+diff --git a/make-3.82-gbuild/function.c b/make-3.82-gbuild/function.c
+index e2f6c8c..ff0527f 100644
+--- a/make-3.82/function.c
++++ b/make-3.82/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
+--- a/make-3.82/main.c
++++ b/make-3.82/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
+--- a/make-3.82/make.h
++++ b/make-3.82/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
+--- a/make-3.82/variable.h
++++ b/make-3.82/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
diff --git a/make.spec b/make.spec
index f0081dc..1816aab 100644
--- a/make.spec
+++ b/make.spec
@@ -3,11 +3,12 @@ Summary: A GNU tool which simplifies the build process for users
 Name: make
 Epoch: 1
 Version: 3.82
-Release: 9%{?dist}
+Release: 10%{?dist}
 License: GPLv2+
 Group: Development/Tools
 URL: http://www.gnu.org/software/make/
 Source: ftp://ftp.gnu.org/gnu/make/make-%{version}.tar.bz2
+
 Patch1: make-3.82-noclock_gettime.patch
 Patch2: make-3.82-j8k.patch
 Patch3: make-3.82-getcwd.patch
@@ -19,8 +20,16 @@ Patch8: make-3.82-jobserver.patch
 Patch9: make-3.82-bugfixes.patch
 Patch10: make-3.82-sort-blank.patch
 Patch11: make-3.82-copy-on-expand.patch
+
 # Uptream fix of https://savannah.gnu.org/bugs/?33873
 Patch12: make-3.82-parallel-remake.patch
+
+# http://savannah.gnu.org/bugs/?34335
+Patch13: make-3.82-warn_undefined_function.patch
+
+# http://lists.gnu.org/archive/html/bug-make/2011-06/msg00032.html
+Patch14: make-3.82-trace.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires(post): /sbin/install-info
 Requires(preun): /sbin/install-info
@@ -48,6 +57,8 @@ makefile.
 %patch10 -p1
 %patch11 -p1
 %patch12 -p0
+%patch13 -p2
+%patch14 -p1
 
 %build
 %configure
@@ -90,6 +101,11 @@ fi
 %{_infodir}/*.info*
 
 %changelog
+* Mon Mar 12 2012 Petr Machata <pmachata at redhat.com> - 1:3.82-10
+- Apply the following patches, proposed upstream by Norbert Thiebaud:
+  - A patch for warning on call of undefined function
+  - A patch for tracing calls to "eval" and "call"
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:3.82-9
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list