1
0
mirror of https://github.com/PDP-10/klh10.git synced 2026-01-11 23:52:54 +00:00

Try harder to get printf formats right for some typedef'ed types.

For older versions of clang that's still not enough and they keep complaining,
but for newer ones it's ok.
This commit is contained in:
Olaf Seibert 2016-01-26 20:44:13 +01:00
parent 563368b75b
commit 4075a69ccb
6 changed files with 16 additions and 7 deletions

View File

@ -1,6 +1,9 @@
# -*- Autoconf -*-
# Process this file with autogen.sh to produce a configure script.
dnl This configure.ac script was created for Autoconf 2.69, but I
dnl tried it with one as old as 2.61, and that seemed to work fine.
AC_PREREQ([2.69])
AC_INIT([klh10], [2.0i-Rhialto], [https://github.com/Rhialto/klh10],
[], [https://github.com/Rhialto/klh10])

View File

@ -237,13 +237,13 @@
# if defined(SIZEOF_OFF_T) /* system inspected by configure */
# if SIZEOF_OFF_T == 0 || SIZEOF_OFF_T == 4
# define CENV_SYSF_LFS 0 /* No off_t, use long */
# define CENV_SYSF_LFS_FMT "l" /* printf format is long */
# define CENV_SYSF_LFS_FMT "l" /* printf format is signed long */
# elif SIZEOF_OFF_T == 8
# define CENV_SYSF_LFS 64 /* off_t exists and has 64 bits */
# if SIZEOF_OFF_T == SIZEOF_LONG
# define CENV_SYSF_LFS_FMT "l" /* printf format is long */
# define CENV_SYSF_LFS_FMT "l" /* printf format is signed long */
# elif SIZEOF_OFF_T == SIZEOF_LONG_LONG
# define CENV_SYSF_LFS_FMT "ll" /* printf format is long long */
# define CENV_SYSF_LFS_FMT "ll" /* printf format is signed long long */
# endif
# endif
# define CENV_SYSF_FSEEKO HAVE_FSEEKO

View File

@ -3802,6 +3802,7 @@ TF-Format: raw %s\n",
if ((rd = td->tdrd)) {
do {
if (bol) {
/* print unsigned even though the type is actually signed */
fprintf(f, "%" VMTAPE_POS_FMT "u:", rd->rdloc);
bol = FALSE;
}

View File

@ -64,19 +64,21 @@
/* Attempt to determine max size and type of tape position information.
* This is most important when running on platforms that only support
* 64-bit integers with a non-long data type.
* VMTAPE_POS_T is always signed: off_t is signed and so is long.
*/
#ifndef VMTAPE_POS_T
# if CENV_SYSF_LFS == 0
# define VMTAPE_POS_T long
# define VMTAPE_POS_T long
# define VMTAPE_POS_FMT "l"
# else
# define VMTAPE_POS_T off_t
# define VMTAPE_POS_T off_t
# define VMTAPE_POS_FMT CENV_SYSF_LFS_FMT
# endif
# if CENV_SYSF_FSEEKO
# define VMTAPE_POS_FSEEK(f,pos) fseeko((f), (off_t)(pos), SEEK_SET)
# else
# define VMTAPE_POS_FSEEK(f,pos) fseek((f), (long)(pos), SEEK_SET)
# endif
# define VMTAPE_POS_FMT CENV_SYSF_LFS_FMT
#endif
typedef VMTAPE_POS_T vmtpos_t;

View File

@ -759,7 +759,7 @@ wfu_gasc(register struct wfile *wf,
{ register int cnt;
for(cnt = 0; cnt < i; ++cnt)
printf(" %o", cbuf[cnt]);
printf(" Bad byte: %o File location: %ld.\n", ch,
printf(" Bad byte: %o File location: %" WFOFF_FMT "d.\n", ch,
wf->wfloc-1);
}
return -1;

View File

@ -51,9 +51,12 @@ enum wftypes {
};
#if CENV_SYSF_LFS > 0
/* wfoff_t is always signed: off_t and long are both signed. */
typedef off_t wfoff_t;
# define WFOFF_FMT CENV_SYSF_LFS_FMT
#else
typedef long wfoff_t;
# define WFOFF_FMT "l"
#endif
struct wfile {