3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-04 14:26:10 +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

@ -74,7 +74,7 @@ class mpq_manager : public mpz_manager<SYNCH> {
void rat_add(mpq const & a, mpq const & b, mpq & c);
void rat_add(mpq const & a, mpz const & b, mpq & c) {
STRACE("rat_mpq", tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";);
STRACE(rat_mpq, tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";);
if (SYNCH) {
mpz tmp1;
mul(b, a.m_den, tmp1);
@ -89,7 +89,7 @@ class mpq_manager : public mpz_manager<SYNCH> {
add(a.m_num, m_tmp1, c.m_num);
normalize(c);
}
STRACE("rat_mpq", tout << to_string(c) << "\n";);
STRACE(rat_mpq, tout << to_string(c) << "\n";);
}
void rat_sub(mpq const & a, mpq const & b, mpq & c);
@ -228,7 +228,7 @@ public:
void add(mpz const & a, mpz const & b, mpz & c) { mpz_manager<SYNCH>::add(a, b, c); }
void add(mpq const & a, mpq const & b, mpq & c) {
STRACE("mpq", tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";);
STRACE(mpq, tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";);
if (is_zero(b)) {
set(c, a);
}
@ -242,11 +242,11 @@ public:
else {
rat_add(a, b, c);
}
STRACE("mpq", tout << to_string(c) << "\n";);
STRACE(mpq, tout << to_string(c) << "\n";);
}
void add(mpq const & a, mpz const & b, mpq & c) {
STRACE("mpq", tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";);
STRACE(mpq, tout << "[mpq] " << to_string(a) << " + " << to_string(b) << " == ";);
if (is_zero(b)) {
set(c, a);
}
@ -260,20 +260,20 @@ public:
else {
rat_add(a, b, c);
}
STRACE("mpq", tout << to_string(c) << "\n";);
STRACE(mpq, tout << to_string(c) << "\n";);
}
void sub(mpz const & a, mpz const & b, mpz & c) { mpz_manager<SYNCH>::sub(a, b, c); }
void sub(mpq const & a, mpq const & b, mpq & c) {
STRACE("mpq", tout << "[mpq] " << to_string(a) << " - " << to_string(b) << " == ";);
STRACE(mpq, tout << "[mpq] " << to_string(a) << " - " << to_string(b) << " == ";);
if (is_int(a) && is_int(b)) {
mpz_manager<SYNCH>::sub(a.m_num, b.m_num, c.m_num);
reset_denominator(c);
}
else
rat_sub(a, b, c);
STRACE("mpq", tout << to_string(c) << "\n";);
STRACE(mpq, tout << to_string(c) << "\n";);
}
void inc(mpz & a) { mpz_manager<SYNCH>::inc(a); }
@ -292,25 +292,25 @@ public:
}
void mul(mpq const & a, mpq const & b, mpq & c) {
STRACE("mpq", tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";);
STRACE(mpq, tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";);
if (is_int(a) && is_int(b)) {
mpz_manager<SYNCH>::mul(a.m_num, b.m_num, c.m_num);
reset_denominator(c);
}
else
rat_mul(a, b, c);
STRACE("mpq", tout << to_string(c) << "\n";);
STRACE(mpq, tout << to_string(c) << "\n";);
}
void mul(mpz const & a, mpq const & b, mpq & c) {
STRACE("mpq", tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";);
STRACE(mpq, tout << "[mpq] " << to_string(a) << " * " << to_string(b) << " == ";);
if (is_int(b)) {
mpz_manager<SYNCH>::mul(a, b.m_num, c.m_num);
reset_denominator(c);
}
else
rat_mul(a, b, c);
STRACE("mpq", tout << to_string(c) << "\n";);
STRACE(mpq, tout << to_string(c) << "\n";);
}
void addmul(mpz const & a, mpz const & b, mpz const & c, mpz & d) {
@ -431,7 +431,7 @@ public:
}
void div(mpq const & a, mpq const & b, mpq & c) {
STRACE("mpq", tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";);
STRACE(mpq, tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";);
if (is_zero(a) || is_one(b)) {
set(c, a);
return;
@ -453,11 +453,11 @@ public:
neg(c.m_den);
}
normalize(c);
STRACE("mpq", tout << to_string(c) << "\n";);
STRACE(mpq, tout << to_string(c) << "\n";);
}
void div(mpq const & a, mpz const & b, mpq & c) {
STRACE("mpq", tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";);
STRACE(mpq, tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";);
if (is_zero(a) || is_one(b)) {
set(c, a);
return;
@ -469,18 +469,18 @@ public:
neg(c.m_den);
}
normalize(c);
STRACE("mpq", tout << to_string(c) << "\n";);
STRACE(mpq, tout << to_string(c) << "\n";);
}
void acc_div(mpq & a, mpz const & b) {
STRACE("mpq", tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";);
STRACE(mpq, tout << "[mpq] " << to_string(a) << " / " << to_string(b) << " == ";);
mul(a.m_den, b, a.m_den);
if (mpz_manager<SYNCH>::is_neg(b)) {
neg(a.m_num);
neg(a.m_den);
}
normalize(a);
STRACE("mpq", tout << to_string(a) << "\n";);
STRACE(mpq, tout << to_string(a) << "\n";);
}
void machine_div(mpz const & a, mpz const & b, mpz & c) { mpz_manager<SYNCH>::machine_div(a, b, c); }