Просмотр исходного кода

build: Check for %j and %z format modifiers support

We use those to create binary output, so we require them to be working.
Guillem Jover лет назад: 15
Родитель
Сommit
766de19997
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      m4/dpkg-compiler.m4

+ 12 - 0
m4/dpkg-compiler.m4

@@ -57,6 +57,8 @@ AC_DEFUN([DPKG_TRY_C99],
 #define variadic_macro(foo, ...) printf(foo, __VA_ARGS__)
 ]],
 [[
+	int rc;
+
 	/* Compound initializers. */
 	struct { int a, b; } foo = { .a = 1, .b = 2 };
 
@@ -68,6 +70,16 @@ AC_DEFUN([DPKG_TRY_C99],
 
 	/* Specific size type. */
 	uint32_t baz = 0;
+	size_t size = SIZE_MAX;
+	intmax_t imax = INTMAX_MAX;
+
+	/* Format modifiers. */
+	rc = printf("%jd", imax);
+	if (rc == 3)
+		return 1;
+	rc = printf("%zu", size);
+	if (rc == 3)
+		return 1;
 
 	/* Magic __func__ variable. */
 	printf("%s", __func__);