all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andy Moreton <andrewjmoreton@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Warnings in mingw64 build on emacs-28 branch
Date: Sun, 07 Nov 2021 20:55:44 +0000	[thread overview]
Message-ID: <86pmrblm7j.fsf@gmail.com> (raw)
In-Reply-To: 83tugn7n5f.fsf@gnu.org

On Sun 07 Nov 2021, Eli Zaretskii wrote:

>> From: Andy Moreton <andrewjmoreton@gmail.com>
>> Date: Sun, 07 Nov 2021 19:41:51 +0000
>> 
>> In set_frame_menubar from w32menu.c, this shows the warning:
>> 
>> 	memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
>>  		previous_menu_items_used * word_size);
>> 
>> ...and this placates the compiler:
>> 
>> 	memcpy (previous_items, xvector_contents (f->menu_bar_vector),
>>  		previous_menu_items_used * word_size);
>
> That doesn't explain why we don't need the same in the other places
> where memcpy and XVECTOR are used exactly like in w32menu.c, at least
> AFAICT.

I suspect that understanding that will require the expertise of someone
with deep knowledge of gcc internals.

> What your trick does is hide XVECTOR behind enough indirections for
> the compiler to lose sight of what is going on.  That is fine, but as
> compilers look deeper and deeper, this trick will one day cease to be
> enough.  Thus, I'd still prefer to understand why the other calls of
> memcpy don't trigger similar warnings.

True, but hopefully by the time compilers can see past the indirections,
they can also perform a correct analysis of shallower paths.

Such accessor helpers are surely useful anyway, as they make the
callsites clearer (and if used consistently, allow the
implementation to be changed without changing the callers).

    AndyM





      reply	other threads:[~2021-11-07 20:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07 14:46 Warnings in mingw64 build on emacs-28 branch Andy Moreton
2021-11-07 15:05 ` Eli Zaretskii
2021-11-07 15:51   ` Óscar Fuentes
2021-11-07 18:39     ` Eli Zaretskii
2021-11-07 19:25       ` Óscar Fuentes
2021-11-07 19:30         ` Eli Zaretskii
2021-11-07 19:57           ` Óscar Fuentes
2021-11-07 20:02             ` Eli Zaretskii
2021-11-07 18:07   ` Andy Moreton
2021-11-07 19:41     ` Andy Moreton
2021-11-07 19:59       ` Eli Zaretskii
2021-11-07 20:55         ` Andy Moreton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86pmrblm7j.fsf@gmail.com \
    --to=andrewjmoreton@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.