BUILT_SOURCES = \
rational.h \
integer.h \
- tls.h \
- debug_tags.h
+ tls.h
+if CVC4_DEBUG
+# listing Debug_tags too ensures that make doesn't auto-remove it
+# after building (if it does, we don't get the "cached" effect with
+# the .tmp files below, and we have to re-compile and re-link each
+# time, even when there are no changes).
+BUILT_SOURCES += \
+ Debug_tags.h \
+ Debug_tags
+endif
+if CVC4_TRACING
+# listing Trace_tags too ensures that make doesn't auto-remove it
+# after building (if it does, we don't get the "cached" effect with
+# the .tmp files below, and we have to re-compile and re-link each
+# time, even when there are no changes).
+BUILT_SOURCES += \
+ Trace_tags.h \
+ Trace_tags
+endif
-debug_tags.h: debug_tags
+%_tags.h: %_tags
$(AM_V_GEN)( \
- echo 'const char* debug_tags[] = {'; \
+ echo 'static char const *const $^[] = {'; \
first=1; \
- for tag in `cat debug_tags`; \
+ for tag in `cat $^`; \
do \
if [ $$first -eq 1 ]; then first=0; else echo ','; fi; \
echo -n "\"$$tag\""; \
echo; \
echo '};' \
) >"$@"
-
-debug_tags:
- $(AM_V_GEN)\
- grep 'Debug(\".*\")' `find @srcdir@/../ -name "*.cpp" -or -name "*.h" -or -name "*.cc" -or -name "*.g"` | \
- sed s/'.*Debug(\"'//g | sed s/'\".*'//g | sort | uniq >"$@"
-
-.PHONY: debug_tags
+# This .tmp business is to keep from having to re-compile options.cpp
+# (and then re-link the libraries) if nothing has changed.
+%_tags: %_tags.tmp
+ $(AM_V_GEN)\
+ diff -q "$^" "$@" &>/dev/null || mv "$^" "$@" || true
+# .PHONY ensures the .tmp version is always rebuilt (to check for any changes)
+.PHONY: Debug_tags.tmp Trace_tags.tmp
+Debug_tags.tmp Trace_tags.tmp:
+ $(AM_V_GEN)\
+ grep '\<$(@:_tags.tmp=) *( *\".*\" *)' \
+ `find @srcdir@/../ -name "*.cpp" -or -name "*.h" -or -name "*.cc" -or -name "*.g"` | \
+ sed 's/.*\<$(@:_tags.tmp=) *( *\"\([^"]*\)\".*/\1/g' | sort | uniq >"$@"
if CVC4_CLN_IMP
libutil_la_SOURCES += \
#include "util/configuration_private.h"
#include "cvc4autoconfig.h"
+#ifdef CVC4_DEBUG
+# include "util/Debug_tags.h"
+#endif /* CVC4_DEBUG */
+
+#ifdef CVC4_TRACING
+# include "util/Trace_tags.h"
+#endif /* CVC4_TRACING */
+
using namespace std;
namespace CVC4 {
return USING_TLS;
}
+unsigned Configuration::getNumDebugTags() {
+#if CVC4_DEBUG
+ return sizeof(Debug_tags) / sizeof(Debug_tags[0]);
+#else /* CVC4_DEBUG */
+ return 0;
+#endif /* CVC4_DEBUG */
+}
+
+char const* const* Configuration::getDebugTags() {
+#if CVC4_DEBUG
+ return Debug_tags;
+#else /* CVC4_DEBUG */
+ return NULL;
+#endif /* CVC4_DEBUG */
+}
+
+unsigned Configuration::getNumTraceTags() {
+#if CVC4_TRACING
+ return sizeof(Trace_tags) / sizeof(Trace_tags[0]);
+#else /* CVC4_TRACING */
+ return 0;
+#endif /* CVC4_TRACING */
+}
+
+char const* const* Configuration::getTraceTags() {
+#if CVC4_TRACING
+ return Trace_tags;
+#else /* CVC4_TRACING */
+ return NULL;
+#endif /* CVC4_TRACING */
+}
+
bool Configuration::isSubversionBuild() {
return IS_SUBVERSION_BUILD;
}
#include "util/language.h"
#include "util/options.h"
#include "util/output.h"
-#include "util/debug_tags.h"
#include "cvc4autoconfig.h"
--quiet | -q decrease verbosity (may be repeated)\n\
--trace | -t trace something (e.g. -t pushpop), can repeat\n\
--debug | -d debug something (e.g. -d arith), can repeat\n\
- --show-debug-tags show all avalable tags for debug tracing\n\
+ --show-debug-tags show all avalable tags for debugging\n\
+ --show-trace-tags show all avalable tags for tracing\n\
--stats give statistics on exit\n\
--default-expr-depth=N print exprs to depth N (0 == default, -1 == no limit)\n\
--print-expr-types print types with variables when printing exprs\n\
NO_THEORY_REGISTRATION,
USE_MMAP,
SHOW_DEBUG_TAGS,
+ SHOW_TRACE_TAGS,
SHOW_CONFIG,
STRICT_PARSING,
DEFAULT_EXPR_DEPTH,
{ "stats" , no_argument , NULL, STATS },
{ "no-checking", no_argument , NULL, NO_CHECKING },
{ "no-theory-registration", no_argument, NULL, NO_THEORY_REGISTRATION },
- { "show-debug-tags", no_argument, NULL, SHOW_DEBUG_TAGS },
+ { "show-debug-tags", no_argument , NULL, SHOW_DEBUG_TAGS },
+ { "show-trace-tags", no_argument , NULL, SHOW_TRACE_TAGS },
{ "show-config", no_argument , NULL, SHOW_CONFIG },
{ "segv-nospin", no_argument , NULL, SEGV_NOSPIN },
{ "help" , no_argument , NULL, 'h' },
break;
case SHOW_DEBUG_TAGS:
- printf("available tags:");
- if (Configuration::isTracingBuild()) {
- unsigned nTags = sizeof(debug_tags) / sizeof(debug_tags[0]);
- for (unsigned i = 0; i < nTags; ++ i) {
- printf(" %s", debug_tags[i]);
+ if(Configuration::isDebugBuild()) {
+ printf("available tags:");
+ unsigned ntags = Configuration::getNumDebugTags();
+ char const* const* tags = Configuration::getDebugTags();
+ for(unsigned i = 0; i < ntags; ++ i) {
+ printf(" %s", tags[i]);
}
printf("\n");
} else {
- printf(" not available in this build");
+ throw OptionException("debug tags not available in non-debug build");
+ }
+ exit(0);
+ break;
+
+ case SHOW_TRACE_TAGS:
+ if(Configuration::isTracingBuild()) {
+ printf("available tags:");
+ unsigned ntags = Configuration::getNumTraceTags();
+ char const* const* tags = Configuration::getTraceTags();
+ for (unsigned i = 0; i < ntags; ++ i) {
+ printf(" %s", tags[i]);
+ }
+ printf("\n");
+ } else {
+ throw OptionException("trace tags not available in non-tracing build");
}
exit(0);
break;