public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] Use intptr_t rather than long in chew
Date: Wed, 15 Feb 2023 17:28:41 +0000 (GMT)	[thread overview]
Message-ID: <20230215172841.0F57E3858D35@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=126eff23d218581ce91560bc088fb550aac36942

commit 126eff23d218581ce91560bc088fb550aac36942
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Feb 7 12:03:37 2023 -0700

    Use intptr_t rather than long in chew
    
    To implement variables in chew, it's convenient to have a
    pointer-sized integer on the stack.  To this end, use intptr_t rather
    than long.
    
    2023-02-07  Tom Tromey  <tom@tromey.com>
    
            * doc/chew.c (pcu) <l>: Now intptr_t.
            (internal_mode, istack, isp): Likewise.
            (bang, atsign): Use intptr_t.

Diff:
---
 bfd/ChangeLog  |  6 ++++++
 bfd/doc/chew.c | 13 +++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9b8e1fc6373..72c70e6e91d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2023-02-07  Tom Tromey  <tom@tromey.com>
+
+	* doc/chew.c (pcu) <l>: Now intptr_t.
+	(internal_mode, istack, isp): Likewise.
+	(bang, atsign): Use intptr_t.
+
 2023-02-07  Tom Tromey  <tom@tromey.com>
 
 	* doc/proto.str (SYNOPSIS): Don't use paramstuff.
diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c
index df522225b3f..510a8e968c5 100644
--- a/bfd/doc/chew.c
+++ b/bfd/doc/chew.c
@@ -85,6 +85,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 
 #define DEF_SIZE 5000
 #define STACK 50
@@ -105,7 +106,7 @@ typedef union
   void (*f) (void);
   struct dict_struct *e;
   char *s;
-  long l;
+  intptr_t l;
 } pcu;
 
 typedef struct dict_struct
@@ -118,7 +119,7 @@ typedef struct dict_struct
 } dict_type;
 
 int internal_wanted;
-int internal_mode;
+intptr_t internal_mode;
 
 int warning;
 
@@ -128,8 +129,8 @@ string_type *tos;
 unsigned int idx = 0; /* Pos in input buffer */
 string_type *ptr; /* and the buffer */
 
-long istack[STACK];
-long *isp = &istack[0];
+intptr_t istack[STACK];
+intptr_t *isp = &istack[0];
 
 dict_type *root;
 
@@ -1300,7 +1301,7 @@ compile (char *string)
 static void
 bang (void)
 {
-  *(long *) ((isp[0])) = isp[-1];
+  *(intptr_t *) ((isp[0])) = isp[-1];
   isp -= 2;
   icheck_range ();
   pc++;
@@ -1309,7 +1310,7 @@ bang (void)
 static void
 atsign (void)
 {
-  isp[0] = *(long *) (isp[0]);
+  isp[0] = *(intptr_t *) (isp[0]);
   pc++;
 }

                 reply	other threads:[~2023-02-15 17:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230215172841.0F57E3858D35@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=bfd-cvs@sourceware.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.
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).