Skip to content

Commit 3caa2d3

Browse files
author
Vyacheslav Zakharin
committed
[libomptarget][NFC] Avoid gcc 5/6 issue with lambda captures.
Differential Revision: https://reviews.llvm.org/D95486
1 parent ad7aaa4 commit 3caa2d3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

openmp/libomptarget/include/Debug.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ enum OpenMPInfoType : uint32_t {
5353
OMP_INFOTYPE_ALL = 0xffffffff,
5454
};
5555

56-
static inline uint32_t getInfoLevel() {
56+
// Add __attribute__((used)) to work around a bug in gcc 5/6.
57+
static inline uint32_t __attribute__((used)) getInfoLevel() {
5758
static uint32_t InfoLevel = 0;
5859
static std::once_flag Flag{};
5960
std::call_once(Flag, []() {
@@ -64,7 +65,8 @@ static inline uint32_t getInfoLevel() {
6465
return InfoLevel;
6566
}
6667

67-
static inline uint32_t getDebugLevel() {
68+
// Add __attribute__((used)) to work around a bug in gcc 5/6.
69+
static inline uint32_t __attribute__((used)) getDebugLevel() {
6870
static uint32_t DebugLevel = 0;
6971
static std::once_flag Flag{};
7072
std::call_once(Flag, []() {

0 commit comments

Comments
 (0)