This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] Enable some dllimport testcases for mingw/cygwin
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Christopher Faylor <cgf at redhat dot com>, rearnsha at arm dot com
- Date: Tue, 11 Mar 2003 20:27:30 +1100 (EST)
- Subject: [Patch] Enable some dllimport testcases for mingw/cygwin
Hello
Attached patch enables some dllimport/export tests (currently enabled
for arm*-*-pe* targets) for mingw and cygwin.
I'm not quite sure what gcc.dg/dll-1.c is trying to test so I have left
it alone. A new file, dll-5.c, tests the -mnop-fun-dllimport switch.
I suspect that dll-1.c is supposed to do that too. If so, dll-5.c could
replace dll-1.c.
I have tested these on cygwin and mingw. Could someone please test on
arm*-*-pe.
Danny
ChangeLog
2003-03-11 Danny Smith <dannysmith at users dot sourceforge dot net>
* gcc.dg/dll-2.c: Enable for cygwin and mingw.
* 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.
Index: testsuite/gcc.dg/dll-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/dll-2.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 dll-2.c
*** testsuite/gcc.dg/dll-2.c 16 Sep 2002 13:29:49 -0000 1.4
--- testsuite/gcc.dg/dll-2.c 11 Mar 2003 07:06:33 -0000
***************
*** 10,15 ****
--- 10,17 ----
/* { 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 ();
Index: testsuite/gcc.dg/dll-3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/dll-3.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 dll-3.c
*** testsuite/gcc.dg/dll-3.c 24 Jul 2001 15:17:01 -0000 1.4
--- testsuite/gcc.dg/dll-3.c 11 Mar 2003 07:06:33 -0000
***************
*** 2,7 ****
--- 2,9 ----
/* { 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 ();
*************** __declspec (dllimport) int foo2 ();
*** 12,16 ****
__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)" } } */
--- 14,19 ----
__declspec (dllexport) int foo1 () { return foo2 (); }
__declspec (dllexport) int foo2 () { return foo1 (); }
! /* { 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)" } } */
Index: testsuite/gcc.dg/dll-4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/dll-4.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 dll-4.c
*** testsuite/gcc.dg/dll-4.c 24 Jul 2001 15:17:01 -0000 1.4
--- testsuite/gcc.dg/dll-4.c 11 Mar 2003 07:06:33 -0000
***************
*** 1,5 ****
--- 1,7 ----
/* { 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;
*************** int f () { return foo1 + foo2; }
*** 11,14 ****
/* 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_" } } */
--- 13,16 ----
/* 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_|_imp__)" } } */
*** /dev/null Tue Mar 11 08:11:21 2003
--- testsuite/gcc.dg/dll-5.c Tue Mar 11 08:09:22 2003
***************
*** 0 ****
--- 1,20 ----
+ /* { dg-do compile { target i?86-pc-cygwin } } */
+ /* { dg-do compile { target i?86-pc-mingw* } } */
+ /* { 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)" } } */
+
http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.