m-un-2.c: New test.
authorBruno Haible <haible@ilog.fr>
Fri, 19 Jun 1998 22:29:55 +0000 (00:29 +0200)
committerJeff Law <law@gcc.gnu.org>
Fri, 19 Jun 1998 22:29:55 +0000 (16:29 -0600)
        * gcc.misc-tests/m-un-2.c: New test.
        * g++.old-deja/g++.other/warn01.c: Likewise.

From-SVN: r20615

gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.other/warn01.C [new file with mode: 0644]
gcc/testsuite/gcc.misc-tests/m-un-2.c [new file with mode: 0644]

index abc4487ae9e3d3d70a9fe2bc4d3bff8a1ab88c07..20ce19aba55a942ae518cd5f8f6bda4372b599a3 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 19 23:26:12 1998  Bruno Haible <haible@ilog.fr>
+
+       * gcc.misc-tests/m-un-2.c: New test.
+       * g++.old-deja/g++.other/warn01.c: Likewise.
+
 Fri Jun 19 14:06:36 1998  Robert Lipe  <robertl@dgii.com>
        
        * gcc.dg/980414-1.c: Move comments outside of ASM to improve
diff --git a/gcc/testsuite/g++.old-deja/g++.other/warn01.C b/gcc/testsuite/g++.old-deja/g++.other/warn01.C
new file mode 100644 (file)
index 0000000..229363a
--- /dev/null
@@ -0,0 +1,15 @@
+// Build don't link:
+// Special g++ Options: -W -Wall
+
+typedef unsigned long size_t;
+extern void* malloc (size_t);
+extern void free (void*);
+extern void* realloc (void*, size_t);
+
+struct vtable {
+  void* (* _malloc) (size_t);
+  void (* _free) (void*);
+  void* (* _realloc) (void*, size_t);
+};
+
+struct vtable mtable = { malloc, free };  // WARNING - _realloc
diff --git a/gcc/testsuite/gcc.misc-tests/m-un-2.c b/gcc/testsuite/gcc.misc-tests/m-un-2.c
new file mode 100644 (file)
index 0000000..8c3a8bc
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-W -Wall" } */
+
+typedef unsigned long size_t;
+extern void* malloc (size_t);
+extern void free (void*);
+extern void* realloc (void*, size_t);
+
+struct vtable {
+  void* (* _malloc) (size_t);
+  void (* _free) (void*);
+  void* (* _realloc) (void*, size_t);
+};
+
+struct vtable mtable = {
+  malloc,
+  free
+}; /* { dg-warning "missing initializer for `mtable._realloc'" "warning regression" } */
+
+struct vtable mtable2 = {
+  ._malloc = malloc,
+  ._realloc = realloc
+}; /* { dg-warning "missing initializer for `mtable2._free'" "warning regression" } */
+
+struct vtable mtable3 = {
+  ._free = free,
+  ._malloc = malloc,
+  ._realloc = realloc
+};