From 67e4f0782003cb45352e14e1b12e99a7251c7b26 Mon Sep 17 00:00:00 2001
From: Danny Smith <dannysmith@users.sourceforge.net>
Date: Thu, 13 Mar 2003 22:21:21 +0000
Subject: [PATCH] dll-1.c: Remove thumb target.

	* gcc.dg/dll-1.c: Remove thumb target. Change exp to _exp.
	* gcc.dg/dll-2.c: Enable for cygwin and mingw. Remove
	thumb target,
	* gcc.dg/dll-3.c: Likewise. Adjust scan-assembler
	to accept newer _imp__	prefix and additional
	newline in .drectve section.
	* gcc.dg/dll-4.c: Likewise.
	* gcc.dg/dll-5.c: New file to test -mnop-fun-dllimport
	switch.

From-SVN: r64337
---
 gcc/testsuite/ChangeLog      | 12 ++++++++++++
 gcc/testsuite/gcc.dg/dll-1.c |  8 ++++----
 gcc/testsuite/gcc.dg/dll-2.c |  3 ++-
 gcc/testsuite/gcc.dg/dll-3.c |  8 +++++---
 gcc/testsuite/gcc.dg/dll-4.c |  5 +++--
 gcc/testsuite/gcc.dg/dll-5.c | 22 ++++++++++++++++++++++
 6 files changed, 48 insertions(+), 10 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/dll-5.c

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1cf08340a141..40e66e03b008 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2003-03-13  Danny Smith  <dannysmith@users.sourceforge.net>
+
+	* gcc.dg/dll-1.c: Remove thumb target. Change exp to _exp. 
+	* gcc.dg/dll-2.c: Enable for cygwin and mingw. Remove
+	thumb target, 
+	* gcc.dg/dll-3.c: Likewise. Adjust scan-assembler
+	to accept newer _imp__	prefix and additional
+	newline in .drectve section.
+	* gcc.dg/dll-4.c: Likewise.
+	* gcc.dg/dll-5.c: New file to test -mnop-fun-dllimport
+	switch.
+
 2003-03-13  Mark Mitchell  <mark@codesourcery.com>
 
 	* g++.dg/parse/namespace9.C: New test.
diff --git a/gcc/testsuite/gcc.dg/dll-1.c b/gcc/testsuite/gcc.dg/dll-1.c
index 4ae1a0e17977..f823523b2700 100644
--- a/gcc/testsuite/gcc.dg/dll-1.c
+++ b/gcc/testsuite/gcc.dg/dll-1.c
@@ -1,10 +1,10 @@
 /* { dg-do compile { target arm*-*-pe* } } */
-/* { dg-do compile { target thumb*-*-pe* } } */
 /* { dg-options -mno-nop-fun-dllimport } */
 
 __declspec (dllimport) void imp ();
 
-__declspec (dllexport) void exp () { imp (); }
+__declspec (dllexport) void _exp () { imp (); }
+
+/* { dg-final { scan-assembler "\.section\[ \t\]*.drectve\n\[^\n\]*-export:_exp.*__imp_imp" } } */
+/* { dg-final { scan-assembler-not "__imp__exp" } } */
 
-/* { dg-final { scan-assembler "\.section\[ \t\]*.drectve\n\[^\n\]*-export:exp.*__imp_imp" } } */
-/* { dg-final { scan-assembler-not "__imp_exp" } } */
diff --git a/gcc/testsuite/gcc.dg/dll-2.c b/gcc/testsuite/gcc.dg/dll-2.c
index bf9170799659..45456ce83302 100644
--- a/gcc/testsuite/gcc.dg/dll-2.c
+++ b/gcc/testsuite/gcc.dg/dll-2.c
@@ -9,7 +9,8 @@
    and functions.  In C++, it only works for functions.  */
 
 /* { dg-do compile { target arm*-*-pe* } } */
-/* { dg-do compile { target thumb*-*-pe* } } */
+/* { dg-do compile { target i?86-pc-cygwin } } */
+/* { dg-do compile { target i?86-pc-mingw* } } */
 
 __declspec (dllimport) int foo1 ();
 __declspec (dllexport) int foo1 ();
