public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sim: bpf: fix printf warnings on 32-bit systems
@ 2021-06-28  1:36 Mike Frysinger
  2021-06-28  1:36 ` [PATCH 2/2] sim: cgen: require long long support Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2021-06-28  1:36 UTC (permalink / raw)
  To: gdb-patches

Use PRI macros to display 64-bit types instead of assuming long is
a 64-bit type itself.
---
 sim/bpf/bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sim/bpf/bpf.c b/sim/bpf/bpf.c
index de77da851eee..4f057387b02c 100644
--- a/sim/bpf/bpf.c
+++ b/sim/bpf/bpf.c
@@ -186,7 +186,7 @@ bpfbf_exit (SIM_CPU *current_cpu)
   /*  r0 holds "return code" */
   DI r0 = GET_H_GPR (0);
 
-  printf ("exit %ld (0x%lx)\n", r0, r0);
+  printf ("exit %" PRId64 " (0x%" PRIx64 ")\n", r0, r0);
 
   sim_engine_halt (sd, current_cpu, NULL, CPU_PC_GET (current_cpu),
                    sim_exited, 0 /* sigrc */);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] sim: cgen: require long long support
  2021-06-28  1:36 [PATCH 1/2] sim: bpf: fix printf warnings on 32-bit systems Mike Frysinger
@ 2021-06-28  1:36 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2021-06-28  1:36 UTC (permalink / raw)
  To: gdb-patches

We require C11 now, so we can assume & require long long exists.
Drop this old code that hasn't been used for a long long time.
---
 sim/common/cgen-types.h | 18 ------------------
 sim/common/cgen-utils.c | 11 -----------
 2 files changed, 29 deletions(-)

diff --git a/sim/common/cgen-types.h b/sim/common/cgen-types.h
index c002876803c7..cb71b6bdda12 100644
--- a/sim/common/cgen-types.h
+++ b/sim/common/cgen-types.h
@@ -31,10 +31,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #define SIM_HAVE_ADDR_RANGE
 
 #ifdef __GNUC__
-#define HAVE_LONGLONG
 #undef DI_FN_SUPPORT
 #else
-#undef HAVE_LONGLONG
 #define DI_FN_SUPPORT
 #endif
 \f
@@ -68,7 +66,6 @@ typedef unsigned8 UQI;
 typedef unsigned16 UHI;
 typedef unsigned32 USI;
 
-#ifdef HAVE_LONGLONG
 typedef signed64 DI;
 typedef unsigned64 UDI;
 #define GETLODI(di) ((SI) (di))
@@ -76,21 +73,6 @@ typedef unsigned64 UDI;
 #define SETLODI(di, val) ((di) = (((di) & 0xffffffff00000000LL) | (val)))
 #define SETHIDI(di, val) ((di) = (((di) & 0xffffffffLL) | (((DI) (val)) << 32)))
 #define MAKEDI(hi, lo) ((((DI) (SI) (hi)) << 32) | ((UDI) (USI) (lo)))
-#else
-/* DI mode support if "long long" doesn't exist.
-   At one point CGEN supported K&R C compilers, and ANSI C compilers without
-   "long long".  One can argue the various merits of keeping this in or
-   throwing it out.  I went to the trouble of adding it so for the time being
-   I'm leaving it in.  */
-typedef struct { SI hi,lo; } DI;
-typedef DI UDI;
-#define GETLODI(di) ((di).lo)
-#define GETHIDI(di) ((di).hi)
-#define SETLODI(di, val) ((di).lo = (val))
-#define SETHIDI(di, val) ((di).hi = (val))
-extern DI make_struct_di (SI, SI);
-#define MAKEDI(hi, lo) (make_struct_di ((hi), (lo)))
-#endif
 
 /* These are used to record extracted raw data from an instruction, among other
    things.  It must be a host data type, and not a target one.  */
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index 529d80dfb15c..8c0856c795b8 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -117,17 +117,6 @@ cgen_cpu_max_extra_bytes (void)
 \f
 #ifdef DI_FN_SUPPORT
 
-DI
-make_struct_di (hi, lo)
-     SI hi, lo;
-{
-  DI result;
-
-  result.hi = hi;
-  result.lo = lo;
-  return result;
-}
-
 DI
 ANDDI (a, b)
      DI a, b;
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-28  1:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28  1:36 [PATCH 1/2] sim: bpf: fix printf warnings on 32-bit systems Mike Frysinger
2021-06-28  1:36 ` [PATCH 2/2] sim: cgen: require long long support Mike Frysinger

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).