#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <emacs-module.h>
int plugin_is_GPL_compatible;
+#if INTPTR_MAX <= 0
+# error "INTPTR_MAX misconfigured"
+#elif INTPTR_MAX <= INT_MAX || INTPTR_MAX <= LONG_MAX
+# define pT "ld"
+# define pZ "lu"
+# define T_TYPE long
+# define Z_TYPE unsigned long
+#elif INTPTR_MAX <= INT64_MAX
+# ifdef __MINGW32__
+# define pT "lld"
+# define pZ "llu"
+# define T_TYPE long long
+# define Z_TYPE unsigned long long
+# else
+# define pT "ld"
+# define pZ "lu"
+# define T_TYPE long
+# define Z_TYPE unsigned long
+# endif
+#else
+# error "INTPTR_MAX too large"
+#endif
+
+
/* Always return symbol 't'. */
static emacs_value
Fmod_test_return_t (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
{
if (ert->size < sizeof *ert)
{
- fprintf (stderr, "Runtime size of runtime structure (%td bytes) "
- "smaller than compile-time size (%zu bytes)",
- ert->size, sizeof *ert);
+ fprintf (stderr, "Runtime size of runtime structure (%"pT" bytes) "
+ "smaller than compile-time size (%"pZ" bytes)",
+ (T_TYPE) ert->size, (Z_TYPE) sizeof (*ert));
return 1;
}
if (env->size < sizeof *env)
{
- fprintf (stderr, "Runtime size of environment structure (%td bytes) "
- "smaller than compile-time size (%zu bytes)",
- env->size, sizeof *env);
+ fprintf (stderr, "Runtime size of environment structure (%"pT" bytes) "
+ "smaller than compile-time size (%"pZ" bytes)",
+ (T_TYPE) env->size, (Z_TYPE) sizeof (*env));
return 2;
}