OSDN Git Service

* g++.dg/ext/dll-MI1.h: New file.
authordannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Jul 2003 01:12:19 +0000 (01:12 +0000)
committerdannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Jul 2003 01:12:19 +0000 (01:12 +0000)
* g++.dg/ext/dllexport-MI1.C: New file.
* g++.dg/ext/dllimport-MI1.C: New file.

ChangeLog: Remove 'testsuite/' from 2003-07-04 entry.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69432 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/dll-MI1.h [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/dllexport-MI1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/dllimport-MI1.C [new file with mode: 0644]

index 0f42a0b..e6f3233 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-16  Danny Smith  <dannysmith@users.sourceforge.net>
+
+       * g++.dg/ext/dll-MI1.h: New file.
+       * g++.dg/ext/dllexport-MI1.C: New file.
+       * g++.dg/ext/dllimport-MI1.C: New file.
+
 2003-07-15  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.c-torture/execute/string-opt-8.c (main): Remove i370 and s390,
 2003-07-04  Danny Smith  <dannysmith@users.sourceforge.net>
 
        PR c++/5287, PR c++/7910,  PR c++/11021
-       * testsuite/g++.dg/ext/dllimport1.C: Add mingw32 as target. Add
+       * g++.dg/ext/dllimport1.C: Add mingw32 as target. Add
        tests for warnings.
-       * testsuite/g++.dg/ext/dllimport2.C: Add tests for warnings.
-       * testsuite/g++.dg/ext/dllimport3.C: Likewise.
-       * testsuite/g++.dg/ext/dllimport4.C: New file.
-       * testsuite/g++.dg/ext/dllimport5.C: New file.
-       * testsuite/g++.dg/ext/dllimport6.C: New file.
-       * testsuite/g++.dg/ext/dllimport7.C: New file.
-       * testsuite/g++.dg/ext/dllimport8.C: New file.
-       * testsuite/g++.dg/ext/dllimport9.C: New file.
-       * testsuite/g++.dg/ext/dllimport10.C: New file.
-       * testsuite/g++.dg/ext/dllexport1.C: New file.
+       * g++.dg/ext/dllimport2.C: Add tests for warnings.
+       * g++.dg/ext/dllimport3.C: Likewise.
+       * g++.dg/ext/dllimport4.C: New file.
+       * g++.dg/ext/dllimport5.C: New file.
+       * g++.dg/ext/dllimport6.C: New file.
+       * g++.dg/ext/dllimport7.C: New file.
+       * g++.dg/ext/dllimport8.C: New file.
+       * g++.dg/ext/dllimport9.C: New file.
+       * g++.dg/ext/dllimport10.C: New file.
+       * g++.dg/ext/dllexport1.C: New file.
 
 2003-07-03  Mark Mitchell  <mark@codesourcery.com>
 
diff --git a/gcc/testsuite/g++.dg/ext/dll-MI1.h b/gcc/testsuite/g++.dg/ext/dll-MI1.h
new file mode 100644 (file)
index 0000000..2f8b836
--- /dev/null
@@ -0,0 +1,39 @@
+// Class definitions for dllexport-MI1.C and dllimport-MI1.C
+
+#ifdef BUILDING_MI_DLL
+#define  DLL_IMPEXP __attribute__ ((dllexport))
+#else
+#define  DLL_IMPEXP __attribute__ ((dllimport))
+#endif
+
+
+#define D1_return 1
+#define D2_return 2
+
+class DLL_IMPEXP MBase
+{
+public:
+  virtual int vf() const = 0;
+  virtual ~MBase();
+};
+
+class DLL_IMPEXP D1 : virtual public MBase
+{
+public:
+  int vf() const;
+};
+
+class DLL_IMPEXP D2 : virtual public MBase
+{
+public:
+  D2 ();
+  D2 (D2 const&);
+  int vf() const;
+};
+
+class DLL_IMPEXP MI1 : public D1, public D2
+{
+public:
+  int vf() const;
+};
+
diff --git a/gcc/testsuite/g++.dg/ext/dllexport-MI1.C b/gcc/testsuite/g++.dg/ext/dllexport-MI1.C
new file mode 100644 (file)
index 0000000..e640d3b
--- /dev/null
@@ -0,0 +1,51 @@
+// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
+//  Test that non-virtual MI thunks are exported.
+
+
+// To build the dll and client app:
+// g++ -shared -o MI.dll dllexport-MI1.C
+// g++ -o MItest.exe dllimport-MI1.C -L. MI.dll
+
+#define BUILDING_MI_DLL
+#include "dll-MI1.h"
+
+MBase::~MBase(){}
+
+int D1::vf() const { return D1_return; }
+
+D2::D2() { }
+D2::D2 (D2 const&) { }
+int D2::vf() const { return D2_return; }
+
+int MI1::vf() const { return D1::vf();}
+
+// a dllexported object 
+DLL_IMPEXP MI1 dllMI1;
+
+// use default copy ctor 
+DLL_IMPEXP MI1 dllMI1Copy =  dllMI1;
+
+// Scan for export of some methods that are undefined in dllimportMI1.C,
+
+// { dg-final { scan-assembler "-export:_ZNK2D12vfEv" } }
+// { dg-final { scan-assembler "-export:_ZNK2D22vfEv" } }
+// { dg-final { scan-assembler "-export:_ZNK3MI12vfEv" } }
+
+// and MI thunks,
+
+// { dg-final { scan-assembler "-export:_ZThn4_NK3MI12vfEv" } }
+// { dg-final { scan-assembler "-export:_ZTv0_n12_NK2D12vfEv" } }
+
+// and a vtable data variable.
+
+// { dg-final { scan-assembler "-export:_ZTV2D1,data" } }
+
+// an explicit copy ctor
+// { dg-final { scan-assembler "-export:_ZN2D2C2ERKS_" } }
+
+// but not implicit copy ctor generated by compiler
+// nor implicit dtor
+
+// { dg-final { scan-assembler-not "-export:_ZN2D1C2ERKS_" } }
+// { dg-final { scan-assembler-not "-export:_ZN2D1D2Ev" } }
+
diff --git a/gcc/testsuite/g++.dg/ext/dllimport-MI1.C b/gcc/testsuite/g++.dg/ext/dllimport-MI1.C
new file mode 100644 (file)
index 0000000..4efdea4
--- /dev/null
@@ -0,0 +1,53 @@
+// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
+//  Test handling of MI thunks in dllimported classes.
+
+// To build the dll and client app:
+// g++ -shared -o MI.dll dllexport-MI1.C
+// g++ -o MItest.exe dllimport-MI1.C  -L. MI.dll
+
+#include <stdlib.h>
+#include "dll-MI1.h"
+
+extern DLL_IMPEXP MI1 dllMI1;
+
+// This should use the implicit copy ctor for D1 (not imported)
+// and the explicit copy ctor for D2 (dll-imported). 
+MI1 dllMI1LocalCopy = dllMI1;
+
+class  MI2 : public D1, public D2
+{
+public:
+  int vf() const { return D2::vf();}
+};
+
+class  MI3 : public MI1
+{
+};
+
+int main ()
+
+{
+  MI1 bar1;
+  MI2 bar2; 
+  MI3 bar3;
+
+  if (dllMI1.vf() != D1_return)
+    abort();
+
+  if (dllMI1LocalCopy.vf() != D1_return)
+    abort();
+
+  if (bar1.vf() != D1_return)
+    abort();
+
+  if (bar2.vf() != (D2_return))
+    abort();
+
+  if (bar3.vf() != D1_return )
+    abort();
+}
+
+// Scan for import of explicit copy ctor for D2, but no import
+// of compiler generated copy ctor for D1. 
+// { dg-final { scan-assembler  "__imp___ZN2D2C2ERKS_" } }
+// { dg-final { scan-assembler-not "__imp___ZN2D1C2ERKS_" } }