Skip to content

PS-10970 fix clang volatile warnings#15

Open
lukin-oleksiy wants to merge 1 commit into
Percona-Lab:masterfrom
lukin-oleksiy:PS-10970-fix-clang22-compilation-warnings
Open

PS-10970 fix clang volatile warnings#15
lukin-oleksiy wants to merge 1 commit into
Percona-Lab:masterfrom
lukin-oleksiy:PS-10970-fix-clang22-compilation-warnings

Conversation

@lukin-oleksiy

Copy link
Copy Markdown

https://perconadev.atlassian.net/browse/PS-10970

Fix Clang volatile deprecation warnings in src/linuxthreads.cc, and silence the related empty-struct C/C++ compatibility warning in src/elfcore.cc.

Also enable the appropriate compiler-specific C++ warning in src/CMakeLists.txt (-Wdeprecated-volatile for Clang/AppleClang, -Wvolatile for GCC).

A broader -Wall cleanup is intentionally out of scope for this PR, since it introduces a larger set of unrelated legacy warnings and would make this change much less focused and riskier to review.

https://perconadev.atlassian.net/browse/PS-10970

Fix Clang volatile deprecation warnings in `src/linuxthreads.cc`, and silence
the related empty-struct C/C++ compatibility warning in `src/elfcore.cc`.

Also enable the appropriate compiler-specific C++ warning in
`src/CMakeLists.txt` (`-Wdeprecated-volatile` for Clang/AppleClang,
`-Wvolatile` for GCC).

A broader `-Wall` cleanup is intentionally out of scope for this PR, since it
introduces a larger set of unrelated legacy warnings and would make this change
much less focused and riskier to review.
Comment thread src/elfcore.cc
#define regs i386_regs /* General purpose registers */
#elif defined(__ARM_ARCH_3__)
typedef struct fpxregs { /* No extended FPU registers on ARM */
uint8_t unused;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I didn't analyze the whole thing, but see that there are places like memcpy(fpx, scratch, sizeof(struct fpxregs)); in code...

Comment thread src/CMakeLists.txt
target_compile_options(
coredumper PRIVATE
$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wdeprecated-volatile>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wvolatile>

@inikep inikep May 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This may require a quite new cmake version. Please check it.

Comment thread src/linuxthreads.cc
/* to do so in sys_ptrace_detach(). */
sys_sched_yield();
sys_ptrace(PTRACE_KILL, sig_pids[sig_num_threads], 0, 0);
sys_ptrace(PTRACE_KILL, sig_pids[next_thread], 0, 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The issue here seems to be sig_num_threads-- for sig_num_threads=0.
Isn't it much easier to use:

while (sig_num_threads > 0) {
sys_sched_yield();
sys_ptrace(PTRACE_KILL, sig_pids[sig_num_threads], 0, 0);
sig_num_threads--;
}

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.

3 participants