[LLVMbugs] [Bug 21348] -Wignored-qualifier noisy on common pattern

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 11 15:12:44 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21348

Sean Silva <chisophugis at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #10 from Sean Silva <chisophugis at gmail.com> ---
(In reply to comment #8)
> Yes its to abstract an issue with some ABIs, and really comes into its own
> when a vector library is cross platform.
> 
> For instance Win32 only passes 3 128bit vectors in register and the rest get
> passed on the stack (and a not a guaranteed 16-byte aligned stack at
> that..). Other targets have issues with passing different size vectors
> (64bit, 256bit, ....), especially when they aren't native.
> 
> The _arg pattern allows us to hide all pass-by-reference vs pass-by-value
> issues - and when used by lightweight functions that get inlined many of
> those reference loads disappear as well.
> 
> But given that _arg types have the potential to be pass-by-reference I'd
> highly recommend to do everything possible to keep the const qualifier on
> all typedefs - otherwise you have the potential to develop on a
> pass-by-value target and not see const modification compile errors that only
> occur on pass-by-reference, or even worse modify the referenced value.

Thanks Simon. That clarifies things. Now that I look at it, all of the cases
I've seen actually use these variations:

typedef const Vec4& Vec4_arg;
// or
typedef const Vec4 Vec4_arg;

which are const anyway, so I guess it makes sense to have clang warn on `const
Vec4_arg` since the const there is just redundant (rather than actively
deceiving as in the case that motivated the warning and that Arthur was talking
about).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141111/7759c924/attachment.html>


More information about the llvm-bugs mailing list