Files
llvm-project/libc/test/include/sched_test.cpp
Petter Berntsson 66955aa800 [libc][sched] Fix CPU_SET and CPU_ISSET macros (#194830)
Fix the public CPU_SET and CPU_ISSET macros to match the expected
two-argument forms and to use cpu_set_t instead of the misspelled
cpt_set_t.

Also declare the helper functions used by the CPU set macros in the
generated sched.h header, and add regression coverage for the CPU set
macro family.
2026-04-30 16:54:56 +01:00

27 lines
1.0 KiB
C++

//===-- Unittests for sched -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <sched.h>
template <typename T, typename U> struct SameType {
static constexpr bool value = false;
};
template <typename T> struct SameType<T, T> {
static constexpr bool value = true;
};
// Use unevaluated contexts to verify the public macro declarations without
// requiring this include test to link the helper entrypoints.
static_assert(SameType<decltype(CPU_ZERO((cpu_set_t *)0)), void>::value, "");
static_assert(SameType<decltype(CPU_COUNT((cpu_set_t *)0)), int>::value, "");
static_assert(SameType<decltype(CPU_SET(0, (cpu_set_t *)0)), void>::value, "");
static_assert(SameType<decltype(CPU_ISSET(0, (cpu_set_t *)0)), int>::value, "");
extern "C" int main() { return 0; }