33 lines · c
1//===-- Wrapper for C standard stdlib.h declarations on the GPU -----------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef __CLANG_LLVM_LIBC_WRAPPERS_STDLIB_H__10#define __CLANG_LLVM_LIBC_WRAPPERS_STDLIB_H__11 12#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__)13#error "This file is for GPU offloading compilation only"14#endif15 16#include_next <stdlib.h>17 18#if defined(__HIP__) || defined(__CUDA__)19#define __LIBC_ATTRS __attribute__((device))20#else21#define __LIBC_ATTRS22#endif23 24#pragma omp begin declare target25 26// TODO: Define these for CUDA / HIP.27 28#pragma omp end declare target29 30#undef __LIBC_ATTRS31 32#endif // __CLANG_LLVM_LIBC_WRAPPERS_STDLIB_H__33