Skip to content

mtcp_restart.c/sleep2: C23:specify args of fnc ptr - #1239

Merged
gc00 merged 1 commit into
dmtcp:mainfrom
gc00:c23-fix
Mar 14, 2026
Merged

gc00 merged 1 commit into
dmtcp:mainfrom
gc00:c23-fix

Conversation

@gc00

@gc00 gc00 commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

C23 requires that function pointer types must include the arguments in the signature. In C23, the old way is no longer deprecated, but now not supported. This fixes that.

Summary by CodeRabbit

  • Bug Fixes

    • Adjusted public function-pointer typedefs used for restart callbacks to align declarations and call sites.
  • Tests

    • Minor comment/order change in a sleep test file; no functional behavior change.

@gc00
gc00 requested review from karya0 and xuyao00 March 11, 2026 16:19
@gc00 gc00 added the bug label Mar 11, 2026
@coderabbitai

coderabbitai Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0ba18262-be25-4c43-aa1c-72319333f07e

📥 Commits

Reviewing files that changed from the base of the PR and between 47b59e2 and 3a05306.

📒 Files selected for processing (3)
  • src/mtcp/mtcp_restart.c
  • src/mtcp/mtcp_restart.h
  • test/plugin/sleep2/sleep2.c
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/mtcp/mtcp_restart.c
  • src/mtcp/mtcp_restart.h

📝 Walkthrough

Walkthrough

Refines function-pointer typedefs for restart logic: adds fnptr_post_restart_t and adjusts fnptr_t to accept struct RestoreInfo *. Updates local usage in restorememoryareas. A test plugin file only has a comment relocation (no behavioral change).

Changes

Cohort / File(s) Summary
Restart header typedefs
src/mtcp/mtcp_restart.h
Added forward declaration struct RestoreInfo;; changed fnptr_t to take struct RestoreInfo *; added new fnptr_post_restart_t typedef (double, int).
Restart implementation usage
src/mtcp/mtcp_restart.c
Replaced local post-restart callback pointer type/cast in restorememoryareas from fnptr_t to fnptr_post_restart_t; call site unchanged.
Test plugin comment only
test/plugin/sleep2/sleep2.c
Moved a comment around the real_sleep/real_fnc declaration; no functional or signature changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through typedef fields today,
Swapped names and nudged a cast away.
Pointers tidy, no surprises found,
A quiet patch, soft on the ground.
🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 directly describes the main change: updating function pointer type declarations in mtcp_restart.c/sleep2 to specify argument lists for C23 compliance, which aligns with the primary objective of the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@xuyao00 xuyao00 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gc00
gc00 merged commit abec9db into dmtcp:main Mar 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants