6 Commits

Author SHA1 Message Date
Syoyo Fujita
fd365dddab Fix MSVC /W4 unreachable-code error in v3 C dtoa
When TG3JSON_USE_STDLIB_FPCONV is enabled (auto-selected on MSVC), the
stdlib float-formatting block in tg3json__dtoa_c() always returns, making
the manual long-double formatting fallback dead code. MSVC /W4 /WX turned
the resulting C4702 (unreachable code) into a build error.

Make the manual fallback an #else branch of the stdlib path so neither
configuration contains unreachable code, and guard the fallback-only
locals and helpers (tg3json__utoa, tg3json__write_exp,
tg3json__format_decimal_digits) under !TG3JSON_USE_STDLIB_FPCONV to avoid
unused-function/variable warnings on the stdlib path.

Verified with gcc -Wall -Wextra -Werror across all v3 C test sources in
both fpconv configurations, plus runtime runs of tester_v3_json_c.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 21:15:33 +09:00
Syoyo Fujita
2ff44b903c Fix MSVC v3 C JSON float conversion 2026-06-01 20:08:32 +09:00
Syoyo Fujita
34a166cdac Complete freestanding v3 C JSON conversion tests 2026-06-01 16:11:22 +09:00
Syoyo Fujita
0e3043f3e9 Harden and optimize v3 C parser 2026-05-31 22:20:46 +09:00
Syoyo Fujita
c9b3b9c644 Build v3 C under clang -Weverything and MSVC /W4
Escalate v3 C warning levels in CI to catch latent issues:
gcc/clang now run with -Werror, clang adds -Weverything (with a
small irreducible suppression list for -Wpadded, -Wunsafe-buffer-usage,
-Wcast-align, etc.), and a new MSVC job builds tester_v3_c with /W4 /WX.

Source fixes to clear the elevated warnings:
- tg3__arena_new_block: cast through void* to silence -Wcast-align.
- tg3__value_to_json: handle TG3_VALUE_BINARY explicitly and drop the
  default label so -Wswitch-enum and -Wcovered-switch-default agree.
- Drop unused tg3__json_set_value_copy.
- tinygltf_json_c.h: enumerate all tg3json_value_type cases in
  tg3json_value_free / tg3json_value_copy / tg3json__stringify_value_ex.
- tester_v3_c_v1port FAIL macro: split the format/newline prints so it
  no longer relies on the GNU `, ##__VA_ARGS__` extension.

Verified: clang -Werror -Weverything builds clean, 13/13 internal
tests, 18/18 v1-port tests, and 134/134 cross-version regression all
pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 04:33:21 +09:00
Syoyo Fujita
85441bbe19 Add pure-C TinyGLTF v3 runtime
Introduce a C-first TinyGLTF v3 runtime in tiny_gltf_v3.c with a pure-C JSON backend, hook the public header to the new implementation, and add CMake/test coverage for parse and write round-trips.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 04:28:41 +09:00