|
|
|||
File indexing completed on 2026-05-10 08:45:13
0001 /* 0002 * SPDX-FileCopyrightText: Copyright (c) 2009-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 0003 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0004 * 0005 * Licensed under the Apache License, Version 2.0 (the "License"); 0006 * you may not use this file except in compliance with the License. 0007 * You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 * 0017 * Licensed under the Apache License v2.0 with LLVM Exceptions. 0018 * See https://nvidia.github.io/NVTX/LICENSE.txt for license information. 0019 */ 0020 0021 #if defined(NVTX_AS_SYSTEM_HEADER) 0022 #if defined(__clang__) 0023 #pragma clang system_header 0024 #elif defined(__GNUC__) || defined(__NVCOMPILER) 0025 #pragma GCC system_header 0026 #elif defined(_MSC_VER) 0027 #pragma system_header 0028 #endif 0029 #endif 0030 0031 #ifndef __NVTX_LINKONCE_H__ 0032 #define __NVTX_LINKONCE_H__ 0033 0034 /* This header defines macros to permit making definitions of global variables 0035 * and functions in C/C++ header files which may be included multiple times in 0036 * a translation unit or linkage unit. It allows authoring header-only libraries 0037 * which can be used by multiple other header-only libraries (either as the same 0038 * copy or multiple copies), and does not require any build changes, such as 0039 * adding another .c file, linking a static library, or deploying a dynamic 0040 * library. Globals defined with these macros have the property that they have 0041 * the same address, pointing to a single instance, for the entire linkage unit. 0042 * It is expected but not guaranteed that each linkage unit will have a separate 0043 * instance. 0044 * 0045 * In some situations it is desirable to declare a variable without initializing 0046 * it, refer to it in code or other variables' initializers, and then initialize 0047 * it later. Similarly, functions can be prototyped, have their address taken, 0048 * and then have their body defined later. In such cases, use the FWDDECL macros 0049 * when forward-declaring LINKONCE global variables without initializers and 0050 * function prototypes, and then use the DEFINE macros when later defining them. 0051 * Although in many cases the FWDDECL macro is equivalent to the DEFINE macro, 0052 * following this pattern makes code maximally portable. 0053 */ 0054 0055 #if defined(_MSC_VER) /* MSVC */ 0056 #if defined(__cplusplus) 0057 #define NVTX_LINKONCE_DEFINE_GLOBAL extern "C" __declspec(selectany) 0058 #define NVTX_LINKONCE_DEFINE_FUNCTION extern "C" inline 0059 #else 0060 #define NVTX_LINKONCE_DEFINE_GLOBAL __declspec(selectany) 0061 #define NVTX_LINKONCE_DEFINE_FUNCTION __inline 0062 #endif 0063 #define NVTX_LINKONCE_FWDDECL_GLOBAL NVTX_LINKONCE_DEFINE_GLOBAL extern 0064 #elif defined(_WIN32) || defined(__CYGWIN__) /* MinGW */ 0065 #if defined(__cplusplus) 0066 #define NVTX_LINKONCE_DEFINE_GLOBAL __declspec(selectany) 0067 #define NVTX_LINKONCE_DEFINE_FUNCTION extern "C" inline 0068 #else 0069 #define NVTX_LINKONCE_DEFINE_GLOBAL __declspec(selectany) 0070 #define NVTX_LINKONCE_DEFINE_FUNCTION 0071 #endif 0072 #define NVTX_LINKONCE_FWDDECL_GLOBAL extern 0073 #else /* All others: Assume GCC, clang, or compatible */ 0074 #define NVTX_LINKONCE_WEAK __attribute__((weak)) 0075 #define NVTX_LINKONCE_HIDDEN __attribute__((visibility("hidden"))) 0076 #if defined(__cplusplus) 0077 #define NVTX_LINKONCE_DEFINE_GLOBAL NVTX_LINKONCE_HIDDEN NVTX_LINKONCE_WEAK 0078 #define NVTX_LINKONCE_DEFINE_FUNCTION extern "C" NVTX_LINKONCE_HIDDEN inline 0079 #else 0080 #define NVTX_LINKONCE_DEFINE_GLOBAL NVTX_LINKONCE_HIDDEN NVTX_LINKONCE_WEAK 0081 #define NVTX_LINKONCE_DEFINE_FUNCTION NVTX_LINKONCE_HIDDEN NVTX_LINKONCE_WEAK 0082 #endif 0083 #define NVTX_LINKONCE_FWDDECL_GLOBAL NVTX_LINKONCE_DEFINE_GLOBAL extern 0084 #endif 0085 0086 #define NVTX_LINKONCE_FWDDECL_FUNCTION NVTX_LINKONCE_DEFINE_FUNCTION 0087 0088 #endif /* __NVTX_LINKONCE_H__ */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|