unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Collin Funk <collin.funk1@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>,  emacs-devel@gnu.org
Subject: Re: master a86c25c91f3 11/13: Prefer -I to -isystem
Date: Wed, 17 Jul 2024 09:20:06 -0700	[thread overview]
Message-ID: <87ed7suh1l.fsf@gmail.com> (raw)
In-Reply-To: <868qy0gmjp.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 Jul 2024 16:44:58 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>   d:/usr/include/glib-2.0/gobject/gparam.h:157:35: warning: result of '1 << 31' requires 33 bits to represent, but 'int' only has 32 bits [-Wshift-overflow=]
>     157 |   G_PARAM_DEPRECATED          = 1 << 31
> 	|                                   ^~
>
> While arguably a bug in Glib, the diagnostic is an annoyance, so I'd
> like to avoid it.  I've verified that -Wno-system-headers doesn't
> remove it.  -Wno-shift-overflow does, but I don't think suppressing
> that globally is a good idea.

It is a bug since (1 * 2^31) is equal to INT_MAX + 1 on most platforms.
C23 § 6.5.7 says this is undefined behavior [1].

GCC and Clang both seem to handle it fine but the warning is correct.
Although it is annoying when it occurs in included headers. I ran into a
similar issue with GCC intrinsic doing (1 << 31) too. The glib bug was
fixed at some point since my system has:

  G_PARAM_DEPRECATED          = (gint)(1u << 31)

Which is the same as I did for GCC.

Collin

[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf



      parent reply	other threads:[~2024-07-17 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 13:44 master a86c25c91f3 11/13: Prefer -I to -isystem Eli Zaretskii
2024-07-17 15:31 ` Paul Eggert
2024-07-17 16:04   ` Eli Zaretskii
2024-07-17 16:20 ` Collin Funk [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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87ed7suh1l.fsf@gmail.com \
    --to=collin.funk1@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).