diff --git a/gcc/testsuite/gcc.dg/dll-3.c b/gcc/testsuite/gcc.dg/dll-3.c
index 0be1f9730252..2d5517eace62 100644
--- a/gcc/testsuite/gcc.dg/dll-3.c
+++ b/gcc/testsuite/gcc.dg/dll-3.c
@@ -1,7 +1,8 @@
 /* Ensure dllexport overrides dllimport.  */
 
 /* { dg-do compile { target arm*-*-pe* } } */
-/* { dg-do compile { target thumb*-*-pe* } } */
+/* { dg-do compile { target i?86-pc-cygwin } } */
+/* { dg-do compile { target i?86-pc-mingw* } } */
 
 __declspec (dllimport) int foo1 ();
 __declspec (dllexport) int foo1 ();
@@ -12,5 +13,6 @@ __declspec (dllimport) int foo2 ();
 __declspec (dllexport) int foo1 () { return foo2 (); }
 __declspec (dllexport) int foo2 () { return foo1 (); }
 
-/* { dg-final { scan-assembler "\.section\[ \t\]*\.drectve\n\[^\n\]*-export:foo1.*\.section\[ \t\]*\.drectve\n\[^\n\]*-export:foo2" } } */
-/* { dg-final { scan-assembler-not "(__imp_foo1|__imp_foo2)" } } */
+/* { dg-final { scan-assembler "\.section\[ \t\]*.drectve\n.*-export:foo2" } } */
+/* { dg-final { scan-assembler "-export:foo1" } } */
+/* { dg-final { scan-assembler-not "(__imp_foo1|_imp__foo1|__imp_foo2|_imp__foo2)" } } */
diff --git a/gcc/testsuite/gcc.dg/dll-4.c b/gcc/testsuite/gcc.dg/dll-4.c
index fec08fcbb604..45ed7a110070 100644
--- a/gcc/testsuite/gcc.dg/dll-4.c
+++ b/gcc/testsuite/gcc.dg/dll-4.c
@@ -1,5 +1,6 @@
 /* { dg-do compile { target arm*-*-pe* } } */
-/* { dg-do compile { target thumb*-*-pe* } } */
+/* { dg-do compile { target i?86-pc-cygwin } } */
+/* { dg-do compile { target i?86-pc-mingw* } } */
 
 __declspec (dllimport) int foo1;
 int foo1;
@@ -11,4 +12,4 @@ int f () { return foo1 + foo2; }
 
 /* FIXME: We should scan the output of nm for this case.  */
 /* { dg-final { scan-assembler "(foo2:.*\.comm\[ \t_\]*foo1)" } } */
-/* { dg-final { scan-assembler-not "__imp_" } } */
+/* { dg-final { scan-assembler-not "(__imp_|_imp__)" } } */
diff --git a/gcc/testsuite/gcc.dg/dll-5.c b/gcc/testsuite/gcc.dg/dll-5.c
new file mode 100644
index 000000000000..df7e3e3f2747
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dll-5.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target i?86-pc-cygwin } } */
+/* { dg-do compile { target i?86-pc-mingw* } } */
+/* { dg-do compile { target arm*-*-pe* } } */
+
+/* { dg-options -mnop-fun-dllimport } */
+
+/* The dllimport attribute should be ignored for functions. */
+__declspec (dllimport) void dllimpfn ();
+
+/* The dllimport attribute should not be ignored for variables. */
+__declspec (dllimport) int dllimpvar;
+
+/* The dllexport attribute should not be ignored. */
+__declspec (dllexport) void dllexp ()
+{
+  dllimpfn ();
+  dllimpvar = 0;
+}
+
+/* { dg-final { scan-assembler-not "(__imp_dllimpfn|_imp__dllimpfn)" } } */
+/* { dg-final { scan-assembler "(__imp_dllimpvar|_imp__dllimpvar)" } } */
+/* { dg-final { scan-assembler "\.section\[ \t\]*.drectve\n\.*-export:dllexp" } } */
-- 
GitLab