Skip to content

Fix Mac compile warnings#129

Merged
LiquidityC merged 1 commit into
devfrom
mac_compile_warnings_fix
Oct 7, 2025
Merged

Fix Mac compile warnings#129
LiquidityC merged 1 commit into
devfrom
mac_compile_warnings_fix

Conversation

@LiquidityC

@LiquidityC LiquidityC commented Oct 7, 2025

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Item cost logic now only deducts gold and shows cost for positive-priced items.
    • Improved reliability of settings and hiscore migrations via consistent sentinel entries.
  • Refactor

    • Standardized no-argument function declarations to explicit void for consistency.
    • Removed unused includes to reduce overhead.
  • Chores

    • Adjusted platform-specific library linking for better build portability.

@LiquidityC LiquidityC enabled auto-merge (squash) October 7, 2025 16:33
@coderabbitai

coderabbitai Bot commented Oct 7, 2025

Copy link
Copy Markdown

Walkthrough

The changes standardize several function prototypes to explicitly use void parameters, adjust sentinel initializers in migration arrays, change a price truthiness check to an explicit positive check, remove two includes from object.c, and update a CMake script by removing non-MSVC math library linking.

Changes

Cohort / File(s) Summary of edits
Prototype standardization (void)
src/object.c, src/particle_engine.c, src/timer.c, src/tooltip_manager.c, src/trap.c
Converted no-arg functions to explicit void parameter forms: object_create_fire(void), object_create_green_gas(void), particle_engine_heat(void), _timer_create(void), tooltip_manager_close(void), trap_create(void). Removed includes mixer.h and random.h from src/object.c.
Migration sentinel shape
src/hiscore.c, src/settings.c
Changed MIGRATE_COMMANDS array sentinels from single NULL to triple NULL initializer (e.g., { NULL, NULL, NULL }) to match the DbQuery struct fields; termination logic unchanged.
Price check logic
src/item.c
Replaced item->price truthiness check with explicit item->price > 0 in item_collected for cost handling.
Build linkage
lib/lua-5.3.5/CMakeLists.txt
Removed non-MSVC explicit linkage to the math library (-lm) for the lua target.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

enhancement

Poem

I hop through code with careful delight,
Void springs declared in the quiet night.
Tripled sentinels guard migration's gate,
Prices count only when they’re truly great.
No -lm hums — the build feels light. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately reflects the central goal of the changeset—resolving compilation warnings on Mac—by summarizing the broad adjustments without extraneous detail.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mac_compile_warnings_fix

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef866b2 and 6678d1a.

📒 Files selected for processing (9)
  • lib/lua-5.3.5/CMakeLists.txt (0 hunks)
  • src/hiscore.c (1 hunks)
  • src/item.c (1 hunks)
  • src/object.c (2 hunks)
  • src/particle_engine.c (1 hunks)
  • src/settings.c (1 hunks)
  • src/timer.c (1 hunks)
  • src/tooltip_manager.c (1 hunks)
  • src/trap.c (1 hunks)
💤 Files with no reviewable changes (1)
  • lib/lua-5.3.5/CMakeLists.txt
✅ Files skipped from review due to trivial changes (1)
  • src/tooltip_manager.c
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/settings.c
  • src/object.c
🧰 Additional context used
🧬 Code graph analysis (1)
src/item.c (1)
src/item_builder.c (1)
  • pickup_gold (106-112)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Windows (MSVC)
  • GitHub Check: Analyze (c-cpp)
🔇 Additional comments (5)
src/timer.c (1)

24-24: LGTM: Function signature standardized.

Explicitly declaring void parameters is C best practice—an empty parameter list () technically allows any arguments, while (void) enforces zero parameters at compile time.

src/item.c (1)

92-92: LGTM: Explicit positive check prevents negative price edge case.

Changing from truthiness (item->price) to an explicit positive comparison (item->price > 0) prevents the block from executing when item->price is negative. The old code would have incorrectly deducted a negative amount (adding gold) and displayed a nonsensical cost label. The new code is both clearer and more correct.

src/trap.c (1)

27-27: LGTM: Function signature standardized.

Consistent with the PR-wide pattern of explicitly declaring void parameters for no-argument functions.

src/hiscore.c (1)

44-44: LGTM: Sentinel explicitly initializes all struct fields.

The DbQuery struct has three fields (stmt, cb, cb_arg). Explicitly writing { NULL, NULL, NULL } is clearer than { NULL } (which relies on implicit zero-initialization of remaining fields) and eliminates partial-initialization warnings.

src/particle_engine.c (1)

351-351: LGTM: Function signature standardized.

Consistent with the PR-wide pattern of explicitly declaring void parameters for no-argument functions.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@LiquidityC LiquidityC force-pushed the mac_compile_warnings_fix branch from ef866b2 to 6678d1a Compare October 7, 2025 17:05
@LiquidityC LiquidityC merged commit dedf0fc into dev Oct 7, 2025
9 checks passed
@LiquidityC LiquidityC deleted the mac_compile_warnings_fix branch October 7, 2025 17:14
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.

1 participant