PR middle-end/21275
authordannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Oct 2005 20:54:50 +0000 (20:54 +0000)
committerdannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Oct 2005 20:54:50 +0000 (20:54 +0000)
commit6c1e551f8f0706e3f2d8359f1235448262b4f736
tree18c5c3123c37f3bfc1dcf357bb32d0289c2b8bb8
parent7823812a978701f449a84474041f9962fa5f034d
PR middle-end/21275
PR middle-end/21766
* target.h (struct gcc_target): Add valid_dllimport_attribute_p
target hook.
(struct cxx): Add adjust_class_at_definition target hook.
* target-def.h: (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): New define,
defaulting to hook_bool_tree_true. Add to TARGET_INITIALIZER
(TARGET_CXX_ADJUST_CLASS_AT_DEFINITION): New define, defaulting to
hook_void_tree. Add to TARGET_CXX.
* tree.h (struct decl_with_vis): Rename non_addr_const_p field to
dllimport_flag.
(DECL_NON_ADDR_CONSTANT_P): Replace with DECL_DLLIMPORT_P macro.
* tree.c (merge_dllimport_decl_attributes): Check DECL_DLLIMPORT_P
instead of attribute. Check for dllexport override.  Warn if
inconsistent dll linkage. Don't lose old dllimport if decl has
had address referenced.   Tweak lookup of dllimport atribute.
(handle_dll_attribute): Check targetm.valid_dllimport_attribute_p
for target specific rules.  Don't add dllimport attribute if
DECL_DECLARED_INLINE_P.  Set DECL_DLLIMPORT_P when adding
dllimport attribute.
(staticp): Replace DECL_NON_ADDR_CONSTANT_P with DECL_DLLIMPORT_P.
* varasm.c (initializer_constant_valid_p): Replace
DECL_NON_ADDR_CONSTANT_P with DECL_DLLIMPORT_P

PR target/21801
PR target/23589
* config.gcc (i[34567]86-*-cygwin*): Add winnt-cxx.o to
'cxx_target_objs', winnt-stubs,o to 'extra_objs'.
(i[34567]86-*-mingw32*): Likewise.

* doc/tm.texi (TARGET_CXX_ADJUST_CLASS_AT_DEFINITION): Document.
(TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Document.

* config/i386/winnt.c (i386_pe_dllimport_p): Factor out
C++-specific code. Change return value to bool.
(i386_pe_dllimport_p): Likewise.
(associated_type): Simplify and make language-independent
(i386_pe_encode_section_info): Replace override of ambiguous
dllimport symbol refs with a gcc_assert.
(i386_pe_valid_dllimport_attribute_p): Define.
* config/i386/winnt-cxx.c: New file. Define C++ versions of
i386_pe_type_dllimport_p, i386_pe_type_dllexport_p,
i386_pe_adjust_class_at_definition.
* config/i386/winnt-stubs.c: New file. Define stub versions of
lang-specific functions.
* config/i386/i386-protos.h: Declare winnt-[cxx|stubs].c functions
i386_pe_type_dllimport_p, i386_pe_type_dllexport_p,
i386_pe_adjust_class_at_definition.
(i386_pe_valid_dllimport_attribute_p): Declare.
* config/i386/cygming.h (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Define.
(TARGET_CXX_ADJUST_CLASS_AT_DEFINITION): Define.
* config/i386/t-cygming: Add rules for winnt-cxx.o, winnt-stubs.o.

PR target/19704
* config/i386/i386.c (ix86_function_ok_for_sibcall): Replace test for
dllimport attribute with test of DECL_DLLIMPORT_P.

cp
PR target/21801
PR target/23589
* class.c (finish_struct_1): Call
targetm.cxx.adjust_class_at_definition.

testsuite
* gcc.dg/dll-2.c: Add tests for warnings.
* gcc.dg/dll-3.c: Likewise.
* gcc.dg/dll-4.c: Likewise.

* g++.dg/ext/dllimport1.C: Adjust tests for warnings.
* g++.dg/ext/dllimport2.C: Likewise.
* g++.dg/ext/dllimport3.C: Likewise.
* g++.dg/ext/dllimport7.C: Likewise.
* g++.dg/ext/dllimport8.C: Likewise.
* g++.dg/ext/dllimport9.C: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105332 138bc75d-0d04-0410-961f-82ee72b054a4
27 files changed:
gcc/ChangeLog
gcc/config.gcc
gcc/config/i386/cygming.h
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/t-cygming
gcc/config/i386/winnt-cxx.c [new file with mode: 0755]
gcc/config/i386/winnt-stubs.c [new file with mode: 0755]
gcc/config/i386/winnt.c
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/doc/tm.texi
gcc/target-def.h
gcc/target.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/dllimport1.C
gcc/testsuite/g++.dg/ext/dllimport2.C
gcc/testsuite/g++.dg/ext/dllimport3.C
gcc/testsuite/g++.dg/ext/dllimport7.C
gcc/testsuite/g++.dg/ext/dllimport8.C
gcc/testsuite/g++.dg/ext/dllimport9.C
gcc/testsuite/gcc.dg/dll-2.c
gcc/testsuite/gcc.dg/dll-3.c
gcc/testsuite/gcc.dg/dll-4.c
gcc/tree.c
gcc/tree.h
gcc/varasm.c