This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Eliminate warning when declaring OpenCL builtin functions
ClosedPublic

Authored by yaxunl on Jan 28 2016, 12:51 PM.

Details

Summary

OpenCL builtin functions are usually declared in header files. Currently clang emits warning for OpenCL builtin functions which have the same name as standard C library functions, e.g.

builtin.cl:1:37: warning: incompatible redeclaration of library function 'acos'
float __attribute__((overloadable)) acos(float);
                                    ^
builtin.cl:1:37: note: 'acos' is a builtin with type 'double (double)'

This commit eliminates such warnings.

Diff Detail

Event Timeline

yaxunl updated this revision to Diff 46307.Jan 28 2016, 12:51 PM
yaxunl retitled this revision from to [OpenCL] Eliminate warning when declaring OpenCL builtin functions.
yaxunl updated this object.
yaxunl added a subscriber: tstellarAMD.
yaxunl added a subscriber: cfe-commits.
pxli168 added inline comments.Jan 28 2016, 6:48 PM
lib/Sema/SemaLookup.cpp
698

I think the

C99 standard headers

can cover those

...
ctype.h, complex.h, errno.h, fenv.h, float.h, inttypes.h, limits.h,
locale.h, setjmp.h, signal.h, stdarg.h, stdio.h, stdlib.h, string.h,
// tgmath.h, time.h, wchar.h and wctype.h

The comment shuold not be copy and paste as Anastasia will say.

yaxunl updated this revision to Diff 46390.Jan 29 2016, 9:14 AM
yaxunl updated this object.

revised as Xiuli suggested.

Anastasia added inline comments.Jan 29 2016, 9:32 AM
lib/Sema/SemaLookup.cpp
698

Absolutely! Just a reference to the section in spec and a short summary sentence should be enough.

However, could we also combine this with CPP comment above (see another comment).

699

I think we could combine this with the CPP check above?

yaxunl updated this revision to Diff 46395.Jan 29 2016, 10:19 AM
yaxunl marked an inline comment as done.

revised as Anastasia suggested.

Anastasia accepted this revision.Feb 1 2016, 8:54 AM
Anastasia edited edge metadata.

LGTM!

This revision is now accepted and ready to land.Feb 1 2016, 8:54 AM
pekka.jaaskelainen edited edge metadata.
pxli168 accepted this revision.Feb 1 2016, 6:42 PM
pxli168 edited edge metadata.

Thanks, LGTM!

yaxunl closed this revision.Feb 3 2016, 12:32 PM

committed

I see you have committed this patch, you can try to follow the guide here:
http://llvm.org/docs/Phabricator.html#committing-a-change
To add something in your commit and then the system will automatic close the diff and have link to the commmit.
This will help others to find the review process and easy to track the commit.
Or you can just use the arc tool to make the commit automatically.
Thanks
Xiuli

yaxunl added a comment.Feb 4 2016, 6:20 AM

Thanks Xiuli.

It seems the review was not closed automatically due to missing Differential Revision: <URL> at the end of commit message. Next time I will add the url to the review summary.