From: Tom Tromey <tom@tromey.com>
To: binutils@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 5/8] Use intptr_t rather than long in chew
Date: Wed, 8 Feb 2023 00:17:22 -0700 [thread overview]
Message-ID: <20230208071725.3668898-6-tom@tromey.com> (raw)
In-Reply-To: <20230208071725.3668898-1-tom@tromey.com>
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.
---
bfd/ChangeLog | 6 ++++++
bfd/doc/chew.c | 13 +++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
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++;
}
--
2.39.1
next prev parent reply other threads:[~2023-02-08 7:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 7:17 [PATCH 0/8] Make the BFD info manual a bit prettier Tom Tromey
2023-02-08 7:17 ` [PATCH 1/8] Remove H_CFLAGS from doc/local.mk Tom Tromey
2023-02-08 7:17 ` [PATCH 2/8] Simplify @node use in BFD documentation Tom Tromey
2023-03-03 8:20 ` Jan Beulich
2023-03-03 23:08 ` Tom Tromey
2023-03-06 7:07 ` Jan Beulich
2023-02-08 7:17 ` [PATCH 3/8] Add copyright headers to the .str files Tom Tromey
2023-02-08 7:17 ` [PATCH 4/8] Remove the paramstuff word Tom Tromey
2023-02-08 7:17 ` Tom Tromey [this message]
2023-02-08 7:17 ` [PATCH 6/8] Change internalmode to be an intrinsic variable Tom Tromey
2023-02-08 7:17 ` [PATCH 7/8] Use @deftypefn in chew output Tom Tromey
2023-02-15 17:55 ` Simon Marchi
2023-02-15 23:11 ` Tom Tromey
2023-02-16 1:29 ` Simon Marchi
2023-02-19 3:46 ` Alan Modra
2023-02-08 7:17 ` [PATCH 8/8] Remove RETURNS from BFD chew comments Tom Tromey
2023-02-15 9:54 ` [PATCH 0/8] Make the BFD info manual a bit prettier Nick Clifton
2023-02-15 21:51 ` Tom Tromey
2023-02-16 9:40 ` Nick Clifton
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=20230208071725.3668898-6-tom@tromey.com \
--to=tom@tromey.com \
--cc=binutils@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).