]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use intptr_t rather than long in chew
authorTom Tromey <tom@tromey.com>
Tue, 7 Feb 2023 19:03:37 +0000 (12:03 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 15 Feb 2023 17:27:34 +0000 (10:27 -0700)
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
bfd/doc/chew.c

index 9b8e1fc637370eefe5fd2ddd2ff1c029e66baca9..72c70e6e91d0cc575c54ceef3f82a8aa1c75ea50 100644 (file)
@@ -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.
index df522225b3fe9729fe2b04be995790632ee9bcb2..510a8e968c544cf1b97313f136b8a881d6d7dd95 100644 (file)
@@ -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++;
 }