• Benjamin Sergeant's avatar
    openmp_wrapper.h stubs signature use __GOMP_NOTHROW (#3923) · 89da9902
    Benjamin Sergeant authored
    
    
    * openmp_wrapper.h stubs signature use __GOMP_NOTHROW
    
    Fix #3915. OpenMP stubs do not use the noexcept attibute which is present in the gcc version of openmp, and which trigger compilation errors as seen below. dmlc-core uses the same technique and macro.
    
    /usr/lib/gcc/x86_64-linux-gnu/9/include/omp.h:114:12: error: declaration of ‘int omp_get_thread_num() noexcept’ has a different exception specifier
      114 | extern int omp_get_thread_num (void) __GOMP_NOTHROW;
          |            ^~~~~~~~~~~~~~~~~~
    ...
    xxx/include/LightGBM/utils/openmp_wrapper.h:81:14: note: from previous declaration ‘int omp_get_thread_num()’
       81 |   inline int omp_get_thread_num() {return 0;}
          |              ^~~~~~~~~~~~~~~~~~
    
    * move __GOMP_NOTHROW definition in the no open mp stub conditional branch
    
    * Update include/LightGBM/utils/openmp_wrapper.h
    
    Yes make sense, just changed it
    Co-authored-by: default avatarJames Lamb <jaylamb20@gmail.com>
    
    * add NOLINT macro to disable cpplint on a safe line of code
    Co-authored-by: default avatarJames Lamb <jaylamb20@gmail.com>
    89da9902
openmp_wrapper.h 2.8 KB