[Openmp-commits] [PATCH] D102230: [libomptarget][amdgpu][nfc] Expand errorcheck macros

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed May 12 07:21:55 PDT 2021


JonChesterfield added inline comments.


================
Comment at: openmp/libomptarget/plugins/amdgpu/impl/data.cpp:60
   if (err != HSA_STATUS_SUCCESS)
     ret = ATMI_STATUS_ERROR;
 
----------------
JonChesterfield wrote:
> protze.joachim wrote:
> > This line cannot be reached with your change.
> Then it was unreachable before. Not great, kind of why I don't like control flow escaping macros.
> 
> All this change does is macroexpand ErrorCheck et al and s_else {};__g then clang format. Quite literally, I write this with regex replace / run preprocessor / regex replace.
> 
> Functional changes / stuff that requires thought intentionally left for the next round. See also D102228 for the previous incremental change which made that scripting simple.
I.e. before we had 
```
#define ErrorCheck(msg, status)            \
  if (status != HSA_STATUS_SUCCESS) {                       \
    printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__, msg, \
           get_error_string(status));         \
    exit(1);  }
```
ErrorCheck("atmi_malloc", err);

which expands to
if (err != HSA_STATUS_SUCCESS) {printf(); exit(1); }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102230/new/

https://reviews.llvm.org/D102230



More information about the Openmp-commits mailing list