3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-11-01 03:57:51 +00:00

Centralize and document TRACE tags using X-macros (#7657)

* Introduce X-macro-based trace tag definition
- Created trace_tags.def to centralize TRACE tag definitions
- Each tag includes a symbolic name and description
- Set up enum class TraceTag for type-safe usage in TRACE macros

* Add script to generate Markdown documentation from trace_tags.def
- Python script parses trace_tags.def and outputs trace_tags.md

* Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled

* trace: improve trace tag handling system with hierarchical tagging

- Introduce hierarchical tag-class structure: enabling a tag class activates all child tags
- Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag
- Implement initial version of trace_tag.def using X(tag, tag_class, description)
  (class names and descriptions to be refined in a future update)

* trace: replace all string-based TRACE tags with enum TraceTag
- Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals

* trace : add cstring header

* trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py

* trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h.

* trace : Add TODO comment for future implementation of tag_class activation

* trace : Disable code related to tag_class until implementation is ready (#7663).
This commit is contained in:
LeeYoungJoon 2025-05-28 22:31:25 +09:00 committed by GitHub
parent d766292dab
commit 0a93ff515d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
583 changed files with 8698 additions and 7299 deletions

View file

@ -45,7 +45,7 @@ namespace sat {
SASSERT(it->empty());
continue;
}
TRACE("cleanup_bug", tout << "processing wlist of " << to_literal(l_idx) << "\n";);
TRACE(cleanup_bug, tout << "processing wlist of " << to_literal(l_idx) << "\n";);
watch_list & wlist = *it;
watch_list::iterator it2 = wlist.begin();
watch_list::iterator it_prev = it2;
@ -53,7 +53,7 @@ namespace sat {
for (; it2 != end2; ++it2) {
switch (it2->get_kind()) {
case watched::BINARY:
TRACE("cleanup_bug",
TRACE(cleanup_bug,
tout << ~to_literal(l_idx) << " " << it2->get_literal() << "\n";
tout << s.value(~to_literal(l_idx)) << " " << s.value(it2->get_literal()) << "\n";
tout << s.was_eliminated(it2->get_literal()) << " " << s.inconsistent() << "\n";);
@ -62,7 +62,7 @@ namespace sat {
*it_prev = *it2;
++it_prev;
}
TRACE("cleanup_bug", tout << "keeping: " << ~to_literal(l_idx) << " " << it2->get_literal() << "\n";);
TRACE(cleanup_bug, tout << "keeping: " << ~to_literal(l_idx) << " " << it2->get_literal() << "\n";);
break;
case watched::CLAUSE:
// skip
@ -86,9 +86,9 @@ namespace sat {
clause_vector::iterator end = cs.end();
for (; it != end; ++it) {
clause & c = *(*it);
TRACE("sat_cleaner_bug", tout << "cleaning: " << c << "\n";
TRACE(sat_cleaner_bug, tout << "cleaning: " << c << "\n";
for (unsigned i = 0; i < c.size(); i++) tout << c[i] << ": " << s.value(c[i]) << "\n";);
CTRACE("sat_cleaner_frozen", c.frozen(), tout << c << "\n";);
CTRACE(sat_cleaner_frozen, c.frozen(), tout << c << "\n";);
unsigned sz = c.size();
unsigned i = 0, j = 0;
m_cleanup_counter += sz;
@ -108,7 +108,7 @@ namespace sat {
}
}
end_loop:
CTRACE("sat_cleaner_frozen", c.frozen(),
CTRACE(sat_cleaner_frozen, c.frozen(),
tout << "sat: " << (i < sz) << ", new_size: " << j << "\n";
tout << mk_lits_pp(j, c.begin()) << "\n";);
if (i < sz) {
@ -117,7 +117,7 @@ namespace sat {
}
else {
unsigned new_sz = j;
CTRACE("sat_cleaner_bug", new_sz < 2, tout << "new_sz: " << new_sz << "\n";
CTRACE(sat_cleaner_bug, new_sz < 2, tout << "new_sz: " << new_sz << "\n";
if (c.size() > 0) tout << "unit: " << c[0] << "\n";
s.display_watches(tout););
switch (new_sz) {
@ -131,7 +131,7 @@ namespace sat {
break;
case 2:
SASSERT(s.value(c[0]) == l_undef && s.value(c[1]) == l_undef);
TRACE("cleanup_bug", tout << "clause became binary: " << c[0] << " " << c[1] << "\n";);
TRACE(cleanup_bug, tout << "clause became binary: " << c[0] << " " << c[1] << "\n";);
s.mk_bin_clause(c[0], c[1], c.is_learned());
s.del_clause(c);
break;
@ -198,7 +198,7 @@ namespace sat {
unsigned trail_sz = s.m_trail.size();
s.propagate(false); // make sure that everything was propagated.
TRACE("sat_cleaner_bug", s.display(tout); s.display_watches(tout););
TRACE(sat_cleaner_bug, s.display(tout); s.display_watches(tout););
if (s.m_inconsistent)
return false;
if (m_last_num_units == trail_sz)