Skip to content

Commit

Permalink
fix some cpu.cpp warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Dec 21, 2023
1 parent d30af29 commit 54340fd
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static int detectisa(const void* some_inst)
static int g_sigill_caught = 0;
static sigjmp_buf g_jmpbuf;

static void catch_sigill(int signo, siginfo_t* si, void* data)
static void catch_sigill(int /*signo*/, siginfo_t* /*si*/, void* /*data*/)
{
g_sigill_caught = 1;
siglongjmp(g_jmpbuf, -1);
Expand All @@ -248,10 +248,11 @@ static int detectisa(void (*some_inst)())
{
g_sigill_caught = 0;

struct sigaction sa = {0};
struct sigaction sa;
struct sigaction old_sa;
sa.sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO;
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = catch_sigill;
sa.sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO;
sigaction(SIGILL, &sa, &old_sa);

if (sigsetjmp(g_jmpbuf, 1) == 0)
Expand Down Expand Up @@ -2043,12 +2044,12 @@ CpuSet::CpuSet()

void CpuSet::enable(int cpu)
{
mask |= (1 << cpu);
mask |= ((ULONG_PTR)1 << cpu);
}

void CpuSet::disable(int cpu)
{
mask &= ~(1 << cpu);
mask &= ~((ULONG_PTR)1 << cpu);
}

void CpuSet::disable_all()
Expand All @@ -2058,7 +2059,7 @@ void CpuSet::disable_all()

bool CpuSet::is_enabled(int cpu) const
{
return mask & (1 << cpu);
return mask & ((ULONG_PTR)1 << cpu);
}

int CpuSet::num_enabled() const
Expand Down Expand Up @@ -2117,12 +2118,12 @@ CpuSet::CpuSet()

void CpuSet::enable(int cpu)
{
policy |= (1 << cpu);
policy |= ((unsigned int)1 << cpu);
}

void CpuSet::disable(int cpu)
{
policy &= ~(1 << cpu);
policy &= ~((unsigned int)1 << cpu);
}

void CpuSet::disable_all()
Expand All @@ -2132,7 +2133,7 @@ void CpuSet::disable_all()

bool CpuSet::is_enabled(int cpu) const
{
return policy & (1 << cpu);
return policy & ((unsigned int)1 << cpu);
}

int CpuSet::num_enabled() const
Expand Down

0 comments on commit 54340fd

Please sign in to comment.