9#ifndef __CLANG_LLVM_LIBC_WRAPPERS_STDLIB_H__
10#define __CLANG_LLVM_LIBC_WRAPPERS_STDLIB_H__
12#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__)
13#error "This file is for GPU offloading compilation only"
16#include_next <stdlib.h>
18#if __has_include(<llvm-libc-decls/stdlib.h>)
20#if defined(__HIP__) || defined(__CUDA__)
21#define __LIBC_ATTRS __attribute__((device))
24#pragma omp begin declare target
27typedef void (*__atexithandler_t)(void);
28typedef int (*__bsearchcompare_t)(
const void *,
const void *);
29typedef int (*__qsortcompare_t)(
const void *,
const void *);
30typedef int (*__qsortrcompare_t)(
const void *,
const void *,
void *);
33_Static_assert(__builtin_offsetof(div_t, quot) == 0,
"ABI mismatch!");
34_Static_assert(__builtin_offsetof(ldiv_t, quot) == 0,
"ABI mismatch!");
35_Static_assert(__builtin_offsetof(lldiv_t, quot) == 0,
"ABI mismatch!");
37#if defined(__GLIBC__) && __cplusplus >= 201703L
38#define at_quick_exit atexit
41#include <llvm-libc-decls/stdlib.h>
43#if defined(__GLIBC__) && __cplusplus >= 201703L
47#pragma omp end declare target