From bee4d93a591f7f729717f6079f7d62ef555d9887 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Fri, 21 Jun 2013 23:59:38 -0400 Subject: [PATCH] Disable database verification unless debug enabled. The database verification can take a long time. Only enable it if debug mode is enabled. If MAKE_MAINTAINER_MODE is set, it's also enabled by default. --- ChangeLog | 10 +++++++ file.c | 2 +- main.c | 87 ++++++++++++++++++++++++++++++------------------------- makeint.h | 2 +- 4 files changed, 59 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0cb52887..ded8974e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-06-21 Paul Smith + + * main.c (verify_flag): Global variable to determine whether to + verify the database or not. + (decode_debug_flags): If debug mode, enable verify_flag. + (main): If MAKE_MAINTAINTER_MODE, enable verify_flag, otherwise not. + (die): Only verify the database if verify_flag is set. + * file.c (enter_file): Don't check caching unless verify_flag. + * makeint.h: Export verify_flag. + 2013-05-27 Paul Smith * variable.c (define_automatic_variables): Create a new variable diff --git a/file.c b/file.c index 06a2ce5c..b392aced 100644 --- a/file.c +++ b/file.c @@ -153,7 +153,7 @@ enter_file (const char *name) struct file file_key; assert (*name != '\0'); - assert (strcache_iscached (name)); + assert (! verify_flag || strcache_iscached (name)); #if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) if (*name != '.') diff --git a/main.c b/main.c index 3da595f8..a14f34b7 100644 --- a/main.c +++ b/main.c @@ -130,6 +130,10 @@ struct stringlist /* The recognized command switches. */ +/* Nonzero means do extra verification (that may slow things down). */ + +int verify_flag; + /* Nonzero means do not print commands to be executed (-s). */ int silent_flag; @@ -649,49 +653,48 @@ decode_debug_flags (void) if (debug_flag) db_level = DB_ALL; - if (!db_flags) - return; + if (db_flags) + for (pp=db_flags->list; *pp; ++pp) + { + const char *p = *pp; - for (pp=db_flags->list; *pp; ++pp) - { - const char *p = *pp; + while (1) + { + switch (tolower (p[0])) + { + case 'a': + db_level |= DB_ALL; + break; + case 'b': + db_level |= DB_BASIC; + break; + case 'i': + db_level |= DB_BASIC | DB_IMPLICIT; + break; + case 'j': + db_level |= DB_JOBS; + break; + case 'm': + db_level |= DB_BASIC | DB_MAKEFILES; + break; + case 'v': + db_level |= DB_BASIC | DB_VERBOSE; + break; + default: + fatal (NILF, _("unknown debug level specification '%s'"), p); + } - while (1) - { - switch (tolower (p[0])) - { - case 'a': - db_level |= DB_ALL; - break; - case 'b': - db_level |= DB_BASIC; - break; - case 'i': - db_level |= DB_BASIC | DB_IMPLICIT; - break; - case 'j': - db_level |= DB_JOBS; - break; - case 'm': - db_level |= DB_BASIC | DB_MAKEFILES; - break; - case 'v': - db_level |= DB_BASIC | DB_VERBOSE; - break; - default: - fatal (NILF, _("unknown debug level specification '%s'"), p); - } + while (*(++p) != '\0') + if (*p == ',' || *p == ' ') + break; - while (*(++p) != '\0') - if (*p == ',' || *p == ' ') + if (*p == '\0') break; + } + } - if (*p == '\0') - break; - - ++p; - } - } + if (db_level) + verify_flag = 1; } static void @@ -1048,7 +1051,10 @@ main (int argc, char **argv, char **envp) /* Needed for OS/2 */ initialize_main (&argc, &argv); - reading_file = 0; +#ifdef MAKE_MAINTAINER_MODE + /* In maintainer mode we always enable verification. */ + verify_flag = 1; +#endif #if defined (__MSDOS__) && !defined (_POSIX_SOURCE) /* Request the most powerful version of 'system', to @@ -3349,7 +3355,8 @@ die (int status) if (print_data_base_flag) print_data_base (); - verify_file_data_base (); + if (verify_flag) + verify_file_data_base (); clean_jobserver (status); diff --git a/makeint.h b/makeint.h index 749a6014..a145970b 100644 --- a/makeint.h +++ b/makeint.h @@ -561,7 +561,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, trace_flag, posix_pedantic; extern int not_parallel, second_expansion, clock_skew_detected; -extern int rebuilding_makefiles, one_shell, output_sync; +extern int rebuilding_makefiles, one_shell, output_sync, verify_flag; /* can we run commands via 'sh -c xxx' or must we use batch files? */ extern int batch_mode_shell;