Dominique Pelle wrote:
> When compiling the athena GUI of Vim with clang,
> I see those warnings:
>
> gui_at_fs.c:2594:44: warning: cast to 'XtPointer' (aka 'void *') from
> smaller integer type 'Cardinal'
> (aka 'unsigned int') [-Wint-to-void-pointer-cast]
> (XtCallbackProc)SFvAreaSelectedCallback, (XtPointer)n);
> ^
> gui_at_fs.c:2619:44: warning: cast to 'XtPointer' (aka 'void *') from
> smaller integer type 'Cardinal'
> (aka 'unsigned int') [-Wint-to-void-pointer-cast]
> (XtCallbackProc)SFhAreaSelectedCallback, (XtPointer)n);
> ^
>
> It is casting an 'int' into a pointer which looks dangerous
> on 64-bits systems at least. However, the callback casts
> the pointer value back into int so it's OK in practice.
> In several other places, the warning was already silenced
> by doing a cast into (long_u) so attached patch does the
> same.
>
> I see the other warning below, but I don't think that there
> is any nice way to silence it:
>
> gui_x11.c:2546:26: warning: will never be executed [-Wunreachable-code]
> ? sizeof(wchar_t) : sizeof(XChar2b)));
> ^~~~~~~~~~~~~~~
>
> We could do something like this but it's uglier that
> the warning ifself, and the unknown pragma for
> some other compilers may even cause warnings
> for other compilers:
>
>
> @@ -2542,8 +2542,15 @@
> if (buflen < len)
> {
> XtFree((char *)buf);
> +
> +#pragma clang diagnostic push
> +#pragma clang diagnostic ignored "-Wunreachable-code"
> +
> buf = (void *)XtMalloc(len * (sizeof(XChar2b) < sizeof(wchar_t)
> ? sizeof(wchar_t) : sizeof(XChar2b)));
> +
> +#pragma clang diagnostic pop
> +
> buflen = len;
> }
> p = s;
>
>
> Anybody still using the Vim athena gui? :-)
You are! :-) I must say that using Athena with 64 bit would be very
rare.
Anyway, I'll add your patch to the todo list.
--
God made the integers; all else is the work of Man.
-- Kronecker
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.