Skip to content

fix(build): clean up Clang compiler warnings - #1458

Merged
JustVugg merged 1 commit into
JustVugg:devfrom
trigger2k20:fix/clang-compiler-warnings
Sep 13, 2026
Merged

JustVugg merged 1 commit into
JustVugg:devfrom
trigger2k20:fix/clang-compiler-warnings

Conversation

@trigger2k20

Copy link
Copy Markdown
Contributor

Clean up Clang compiler warnings

Branch and commit

  • Branch: fix/clang-compiler-warnings
  • Commit: e79aee8
  • Commit message: fix(build): clean up Clang compiler warnings
  • Base used for development: fd93c41aa6ae2c7d1cc1a1e2d6b79dbe6d341708 (v1.10.2)

Summary

This change removes Apple Clang compiler warnings from the portable CPU/test build without globally suppressing warning classes.

The cleanup covers GLM-5.3, Qwen3.8 Edge adapter initialization, the expert-store registry/test initialization, and DeepSeek V4 CPU/GPU conditional compilation. The changes are intended to be warning cleanup only; no performance claim is made.

Changes

GLM-5.3

  • Explicitly initializes the Mat.vk field to NULL in the three affected matrix initializers.
  • Keeps hc_mult declarations only in code paths where the value is actually used, avoiding unused-variable diagnostics in alternate/Segment builds.

Qwen3.8

  • Converts the ColiEdgeAdapter initializer to designated initialization.
  • Initializes the reserved_fn array explicitly.
  • Removes the scalar-brace/missing-field diagnostics and makes the adapter initializer less dependent on struct field order.

Expert store

  • Explicitly initializes the additional ColiExpertStore field in test_expert_store_ops.c.
  • Makes COLI_ESR_EXPORT feature-detect externally_visible instead of unconditionally applying an attribute unsupported by Apple Clang.
  • Retains the used attribute on GCC/Clang builds.

DeepSeek V4

  • Restricts gpu_batch, cols, and gpu_compute state to GPU-tier compilation where those values are consumed.
  • Removes unused scales/qdq scratch allocations and their size accounting.
  • Keeps the CPU-only path free of GPU-only unused-variable diagnostics.

Compiler diagnostics addressed

The original Apple Clang build/test output contained warnings in these groups:

  1. Three glm53.c missing field 'vk' initializer diagnostics.
  2. One GLM-5.3 Segment-build unused variable 'H' diagnostic.
  3. Qwen3.8 Edge adapter braces around scalar initializer.
  4. Qwen3.8 Edge adapter missing field 'reserved_fn' initializer.
  5. Expert-store test missing field 'gpu' initializer.
  6. Four expert_store_registry.c unknown attribute 'externally_visible' ignored diagnostics.
  7. DeepSeek V4 unused variable 'gpu_batch'.
  8. DeepSeek V4 unused variable 'cols'.
  9. DeepSeek V4 unused variable 'scales'.
  10. DeepSeek V4 unused variable 'qdq'.
  11. DeepSeek V4 variable 'gpu_compute' set but not used.

Expected runtime/test diagnostics containing the word warning were not treated as compiler warnings.

Validation

Final validation on macOS/Apple Clang:

Ran 722 tests in 54.468s

OK (skipped=39)

=== COMPILER WARNINGS ===
ZERO COMPILER WARNINGS

The compiler-warning check matched source-location compiler diagnostics separately from expected runtime/test messages.

git diff --check also passed.

Scope

Files changed:

  • c/deepseek_v4.c
  • c/expert_store_registry.c
  • c/glm53.c
  • c/qwen38.c
  • c/tests/test_expert_store_ops.c

Final commit diff:

5 files changed, 43 insertions(+), 21 deletions(-)

Notes

  • No warning class is disabled globally.
  • No throughput/performance improvement is claimed.
  • GPU-only DeepSeek variables remain available in GPU-tier builds; the cleanup avoids defining them in CPU-only builds where they are not consumed.
  • The registry attribute handling uses feature detection so Apple Clang can omit externally_visible while compilers supporting it retain the attribute.

@JustVugg

Copy link
Copy Markdown
Owner

Closing and reopening only to make CI build against current dev: the one red job (Windows UCRT64) is tests/test_qwen36_tier_fill_wait.c: implicit declaration of setenv, which is a base-side break that #1459 fixed at 06:37 UTC, and this run was created at 23:00 UTC the night before. Nothing in your branch is at fault. Everything else in the diff I have already reviewed: the scales/qdq scratch is genuinely unused in the indexer batch function, __has_attribute(externally_visible) is the right guard for Clang, and the trailing NULL initialises the vk field dev already warns about. If the fresh run is green it goes in.

@JustVugg JustVugg closed this Sep 13, 2026
@JustVugg JustVugg reopened this Sep 13, 2026
@JustVugg
JustVugg merged commit 248e130 into JustVugg:dev Sep 13, 2026
55 of 56 checks passed
JustVugg added a commit that referenced this pull request Sep 13, 2026
fix(glm53): initialise the two Mat fields #1462 added, so #1458's cleanup holds
@trigger2k20

Copy link
Copy Markdown
Contributor Author

Thanks for checking this and for confirming the UCRT64 failure was base-side.

The fresh runs against current dev are now both green:

pull Bot pushed a commit to Mu-L/colibri that referenced this pull request Sep 13, 2026
…tVugg#1458's cleanup holds

JustVugg#1458 silenced -Wmissing-field-initializers on the three expert_mats
initialisers by naming the `vk` field. JustVugg#1462 landed alongside it and gave Mat
two more trailing fields, `resident` and `metal`, so the warning did not go
away, it moved:

    glm53.c:1411:11: warning: missing initializer for field 'resident' of 'Mat'

The zero the compiler was already supplying is the right value -- a streamed
expert slot is not resident and has no Metal tensor -- so this only says so
explicitly. glm53 now builds clean under -Wextra again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants