[PATCH] D39481: [CodeGen] fix const-ness of builtin equivalents of <math.h> and <complex.h> functions that might set errno

Sanjay Patel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 15:21:28 PDT 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

As the description in Builtins.def says: "e = const, but only when -fmath-errno=0".

This is step 2 of 3 to fix builtins and math calls as discussed in https://reviews.llvm.org/D39204.

I went through the lists at:
http://en.cppreference.com/w/c/numeric/math
http://en.cppreference.com/w/c/numeric/complex
...and changed all of the builtins that correspond to functions that could set errno.

The math.h functions that are specified to never set errno are:
fmax
fmin
nearbyint

And for complex.h:
creal
cimag
conj
cproj

powi is not a standard libm function, so that's also left as "Fnc".


https://reviews.llvm.org/D39481

Files:
  include/clang/Basic/Builtins.def
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtin-sqrt.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39481.121071.patch
Type: text/x-patch
Size: 20871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171031/2fd3bded/attachment-0001.bin>


More information about the cfe-commits mailing list