mirror of git://gcc.gnu.org/git/gcc.git
PR c++/5287, PR c++/7910, PR c++/11021
PR c++/5287, PR c++/7910, PR c++/11021 * testsuite/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. From-SVN: r68917
This commit is contained in:
parent
6b6cb52e94
commit
1cf0dce8a8
|
@ -1,3 +1,19 @@
|
|||
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
|
||||
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.
|
||||
|
||||
2003-07-03 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.jason/typeid1.C: Add dg-error marker.
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// Test that inline functions are exported with -fkeep-inline-functions.
|
||||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
// { dg-options -fkeep-inline-functions }
|
||||
|
||||
__attribute__((dllexport)) inline int foo (int a) { return a;}
|
||||
|
||||
|
||||
class __attribute__((dllexport)) Bar
|
||||
{
|
||||
public:
|
||||
Bar(){};
|
||||
int inline_bar(int a) {return a;}
|
||||
int outline_bar(int a);
|
||||
};
|
||||
|
||||
int Bar::outline_bar(int a) {return foo (a);}
|
||||
|
||||
|
||||
Bar abar;
|
||||
|
||||
// { dg-final { scan-assembler "\.section\[ \t\]*.drectve\n.*_ZN3Bar11outline_barEi" } }
|
||||
// { dg-final { scan-assembler " -export:_ZN3Bar10inline_barEi" } }
|
||||
// { dg-final { scan-assembler " -export:_Z3fooi" } }
|
|
@ -1,12 +1,20 @@
|
|||
// { dg-do compile { target i?86-*-cygwin* } }
|
||||
// PR c++/7910
|
||||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
// { dg-options { -Wall -W } }
|
||||
|
||||
class __attribute__((dllimport)) Foo
|
||||
{
|
||||
public:
|
||||
virtual void dummy_foo_func(void)
|
||||
{}
|
||||
{} // { dg-warning "inline function" }
|
||||
void Foo::dummy_foo_fun2();
|
||||
virtual ~Foo(); // avoid warning
|
||||
};
|
||||
|
||||
void Foo::dummy_foo_fun2()
|
||||
{ // { dg-warning "defined" }
|
||||
}
|
||||
|
||||
class Bar : public Foo
|
||||
{
|
||||
public:
|
||||
|
@ -19,3 +27,5 @@ Bar::~Bar()
|
|||
|
||||
void Bar::dummy_bar_func()
|
||||
{}
|
||||
|
||||
// { dg-final { scan-assembler-not "__imp___ZN3Foo14dummy_foo_fun" } }
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// PR c++/5287, c++/11021
|
||||
// Inherit a virtual method from a dllimport'd base class.
|
||||
|
||||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
|
||||
struct __attribute__((dllimport)) A
|
||||
{
|
||||
virtual void vfunc(void);
|
||||
};
|
||||
|
||||
struct B : public A
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
B aB;
|
|
@ -1,15 +1,29 @@
|
|||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
|
||||
// PR 9738 Dllimport attribute is overriden by later definition
|
||||
// PR c++/9738 Dllimport attribute is overriden by later definition/redeclaration
|
||||
|
||||
void __attribute__((dllimport)) Bar(void);
|
||||
void __attribute__((dllimport)) Baz(void);
|
||||
__attribute__((dllimport)) int Biz;
|
||||
__attribute__((dllimport)) int Boz;
|
||||
|
||||
void Foo(void)
|
||||
{
|
||||
Bar();
|
||||
Baz();
|
||||
Biz++;
|
||||
Boz++;
|
||||
}
|
||||
|
||||
void Foo(void)
|
||||
{
|
||||
Bar();
|
||||
}
|
||||
|
||||
void Bar(void)
|
||||
{
|
||||
}
|
||||
|
||||
void Bar(void)
|
||||
{ // { dg-warning "defined" }
|
||||
}
|
||||
|
||||
void Baz(void); // { dg-warning "redeclared" }
|
||||
extern int Biz; // { dg-warning "redeclared" }
|
||||
int Boz; // { dg-warning "defined" }
|
||||
|
||||
void foo()
|
||||
{
|
||||
Biz++;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ struct Foo
|
|||
void* dummy = &f;
|
||||
}
|
||||
|
||||
struct Foo f;
|
||||
struct Foo f; // { dg-warning "defined" }
|
||||
|
||||
// Dllimport sets DECL_NON_ADDR_CONST_P to 1, so following
|
||||
// assignment would require static_initialization_and_destruction
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// Report error if dllimport attribute in definition itself.
|
||||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
|
||||
__attribute__((dllimport)) void bar () { } // { dg-error "definition" }
|
||||
|
||||
__attribute__((dllimport)) int foo = 1; // { dg-error "definition" }
|
|
@ -0,0 +1,28 @@
|
|||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
// Report error if static symbol definition has dllimport attribute.
|
||||
|
||||
__attribute__((dllimport))
|
||||
int impvar; // OK, implicit "extern"
|
||||
|
||||
static __attribute__((dllimport))
|
||||
int static_impvar; // { dg-error "external linkage" }
|
||||
|
||||
static __attribute__((dllexport))
|
||||
int static_expvar; // { dg-error "external linkage" }
|
||||
|
||||
static __attribute__((dllimport))
|
||||
void static_impfun(void); // { dg-error "external linkage" }
|
||||
|
||||
void foo()
|
||||
{
|
||||
__attribute__((dllimport))
|
||||
int foovar; // OK, implicit "extern"
|
||||
foovar++;
|
||||
}
|
||||
|
||||
void bar()
|
||||
{
|
||||
__attribute__((dllexport))
|
||||
int barvar; // { dg-error "external linkage" }
|
||||
barvar++;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
// Mark class static members as dllimport.
|
||||
|
||||
struct Baz
|
||||
{
|
||||
Baz(int a_ =0) : a(a_) {};
|
||||
int a;
|
||||
};
|
||||
|
||||
class __attribute__ ((dllimport)) Bar
|
||||
{
|
||||
public:
|
||||
static const int two = 2;
|
||||
static const int three;
|
||||
static const Baz null_baz;
|
||||
};
|
||||
|
||||
int foo()
|
||||
{
|
||||
Bar foobar;
|
||||
const int* baz = &Bar::two;
|
||||
int a = foobar.two;
|
||||
int b = foobar.three;
|
||||
int c = foobar.null_baz.a;
|
||||
return (a + b + c + *baz);
|
||||
}
|
||||
|
||||
// { dg-final { scan-assembler __imp___ZN3Bar3twoE } }
|
||||
// { dg-final { scan-assembler __imp___ZN3Bar5threeE } }
|
||||
// { dg-final { scan-assembler __imp___ZN3Bar8null_bazE } }
|
|
@ -0,0 +1,33 @@
|
|||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
|
||||
// Report errors on definition of dllimport'd static data member .
|
||||
|
||||
|
||||
struct Baz
|
||||
{
|
||||
Baz(int a_ =0) : a(a_) {};
|
||||
int a;
|
||||
};
|
||||
|
||||
class __declspec(dllimport) Bar
|
||||
{
|
||||
public:
|
||||
enum {one = 1};
|
||||
static const int two = 2;
|
||||
static const int three;
|
||||
static const Baz null_baz;
|
||||
};
|
||||
|
||||
const int Bar::three = 3; // { dg-error "definition of static data" }
|
||||
const Baz Bar::null_baz; // { dg-error "definition of static data" }
|
||||
|
||||
|
||||
int foo()
|
||||
{
|
||||
Bar foobar;
|
||||
const int* baz = &Bar::two;
|
||||
int a = foobar.two;
|
||||
int b = foobar.three;
|
||||
int c = foobar.null_baz.a;
|
||||
return (a + b + c + *baz);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// PR c++/8378
|
||||
// Ignore dllimport of static members if marked inlined.
|
||||
// or if definition follows declaration in dllimported class.
|
||||
|
||||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
// { dg-options { -Wall -W } }
|
||||
|
||||
struct __attribute__((dllimport)) Foo
|
||||
{
|
||||
static int static_int;
|
||||
static void static_func1();
|
||||
static void static_func2();
|
||||
};
|
||||
|
||||
void Foo::static_func1()
|
||||
{ // { dg-warning "defined" }
|
||||
}
|
||||
|
||||
inline void Foo::static_func2()
|
||||
{ // { dg-warning "inline function" }
|
||||
}
|
||||
|
||||
void testfoo()
|
||||
{
|
||||
Foo::static_func1();
|
||||
Foo::static_func2();
|
||||
}
|
||||
|
||||
// { dg-final { scan-assembler-not "__imp__" } }
|
|
@ -0,0 +1,23 @@
|
|||
// Handle dllimport attribute for functions declared inline.
|
||||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
// { dg-options { -W } }
|
||||
|
||||
inline __attribute__((dllimport)) void bar() { } // { dg-warning "inline" }
|
||||
|
||||
struct __attribute__ ((dllimport)) Blah
|
||||
{
|
||||
void in_blah () { } // { dg-warning "inline" }
|
||||
void out_blah ();
|
||||
};
|
||||
|
||||
inline void Blah::out_blah(){ } // { dg-warning "inline" }
|
||||
|
||||
void use_inlines()
|
||||
{
|
||||
Blah aBlah;
|
||||
bar();
|
||||
aBlah.in_blah ();
|
||||
aBlah.out_blah ();
|
||||
}
|
||||
|
||||
// { dg-final { scan-assembler-not "__imp__" } }
|
Loading…
Reference in New Issue