C23 fix for syscallsreal.c and pid_syscallsreal.c - #1240
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis pull request refactors function pointer wrapper macros and type definitions across multiple files to improve type safety and consistency. Changes include optimizing the Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/syscallsreal.c (1)
486-490: Consider usingREAL_FUNC_PASSTHROUGH_NORETURNfor_real_exit.
exit()is a noreturn function. While the current code works (sinceexit()never returns), usingREAL_FUNC_PASSTHROUGH_NORETURNwould be more semantically correct and consistent with_real_pthread_exitat line 961.♻️ Suggested improvement
LIB_PRIVATE void _real_exit(int status) { - REAL_FUNC_PASSTHROUGH(exit) (status); + REAL_FUNC_PASSTHROUGH_NORETURN(exit) (status); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/syscallsreal.c` around lines 486 - 490, Replace the passthrough macro used in _real_exit to the noreturn variant: currently _real_exit uses REAL_FUNC_PASSTHROUGH(exit) (status) but since exit() is marked noreturn you should call REAL_FUNC_PASSTHROUGH_NORETURN(exit) instead to be semantically correct and consistent with the treatment of _real_pthread_exit; update the invocation in the _real_exit function accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/plugin/pid/pid_syscallsreal.c`:
- Around line 434-435: The wrapper for pthread_exit (the symbol
_real_pthread_exit) incorrectly uses REAL_FUNC_PASSTHROUGH which expands to a
return; change it to REAL_FUNC_PASSTHROUGH_NORETURN so the call invokes the real
pthread_exit without returning; locate the occurrence of
REAL_FUNC_PASSTHROUGH(pthread_exit) in the _real_pthread_exit implementation and
replace it with REAL_FUNC_PASSTHROUGH_NORETURN(pthread_exit) to match other
noreturn wrappers (e.g., the style used in the _real_* implementations in
syscallsreal.c).
---
Nitpick comments:
In `@src/syscallsreal.c`:
- Around line 486-490: Replace the passthrough macro used in _real_exit to the
noreturn variant: currently _real_exit uses REAL_FUNC_PASSTHROUGH(exit) (status)
but since exit() is marked noreturn you should call
REAL_FUNC_PASSTHROUGH_NORETURN(exit) instead to be semantically correct and
consistent with the treatment of _real_pthread_exit; update the invocation in
the _real_exit function accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f1d9d792-5f3c-4659-9659-0e3e012dc0ec
📒 Files selected for processing (6)
src/dmtcp_coordinator.cppsrc/mtcp/mtcp_restart.csrc/mtcp/mtcp_restart.hsrc/plugin/pid/pid_syscallsreal.csrc/syscallsreal.ctest/plugin/sleep2/sleep2.c
c527f16 to
703ccaf
Compare
src/syscallsreal.candsrc/plugin/pid/pid_syscallsreal.cwere going to break when we use a compiler enforcing C23. C23 requires signatures in fnc pointers (to be aligned with C++). Luckily, C23 also makes the built-in,typeof(), part of the C standard. GCC and CLANG always providedtypeof(). But now, all compliant compilers must provide it. So, it's safe for us to use it.And I also cleaned up some minor errors along the way:
.hfiles.)I also tested on Rocky Linux 8 (Linux 4.18 and glibc-2.28). This is an older O/S. So, hopefully, we're not breaking DMTCP on older Linuxes.
Summary by CodeRabbit
Refactor
Bug Fixes