defaults.h (TARGET_DECLSPEC): New macro.

* defaults.h (TARGET_DECLSPEC): New macro.
	* c-cppbuiltin.c (c_cpp_builtins): Handle TARGET_DECLSPEC.
	* config/arm/pe.h (SUBTARGET_CPP_SPEC): Remove __declspec support.
	* config/arm/symbian. (TARGET_DLLIMPORT_DECL_ATTRIBUTES): Define.
	* config/i386/beof-elf.h (TARGET_OS_CPP_BUILTINS): Remove
	__declspec support.
	(TARGET_DECLSPEC): Define.
	* config/i386/cygming.h (TARGET_OS_CPP_BUILTINS): Remove
	__declspec support.
	* config/i386/i386-interix.h (TARGET_OS_CPP_BUILTINS): Remove
	__declspec support.
	(TARGET_DECLSPEC): Define.
	* config/mcore/mcore.h (TARGET_CPU_CPP_BUILTINS): Remove
	__declspec support.
	* config/sh/symbian-pre.h (SUBTARGET_CPP_SPEC): Remove __declspec
	support.
	* doc/tm.texi (TARGET_DECLSPEC): Document.

	* doc/extend.texi: Fix typo in comment.

From-SVN: r85571
This commit is contained in:
Mark Mitchell 2004-08-04 19:37:19 +00:00 committed by Mark Mitchell
parent 564076f545
commit 63c5b4952e
12 changed files with 61 additions and 37 deletions

View File

@ -1,3 +1,25 @@
2004-08-04 Mark Mitchell <mark@codesourcery.com>
* defaults.h (TARGET_DECLSPEC): New macro.
* c-cppbuiltin.c (c_cpp_builtins): Handle TARGET_DECLSPEC.
* config/arm/pe.h (SUBTARGET_CPP_SPEC): Remove __declspec support.
* config/arm/symbian. (TARGET_DLLIMPORT_DECL_ATTRIBUTES): Define.
* config/i386/beof-elf.h (TARGET_OS_CPP_BUILTINS): Remove
__declspec support.
(TARGET_DECLSPEC): Define.
* config/i386/cygming.h (TARGET_OS_CPP_BUILTINS): Remove
__declspec support.
* config/i386/i386-interix.h (TARGET_OS_CPP_BUILTINS): Remove
__declspec support.
(TARGET_DECLSPEC): Define.
* config/mcore/mcore.h (TARGET_CPU_CPP_BUILTINS): Remove
__declspec support.
* config/sh/symbian-pre.h (SUBTARGET_CPP_SPEC): Remove __declspec
support.
* doc/tm.texi (TARGET_DECLSPEC): Document.
* doc/extend.texi: Fix typo in comment.
2004-08-04 Paul Brook <paul@codesourcery.com>
* target-def.h (TARGET_CXX_CDTOR_RETURNS_THIS): Define.

View File

@ -426,6 +426,15 @@ c_cpp_builtins (cpp_reader *pfile)
TARGET_CPU_CPP_BUILTINS ();
TARGET_OS_CPP_BUILTINS ();
TARGET_OBJFMT_CPP_BUILTINS ();
/* Support the __declspec keyword by turning them into attributes.
Note that the current way we do this may result in a collision
with predefined attributes later on. This can be solved by using
one attribute, say __declspec__, and passing args to it. The
problem with that approach is that args are not accumulated: each
new appearance would clobber any existing args. */
if (TARGET_DECLSPEC)
builtin_define ("__declspec(x)=__attribute__((x))");
}
/* Pass an object-like macro. If it doesn't lie in the user's

View File

@ -42,15 +42,8 @@
merge_decl_attributes. */
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
/* Support the __declspec keyword by turning them into attributes.
We currently only support: naked, dllimport, and dllexport.
Note that the current way we do this may result in a collision with
predefined attributes later on. This can be solved by using one attribute,
say __declspec__, and passing args to it. The problem with that approach
is that args are not accumulated: each new appearance would clobber any
existing args. */
#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC "-D__pe__ -D__declspec(x)=__attribute__((x))"
#define SUBTARGET_CPP_SPEC "-D__pe__"
/* Experimental addition for pr 7885.

View File

@ -30,7 +30,7 @@
"memmove". We cannot simply set flag_no_builtin in arm.c because
(a) flag_no_builtin is not declared in language-independent code,
and (b) that would prevent users from explicitly overriding the
default with -fno-builtin, which may sometimes be useful.
default with -fbuiltin, which may sometimes be useful.
Make all symbols hidden by default. Symbian OS expects that all
exported symbols will be explicitly marked with
@ -48,3 +48,6 @@
#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} " \
"%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} " \
"-X"
/* Support the "dllimport" attribute. */
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1

