[all-commits] [llvm/llvm-project] 17d833: [OpenMP] Allow <math.h> to go first in C++-mode in...

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Thu Apr 9 20:12:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 17d83342235f01d4b110dc5d4664fe96f6597f11
      https://github.com/llvm/llvm-project/commit/17d83342235f01d4b110dc5d4664fe96f6597f11
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-09 (Thu, 09 Apr 2020)

  Changed paths:
    M clang/lib/Headers/openmp_wrappers/math.h
    M clang/test/Headers/Inputs/include/math.h
    M clang/test/Headers/nvptx_device_math_sincos.cpp

  Log Message:
  -----------
  [OpenMP] Allow <math.h> to go first in C++-mode in target regions

If we are in C++ mode and include <math.h> (not <cmath>) first, we still
need to make sure <cmath> is read first. The problem otherwise is that
we haven't seen the declarations of the math.h functions when the system
math.h includes our cmath overlay. However, our cmath overlay, or better
the underlying overlay, e.g. CUDA, uses the math.h functions. Since we
haven't declared them yet we get errors. CUDA avoids this by eagerly
declaring all math functions (in the __device__ space) but we cannot do
this. Instead we break the dependence by forcing cmath to go first.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D77774




More information about the All-commits mailing list