| 1 |
// clang-format off |
| 2 |
// RUN: %libomp-compile-and-run 2>&1 | sort | FileCheck %s |
| 3 |
// REQUIRES: ompt |
| 4 |
// clang-format on |
| 5 |
|
| 6 |
#include <string.h> |
| 7 |
#include <stdio.h> |
| 8 |
#include "callback.h" |
| 9 |
|
| 10 |
// TODO: use error directive when compiler suppors |
| 11 |
typedef void ident_t; |
| 12 |
extern void __kmpc_error(ident_t *, int, const char *); |
| 13 |
|
| 14 |
int main() { |
| 15 |
#pragma omp parallel num_threads(2) |
| 16 |
{ |
| 17 |
if (omp_get_thread_num() == 0) { |
| 18 |
const char *msg = "User message goes here"; |
| 19 |
printf("0: Message length=%" PRIu64 "\n", (uint64_t)strlen(msg)); |
| 20 |
__kmpc_error(NULL, ompt_warning, msg); |
| 21 |
} |
| 22 |
} |
| 23 |
return 0; |
| 24 |
} |
| 25 |
|
| 26 |
// clang-format off |
| 27 |
// CHECK: {{^}}0: Message length=[[LENGTH:[0-9]+]] |
| 28 |
// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] |
| 29 |
|
| 30 |
// CHECK: {{^}}[[PRIMARY_ID:[0-9]+]]: ompt_event_implicit_task_begin |
| 31 |
// CHECK: {{^}}[[PRIMARY_ID]]: ompt_event_runtime_error |
| 32 |
// CHECK-SAME: severity=1 |
| 33 |
// CHECK-SAME: message=User message goes here |
| 34 |
// CHECK-SAME: length=[[LENGTH]] |
| 35 |
// CHECK-SAME: codeptr_ra={{(0x)?[0-f]+}} |
| 36 |
|
| 37 |
// Message from runtime |
| 38 |
// CHECK: {{^}}OMP: Warning{{.*}}User message goes here |
| 39 |
// clang-format on |