mirror of
https://github.com/open-simh/simh.git
synced 2026-04-25 03:44:58 +00:00
SCP: Reduce compiler warnings on LP64 platforms
(Note: Reducing compiler warnings across all, but primarily LP64 platforms, is a long term objective.) Reduce compiler warnings on LP64 platforms (macOS, Windows) and 32-bit builds (Win32). Prefer 'size_t' for pointer arithmetic, array indexing and extents; 'int' hasn't been used for these purposes for many years and across many ANSI standards. N.B. that conversions from int or int32 to size_t cause the compiler to zero-extend the value, which is inefficient. Refactor printf() format modifiers into sim_printf_fmts.h. Add the SIZE_T_FMT modifier for better portability, especially on LP64 platforms where size_t is unsigned long and sizeof(size_t) > sizeof(int). 3B2: Fix known size_t printf() format.
This commit is contained in:
committed by
Paul Koning
parent
d9d0e8bd74
commit
a275c71170
@@ -185,7 +185,7 @@ uint32 dmac_read(uint32 pa, size_t size)
|
||||
break;
|
||||
default:
|
||||
sim_debug(READ_MSG, &dmac_dev,
|
||||
"DMAC READ %lu B @ %08x\n",
|
||||
"DMAC READ %" SIZE_T_FMT "u B @ %08x\n",
|
||||
size, pa);
|
||||
data = 0;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ uint32 dmac_read(uint32 pa, size_t size)
|
||||
return data;
|
||||
default:
|
||||
sim_debug(READ_MSG, &dmac_dev,
|
||||
"[BASE: %08x] DMAC READ %lu B @ %08x\n",
|
||||
"[BASE: %08x] DMAC READ %" SIZE_T_FMT "u B @ %08x\n",
|
||||
base, size, pa);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user