findutils-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Findutils-patches] [PATCH 3/3] Retire configure --enable-debug in favou


From: jay
Subject: [Findutils-patches] [PATCH 3/3] Retire configure --enable-debug in favour of find -D ...
Date: Wed, 30 Dec 2015 23:51:09 +0000

From: James Youngman <address@hidden>

* find/defs.h (enum DebugOption): add DebugTime.
* find/util.c (debugassoc): -D time sets the DebugTime debug flag.
* find/oldfind.c (main): print the value of options.cur_day_start
when "-D time" is in effect (instead of when DEBUG is #defined).
* find/ftsfind.c (main): Likewise.
* find/pred.c (pred_table): Instantiate pred_table even if DEBUG
is not #defined.
* find/parser.c (parse_version): DEBUG is no longer a (distinct)
feature.
* configure.ac: Remove the --enable-debug option (all debugging is
now controlled via find's -D option).  Don't #define the
preprocessor macro DEBUG.
* NEWS: Mention this change.
---
 NEWS           |  5 ++++-
 configure.ac   | 12 ------------
 find/defs.h    |  6 +++---
 find/ftsfind.c |  6 +++---
 find/oldfind.c |  5 ++---
 find/parser.c  |  4 ----
 find/pred.c    |  2 --
 find/util.c    |  3 ++-
 8 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/NEWS b/NEWS
index 5ba1f3e..044f1b8 100644
--- a/NEWS
+++ b/NEWS
@@ -2,11 +2,14 @@ GNU findutils NEWS - User visible changes.      -*- outline 
-*- (allout)
 
 * Major changes in release 4.7.0-git, YYYY-MM-DD
 
-** Changes to find
+** Changes to the build process
 
 The configure option --enable-id-cache has been removed.  It has been
 a no-op since findnutils-4.5.15.
 
+The configure option --enable-debug has been removed.  Debugging in
+find is now controlled by its -D option only.
+
 * Major changes in release 4.6.0, 2015-12-28
 
 ** Stable Release
diff --git a/configure.ac b/configure.ac
index 58b2e4b..dd2496e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,10 +15,6 @@ AC_SUBST(AUXDIR,$ac_aux_dir)
 dnl check for --with-fts
 FIND_WITH_FTS
 
-AC_ARG_ENABLE(debug,
-       AS_HELP_STRING(--enable-debug,Enable debugging output which is likely 
to be interesting to people debugging findutils),
-       [ac_cv_debug=$enableval],[ac_cv_debug=no])
-
 AC_ARG_ENABLE(leaf-optimisation,
        AS_HELP_STRING(--enable-leaf-optimisation,Enable an optimisation which 
saves lstat calls to identify subdirectories on filesystems having traditional 
Unix semantics),
        [ac_cv_leaf_optimisation=$enableval],[ac_cv_leaf_optimisation=yes])
@@ -35,14 +31,6 @@ AC_ARG_ENABLE(d_type-optimisation,
        [ac_cv_d_type=$enableval],[])
 
 
-AC_MSG_CHECKING([whether debug output should be produced])
-if test x$ac_cv_debug = xno; then
-   AC_MSG_RESULT([no])
-else
-   AC_MSG_RESULT([yes])
-   AC_DEFINE([DEBUG], 1, [Define if you want to see find's innards])
-fi
-
 AC_MSG_CHECKING([for leaf optimisation])
 if test x$ac_cv_leaf_optimisation = xno; then
    AC_MSG_RESULT([no])
diff --git a/find/defs.h b/find/defs.h
index fe45388..2894455 100644
--- a/find/defs.h
+++ b/find/defs.h
@@ -256,8 +256,7 @@ struct predicate
   /* Pointer to the function that implements this predicate.  */
   PRED_FUNC pred_func;
 
-  /* Only used for debugging, but defined unconditionally so individual
-     modules can be compiled with -DDEBUG.  */
+  /* Used for debugging */
   const char *p_name;
 
   /* The type of this node.  There are two kinds.  The first is real
@@ -532,7 +531,8 @@ enum DebugOption
     DebugTreeOpt          = 1 << 3,
     DebugHelp             = 1 << 4,
     DebugExec             = 1 << 5,
-    DebugSuccessRates     = 1 << 6
+    DebugSuccessRates     = 1 << 6,
+    DebugTime             = 1 << 7
   };
 
 struct options
diff --git a/find/ftsfind.c b/find/ftsfind.c
index 414327b..114b95b 100644
--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -701,9 +701,9 @@ main (int argc, char **argv)
   if (options.debug_options & DebugStat)
     options.xstat = debug_stat;
 
-#ifdef DEBUG
-  fprintf (stderr, "cur_day_start = %s", ctime (&options.cur_day_start));
-#endif /* DEBUG */
+
+  if (options.debug_options & DebugTime)
+    fprintf (stderr, "cur_day_start = %s", ctime (&options.cur_day_start));
 
 
   /* We are now processing the part of the "find" command line
diff --git a/find/oldfind.c b/find/oldfind.c
index c32cbc5..986e7b4 100644
--- a/find/oldfind.c
+++ b/find/oldfind.c
@@ -226,9 +226,8 @@ main (int argc, char **argv)
   if (options.debug_options & DebugStat)
     options.xstat = debug_stat;
 
-#ifdef DEBUG
-  fprintf (stderr, "cur_day_start = %s", ctime (&options.cur_day_start));
-#endif /* DEBUG */
+  if (options.debug_options & DebugTime)
+    fprintf (stderr, "cur_day_start = %s", ctime (&options.cur_day_start));
 
   /* state.cwd_dir_fd has to be initialized before we call 
build_expression_tree ()
    * because command-line parsing may lead us to stat some files.
diff --git a/find/parser.c b/find/parser.c
index 84a940f..bf4fcec 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -2590,10 +2590,6 @@ parse_version (const struct parser_table* entry, char 
**argv, int *arg_ptr)
   printf ("CACHE_IDS(ignored) ");
   has_features = true;
 #endif
-#if DEBUG
-  printf ("DEBUG ");
-  has_features = true;
-#endif
 #if defined HAVE_STRUCT_DIRENT_D_TYPE
   printf ("D_TYPE ");
   has_features = true;
diff --git a/find/pred.c b/find/pred.c
index 32938fb..18b9bef 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -76,7 +76,6 @@
 
 static bool match_lname (const char *pathname, struct stat *stat_buf, struct 
predicate *pred_ptr, bool ignore_case);
 
-#ifdef DEBUG
 struct pred_assoc
 {
   PRED_FUNC pred_func;
@@ -145,7 +144,6 @@ struct pred_assoc pred_table[] =
   {pred_context, "context"},
   {0, "none    "}
 };
-#endif
 
 /* Returns ts1 - ts2 */
 static double ts_difference (struct timespec ts1,
diff --git a/find/util.c b/find/util.c
index 5ffe140..ffca38d 100644
--- a/find/util.c
+++ b/find/util.c
@@ -73,7 +73,8 @@ static struct debug_option_assoc debugassoc[] =
     { "stat", DebugStat, "Trace calls to stat(2) and lstat(2)" },
     { "rates", DebugSuccessRates, "Indicate how often each predicate 
succeeded" },
     { "opt",  DebugExpressionTree|DebugTreeOpt, "Show diagnostic information 
relating to optimisation" },
-    { "exec", DebugExec,  "Show diagnostic information relating to -exec, 
-execdir, -ok and -okdir" }
+    { "exec", DebugExec,  "Show diagnostic information relating to -exec, 
-execdir, -ok and -okdir" },
+    { "time", DebugTime,  "Show diagnostic information relating to time-of-day 
and timestamp comparisons" }
   };
 #define N_DEBUGASSOC (sizeof(debugassoc)/sizeof(debugassoc[0]))
 
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]