Cleanup: Add tiny_debug_api.h to eliminate guard/failfast implicit warnings

Created central header for debug instrumentation API to fix implicit
function declaration warnings across the codebase.

Changes:
1. Created core/tiny_debug_api.h
   - Declares guard system API (3 functions)
   - Declares failfast debugging API (3 functions)
   - Uses forward declarations for SuperSlab/TinySlabMeta

2. Updated 3 files to include tiny_debug_api.h:
   - core/tiny_region_id.h (removed inline externs)
   - core/hakmem_tiny_tls_ops.h
   - core/tiny_superslab_alloc.inc.h

Warnings eliminated (6 of 11 total):
 tiny_guard_is_enabled()
 tiny_guard_on_alloc()
 tiny_guard_on_invalid()
 tiny_failfast_log()
 tiny_failfast_abort_ptr()
 tiny_refill_failfast_level()

Remaining warnings (deferred to P1):
- ss_active_add (2 occurrences)
- expand_superslab_head
- hkm_ace_set_tls_capacity
- smallmid_backend_free

Impact:
- Cleaner build output
- Better type safety for debug functions
- No behavior changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-11-29 06:47:13 +09:00
parent 0f071bf2e5
commit 20f8d6f179
19 changed files with 126 additions and 47 deletions

View File

@ -20,6 +20,7 @@
#include "hakmem_super_registry.h"
#include "superslab/superslab_inline.h"
#include "hakmem_tiny.h" // For TinyTLSSLL type
#include "tiny_debug_api.h" // Guard/failfast declarations
// Feature flag: Enable header-based class_idx lookup
#ifndef HAKMEM_TINY_HEADER_CLASSIDX
@ -266,8 +267,6 @@ static inline void* tiny_region_id_write_header(void* base, int class_idx) {
// ========== END ALLOCATION LOGGING ==========
// Optional guard: log stride/base/user for targeted class
extern int tiny_guard_is_enabled(void);
extern void tiny_guard_on_alloc(int cls, void* base, void* user, size_t stride);
if (tiny_guard_is_enabled()) {
size_t stride = tiny_stride_for_class(class_idx);
tiny_guard_on_alloc(class_idx, base, user, stride);
@ -311,7 +310,6 @@ static inline int tiny_region_id_read_header(void* ptr) {
}
#endif
// Optional guard hook for invalid header
extern void tiny_guard_on_invalid(void* user_ptr, uint8_t hdr);
if (tiny_guard_is_enabled()) tiny_guard_on_invalid(ptr, header);
return -1;
}