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

build: Test for required compound literals

And clarify the comment on the designated initializers.
Guillem Jover лет назад: 12
Родитель
Сommit
639786e29c
3 измененных файлов с 8 добавлено и 2 удалено
  1. 1 0
      debian/changelog
  2. 2 1
      doc/coding-style.txt
  3. 5 1
      m4/dpkg-compiler.m4

+ 1 - 0
debian/changelog

@@ -71,6 +71,7 @@ dpkg (1.17.7) UNRELEASED; urgency=low
   * Set TAR preprocessor variable at build time instead of hardcoding it.
     This will allow non-GNU systems to easily use another value for their
     GNU tar, which is usually either gnutar or gtar.
+  * Require compound literals support in the compiler at configure time.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim).

+ 2 - 1
doc/coding-style.txt

@@ -6,7 +6,8 @@ C language extensions
 
 The code base assumes C89 plus the following C99 extensions:
 
- * Named initializers.
+ * Designated initializers.
+ * Compound literals.
  * Trailing comma in enum.
  * Variadic macros.
  * Working bool type in <stdbool.h>.

+ 5 - 1
m4/dpkg-compiler.m4

@@ -125,9 +125,13 @@ AC_DEFUN([DPKG_TRY_C99],
 [[
 	int rc;
 
-	/* Compound initializers. */
+	/* Designated initializers. */
 	struct { int a, b; } foo = { .a = 1, .b = 2 };
 
+	/* Compound literals. */
+	struct point { int x, y; } p = (struct point){ .x = 0, .y = 1 };
+	p = (struct point){ .x = 2, .y = 4 };
+
 	/* Trailing comma in enum. */
 	enum { first, second, } quux;