llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.84k stars 11.47k forks source link

[OpenMP] cannot handle double square bracket #64815

Open ye-luo opened 1 year ago

ye-luo commented 1 year ago
#define PRAGMA_OFFLOAD(x) _Pragma(x)

int main()
{
  PRAGMA_OFFLOAD("omp target ompx_attribute([[clang::amdgpu_flat_work_group_size(3, 17)]])")
  for (int i = 0; i < 1000; ++i)
  {}
}

got error

$ clang++ -fopenmp --offload-arch=gfx90a main.cpp
main.cpp:5:3: warning: '[' tokens introducing attribute appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
    5 |   PRAGMA_OFFLOAD("omp target ompx_attribute([[clang::amdgpu_flat_work_group_size(3, 17)]])")
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:1:27: note: expanded from macro 'PRAGMA_OFFLOAD'
    1 | #define PRAGMA_OFFLOAD(x) _Pragma(x)
      |                           ^~~~~~~~~~
<scratch space>:2:28: note: expanded from here
    2 |  omp target ompx_attribute([[clang::amdgpu_flat_work_group_size(3, 17)]])
      |                            ^
main.cpp:5:3: note: second '[' token is here
llvmbot commented 1 year ago

@llvm/issue-subscribers-openmp

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-frontend