This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by jdoerfert on Apr 8 2020, 8:53 PM.

Details

Summary

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.

Diff Detail

Event Timeline

jdoerfert created this revision.Apr 8 2020, 8:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2020, 8:53 PM
JonChesterfield accepted this revision.Apr 9 2020, 4:34 PM
JonChesterfield added a subscriber: JonChesterfield.

The cmath/math.h story makes me sad, but this is a good workaround. Thanks

This revision is now accepted and ready to land.Apr 9 2020, 4:34 PM
This revision was automatically updated to reflect the committed changes.