summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorDejan Jovanović <dejan.jovanovic@gmail.com>2012-05-09 03:31:50 +0000
committerDejan Jovanović <dejan.jovanovic@gmail.com>2012-05-09 03:31:50 +0000
commit9f74cfbd847663f80c362cf06bda7e749f0f694b (patch)
treec34f9ac44e1ae31e3be6984324915a3b18faae76 /src/util
parent8a0c0562cb8d0e26ea019ff782b25c1997a49a0b (diff)
Fixing the debug tags generation and related methods in configuration.cpp that disallowed me to debug my bugs by reporting that the debug tag doesn't exists, where in fact it was in the code.
1) The grep and sed for tags wasn't picking up on .isOn("tag") 2) The isDebugTag a) didn't take a parameter b) was using binary search using strcmp which is non-portable and didn't work for tags including special characters Morgan should vet this, since there is some crazy sed stuff going on
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Makefile.am4
-rw-r--r--src/util/configuration.cpp24
2 files changed, 16 insertions, 12 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 4945f6339..87fa2c890 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -128,9 +128,9 @@ endif
# expression (no |, no \<, ...).
Debug_tags.tmp Trace_tags.tmp:
$(AM_V_GEN)\
- grep '\<$(@:_tags.tmp=) *( *\".*\" *)' \
+ grep '\<$(@:_tags.tmp=)\(\.isOn\)\? *( *\".*\" *)' \
`find @srcdir@/../ -name "*.cpp" -or -name "*.h" -or -name "*.cc" -or -name "*.g"` | \
- sed 's/^$(@:_tags.tmp=) *( *\"\([^"]*\)\".*/\1/;s/.*[^a-zA-Z0-9_]$(@:_tags.tmp=) *( *\"\([^"]*\)\".*/\1/' | sort | uniq >"$@"
+ sed 's/^$(@:_tags.tmp=)\(.isOn\)\? *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]$(@:_tags.tmp=)\(\.isOn\)\? *( *\"\([^"]*\)\".*/\2/' | sort | uniq >"$@"
if CVC4_CLN_IMP
libutil_la_SOURCES += \
diff --git a/src/util/configuration.cpp b/src/util/configuration.cpp
index abda24c26..66b0a2f90 100644
--- a/src/util/configuration.cpp
+++ b/src/util/configuration.cpp
@@ -153,15 +153,17 @@ int strcmpptr(const char **s1, const char **s2){
return strcmp(*s1,*s2);
}
-bool Configuration::isDebugTag(char const *){
+bool Configuration::isDebugTag(char const *tag){
#if CVC4_DEBUG
unsigned ntags = getNumDebugTags();
char const* const* tags = getDebugTags();
- return (bsearch(&optarg, tags, ntags, sizeof(char *),
- (int(*)(const void*,const void*))strcmpptr) != NULL);
-#else /* CVC4_DEBUG */
+ for (unsigned i = 0; i < ntags; ++ i) {
+ if (strcmp(tag, tags[i]) == 0) {
+ return true;
+ }
+ }
+#endif * CVC4_DEBUG */
return false;
-#endif /* CVC4_DEBUG */
}
unsigned Configuration::getNumTraceTags() {
@@ -182,15 +184,17 @@ char const* const* Configuration::getTraceTags() {
#endif /* CVC4_TRACING */
}
-bool Configuration::isTraceTag(char const *){
+bool Configuration::isTraceTag(char const * tag){
#if CVC4_TRACING
unsigned ntags = getNumTraceTags();
char const* const* tags = getTraceTags();
- return (bsearch(&optarg, tags, ntags, sizeof(char *),
- (int(*)(const void*,const void*))strcmpptr) != NULL);
-#else /* CVC4_TRACING */
- return false;
+ for (unsigned i = 0; i < ntags; ++ i) {
+ if (strcmp(tag, tags[i]) == 0) {
+ return true;
+ }
+ }
#endif /* CVC4_TRACING */
+ return false;
}
bool Configuration::isSubversionBuild() {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback