unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Po Lu <luangruo@yahoo.com>
Cc: 53136@debbugs.gnu.org
Subject: bug#53136: 28.0.90; segfault in lock_file
Date: Mon, 10 Jan 2022 15:30:10 -0800	[thread overview]
Message-ID: <ea0e0cad-df5e-9e38-3d7b-19e2f3c8a94e@cs.ucla.edu> (raw)
In-Reply-To: <37cd3017-38cb-fa2c-7b52-fbeb3b085744@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

One little thing I noticed in the Haiku port. I assume the lisp.h 
complication for pD was needed on 32-bit Haiku to avoid compiler 
warnings when passing long vs int (same size, either would work, but 
compiler warning). I installed the attached to simplify the ifdefs here. 
If my diagnosis of the issue is wrong and this patch doesn't work for 
Haiku, please let me know or feel free to revert and we can find a 
better way.

At some point we can get rid of pD by replacing pD with "t" everywhere 
in Emacs, but one step at a time.

[-- Attachment #2: 0001-Assume-C99-when-defining-pD.patch --]
[-- Type: text/x-patch, Size: 1517 bytes --]

From c4cadadea6f03308eb2c25c757431c19b9108e58 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 10 Jan 2022 15:21:08 -0800
Subject: [PATCH] Assume C99 when defining pD

* src/lisp.h (pD): Assume C99 or later, to simplify the ifdefs.
---
 src/lisp.h | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/src/lisp.h b/src/lisp.h
index f8fe2a6906..c5e63110c7 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -137,25 +137,9 @@ verify (BITS_WORD_MAX >> (BITS_PER_BITS_WORD - 1) == 1);
 /* Use pD to format ptrdiff_t values, which suffice for indexes into
    buffers and strings.  Emacs never allocates objects larger than
    PTRDIFF_MAX bytes, as they cause problems with pointer subtraction.
-   In C99, pD can always be "t"; configure it here for the sake of
-   pre-C99 libraries such as glibc 2.0 and Solaris 8.
-
-   On Haiku, the size of ptrdiff_t is inconsistent with the value of
-   PTRDIFF_MAX.  In that case, "t" should be sufficient. */
-
-#ifndef HAIKU
-#if PTRDIFF_MAX == INT_MAX
-# define pD ""
-#elif PTRDIFF_MAX == LONG_MAX
-# define pD "l"
-#elif PTRDIFF_MAX == LLONG_MAX
-# define pD "ll"
-#else
-# define pD "t"
-#endif
-#else
-# define pD "t"
-#endif
+   In C99, pD can always be "t", as we no longer need to worry about
+   pre-C99 libraries such as glibc 2.0 (1997) and Solaris 8 (2000).  */
+#define pD "t"
 
 /* Convenience macro for rarely-used functions that do not return.  */
 #define AVOID _Noreturn ATTRIBUTE_COLD void
-- 
2.32.0


  reply	other threads:[~2022-01-10 23:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <871r1hv40o.fsf.ref@yahoo.com>
2022-01-09  6:04 ` bug#53136: 28.0.90; segfault in lock_file Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-09  7:36   ` Eli Zaretskii
2022-01-09  8:10     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-09  8:42       ` Eli Zaretskii
2022-01-09  9:40         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-09 11:43         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-09 12:03           ` Eli Zaretskii
2022-01-10 23:11             ` Paul Eggert
2022-01-10 23:30               ` Paul Eggert [this message]
2022-01-11  0:51                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11  0:51               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11  1:05                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-12  2:59                   ` Paul Eggert
2022-01-12  3:04                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-12 19:22                       ` Paul Eggert
2022-01-11 12:45                 ` Eli Zaretskii
2022-01-11 13:16                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11 17:05                     ` Paul Eggert
2022-01-12  0:35                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11  0:58               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11 12:30               ` Eli Zaretskii
2022-01-09 12:56           ` Eli Zaretskii
2022-01-09 13:00             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-09 13:10               ` Eli Zaretskii
2022-01-09 13:16                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-09 13:23                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-09 13:30                     ` Eli Zaretskii
2022-01-09 13:47                     ` Andreas Schwab
2022-01-10  0:29                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=ea0e0cad-df5e-9e38-3d7b-19e2f3c8a94e@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=53136@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    /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).