[PATCH] Suppress 'unused function' warnings on specialized template functions

Halfdan Ingvarsson halfdan at sidefx.com
Mon Apr 15 09:58:35 PDT 2013


Er.. Ping?

Or would it be better if by default I submitted to llvm-reviews first? I 
just followed the process as laid out in "Hacking Clang".

Thanks!

  - ½

On 13-04-10 05:05 PM, Halfdan Ingvarsson wrote:
> Hello
>
> This is my first patch submission, although I've been using clang as 
> my primary work compiler for over a year.
>
> It's a simple suppression on unused function warnings 
> (-Wunused-function) for specialized template functions, whose primary 
> template has a static storage class. E.g:
>
> ---- 8< ----
> template<typename T> static inline bool
> isNonZero(T a) { return (bool)a; }
>
> template<> inline bool
> isNonZero(const char *s) { return s; }
> ---- 8< ---
>
> Currently the second definition will emit an unused warning.
>
> The attached patch uses the storage class from the primary template 
> when checking whether to omit static inline functions from the unused 
> warnings (since specializations implicitly inherit this storage class).
>
>  - ½
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130415/f6016cf5/attachment.html>


More information about the cfe-commits mailing list