View File

@ -55,6 +55,8 @@ Boston, MA 02111-1307, USA. */
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 16
#define TARGET_DECLSPEC 1
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
@ -63,7 +65,6 @@ Boston, MA 02111-1307, USA. */
builtin_define ("_X86_"); \
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
builtin_assert ("system=beos"); \
if (flag_pic) \
{ \

View File

@ -72,14 +72,6 @@ Boston, MA 02111-1307, USA. */
#define MAYBE_UWIN_CPP_BUILTINS() /* Nothing. */
/* Support the __declspec keyword by turning them into attributes.
We currently only support: dllimport and dllexport.
Note that the current way we do this may result in a collision with
predefined attributes later on. This can be solved by using one attribute,
say __declspec__, and passing args to it. The problem with that approach
is that args are not accumulated: each new appearance would clobber any
existing args. */
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
@ -88,7 +80,6 @@ Boston, MA 02111-1307, USA. */
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
if (!flag_iso) \
{ \
builtin_define ("_stdcall=__attribute__((__stdcall__))"); \

View File

@ -54,6 +54,8 @@ Boston, MA 02111-1307, USA. */
#define ASM_LOAD_ADDR(loc, reg) " leal " #loc "," #reg "\n"
#define TARGET_DECLSPEC 1
/* cpp handles __STDC__ */
#define TARGET_OS_CPP_BUILTINS() \
do \
@ -64,7 +66,6 @@ Boston, MA 02111-1307, USA. */
builtin_define ("_X86_=1"); \
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=interix"); \
if (preprocessing_asm_p ()) \

View File

@ -35,19 +35,11 @@
merge_decl_attributes. */
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
/* Support the __declspec keyword by turning them into attributes.
We currently only support: dllexport and dllimport.
Note that the current way we do this may result in a collision with
predefined attributes later on. This can be solved by using one attribute,
say __declspec__, and passing args to it. The problem with that approach
is that args are not accumulated: each new appearance would clobber any
existing args. */
#define TARGET_CPU_CPP_BUILTINS() \
do \
{ \
builtin_define ("__mcore__"); \
builtin_define ("__MCORE__"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
if (TARGET_LITTLE_END) \
builtin_define ("__MCORELE__"); \
else \

View File

@ -27,14 +27,7 @@
/* Default to using the Renesas ABI. */
#define TARGET_ABI_DEFAULT RENESAS_BIT
/* Support the __declspec keyword by turning them into attributes.
We currently only support: naked, dllimport, and dllexport.
Note that the current way we do this may result in a collision with
predefined attributes later on. This can be solved by using one attribute,
say __declspec__, and passing args to it. The problem with that approach
is that args are not accumulated: each new appearance would clobber any
existing args. */
#define SUBTARGET_CPP_SPEC "-D__declspec(x)=__attribute__((x))"
#define SUBTARGET_CPP_SPEC ""
/* Get tree.c to declare merge_dllimport_decl_attributes(). */
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES

View File

@ -415,6 +415,16 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
#define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
#endif
#ifndef TARGET_DECLSPEC
#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
/* If the target supports the "dllimport" attribute, users are
probably used to the "__declspec" syntax. */
#define TARGET_DECLSPEC 1
#else
#define TARGET_DECLSPEC 0
#endif
#endif
/* By default, the preprocessor should be invoked the same way in C++
as in C. */
#ifndef CPLUSPLUS_CPP_SPEC

View File

@ -2177,7 +2177,7 @@ int i __attribute__ ((visibility ("hidden")));
See the ELF gABI for complete details, but the short story is:
@table @dfn
@c keep this list of visibilies in alphabetical order.
@c keep this list of visibilities in alphabetical order.
@item default
Default visibility is the normal case for ELF. This value is

View File

@ -8346,6 +8346,15 @@ as the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. This is done
in @file{i386/cygwin.h} and @file{i386/i386.c}, for example.
@end deftypefn
@defmac TARGET_DECLSPEC
Define this macro to a non-zero value if you want to treat
@code{__declspec(X)} as equivalent to @code{__attribute((X))}. By
default, this behavior is enabled only for targets that define
@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. The current implementation
of @code{__declspec} is via a built-in macro, but you should not rely
on this implementation detail.
@end defmac
@deftypefn {Target Hook} void TARGET_INSERT_ATTRIBUTES (tree @var{node}, tree *@var{attr_ptr})
Define this target hook if you want to be able to add attributes to a decl
when it is being created. This is normally useful for back ends which