selectany1.C: New file.
* g++.dg/ext/selectany1.C: New file. Test for linkonce sections. * g++.dg/ext/selectany2.C: New file. Test for errors with invalid selectany usage. From-SVN: r97378
This commit is contained in:
parent
a20f6f00bf
commit
40ce6bf648
|
@ -1,3 +1,9 @@
|
||||||
|
2005-04-01 Danny Smith <dannysmith@users.sourceforge.net>
|
||||||
|
|
||||||
|
* g++.dg/ext/selectany1.C: New file. Test for linkonce sections.
|
||||||
|
* g++.dg/ext/selectany2.C: New file. Test for errors with invalid
|
||||||
|
selectany usage.
|
||||||
|
|
||||||
2005-04-01 Jakub Jelinek <jakub@redhat.com>
|
2005-04-01 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR c++/19406
|
PR c++/19406
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
// { dg-do compile { target i?86-pc-cygwin } }
|
||||||
|
// { dg-do compile { target i?86-pc-mingw* } }
|
||||||
|
|
||||||
|
// Check that selectany attribute puts symbols into link-once sections.
|
||||||
|
|
||||||
|
// { dg-final { scan-assembler "\.section\t\.data\\\$foo\[^\n\]*\n\t\.linkonce discard" } }
|
||||||
|
// { dg-final { scan-assembler "\.section\t\.data\\\$x\[^\n\]*\n\t\.linkonce discard" } }
|
||||||
|
// { dg-final { scan-assembler-dem "\nguard variable for x:" } }
|
||||||
|
|
||||||
|
__declspec (selectany) int foo = 1;
|
||||||
|
|
||||||
|
class X
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
int m_i;
|
||||||
|
public:
|
||||||
|
X(int i): m_i(i){}
|
||||||
|
~X(){};
|
||||||
|
};
|
||||||
|
|
||||||
|
__declspec(selectany) X x(1);
|
|
@ -0,0 +1,30 @@
|
||||||
|
// { dg-do compile { target i?86-pc-cygwin } }
|
||||||
|
// { dg-do compile { target i?86-pc-mingw* } }
|
||||||
|
|
||||||
|
// Check for errors with invalid usage of selectany attribute.
|
||||||
|
|
||||||
|
extern int foo;
|
||||||
|
__declspec (selectany) int foo = 1; // OK
|
||||||
|
|
||||||
|
struct d
|
||||||
|
{
|
||||||
|
static int foo;
|
||||||
|
};
|
||||||
|
__declspec (selectany) int d::foo = 1; // OK
|
||||||
|
|
||||||
|
struct f
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
};
|
||||||
|
__declspec (selectany) struct f F= {1}; // OK
|
||||||
|
|
||||||
|
__declspec (selectany) int boo; //{ dg-error "selectany" }
|
||||||
|
|
||||||
|
__declspec (selectany) static int bar = 1; // { dg-error "selectany" }
|
||||||
|
int use_bar = bar; // Avoid defined but not used warning.
|
||||||
|
|
||||||
|
int baz()
|
||||||
|
{
|
||||||
|
__declspec (selectany) int foo = 1; // { dg-error "selectany" }
|
||||||
|
return foo;
|
||||||
|
}
|
Loading…
Reference in New Issue