Commit 63c5b495 by Mark Mitchell Committed by Mark Mitchell

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
parent 564076f5
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> 2004-08-04 Paul Brook <paul@codesourcery.com>
* target-def.h (TARGET_CXX_CDTOR_RETURNS_THIS): Define. * target-def.h (TARGET_CXX_CDTOR_RETURNS_THIS): Define.
......
...@@ -426,6 +426,15 @@ c_cpp_builtins (cpp_reader *pfile) ...@@ -426,6 +426,15 @@ c_cpp_builtins (cpp_reader *pfile)
TARGET_CPU_CPP_BUILTINS (); TARGET_CPU_CPP_BUILTINS ();
TARGET_OS_CPP_BUILTINS (); TARGET_OS_CPP_BUILTINS ();
TARGET_OBJFMT_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 /* Pass an object-like macro. If it doesn't lie in the user's
......
...@@ -42,15 +42,8 @@ ...@@ -42,15 +42,8 @@
merge_decl_attributes. */ merge_decl_attributes. */
#define TARGET_DLLIMPORT_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 #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. /* Experimental addition for pr 7885.
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
"memmove". We cannot simply set flag_no_builtin in arm.c because "memmove". We cannot simply set flag_no_builtin in arm.c because
(a) flag_no_builtin is not declared in language-independent code, (a) flag_no_builtin is not declared in language-independent code,
and (b) that would prevent users from explicitly overriding the 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 Make all symbols hidden by default. Symbian OS expects that all
exported symbols will be explicitly marked with exported symbols will be explicitly marked with
...@@ -48,3 +48,6 @@ ...@@ -48,3 +48,6 @@
#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} " \ #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} " \
"%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} " \ "%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} " \
"-X" "-X"
/* Support the "dllimport" attribute. */
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
...@@ -55,6 +55,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -55,6 +55,8 @@ Boston, MA 02111-1307, USA. */
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
#define TARGET_DECLSPEC 1
#define TARGET_OS_CPP_BUILTINS() \ #define TARGET_OS_CPP_BUILTINS() \
do \ do \
{ \ { \
...@@ -63,7 +65,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -63,7 +65,6 @@ Boston, MA 02111-1307, USA. */
builtin_define ("_X86_"); \ builtin_define ("_X86_"); \
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
builtin_assert ("system=beos"); \ builtin_assert ("system=beos"); \
if (flag_pic) \ if (flag_pic) \
{ \ { \
......
...@@ -72,14 +72,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -72,14 +72,6 @@ Boston, MA 02111-1307, USA. */
#define MAYBE_UWIN_CPP_BUILTINS() /* Nothing. */ #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() \ #define TARGET_OS_CPP_BUILTINS() \
do \ do \
{ \ { \
...@@ -88,7 +80,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -88,7 +80,6 @@ Boston, MA 02111-1307, USA. */
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
builtin_define ("__fastcall=__attribute__((__fastcall__))"); \ builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
if (!flag_iso) \ if (!flag_iso) \
{ \ { \
builtin_define ("_stdcall=__attribute__((__stdcall__))"); \ builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
......
...@@ -54,6 +54,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -54,6 +54,8 @@ Boston, MA 02111-1307, USA. */
#define ASM_LOAD_ADDR(loc, reg) " leal " #loc "," #reg "\n" #define ASM_LOAD_ADDR(loc, reg) " leal " #loc "," #reg "\n"
#define TARGET_DECLSPEC 1
/* cpp handles __STDC__ */ /* cpp handles __STDC__ */
#define TARGET_OS_CPP_BUILTINS() \ #define TARGET_OS_CPP_BUILTINS() \
do \ do \
...@@ -64,7 +66,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -64,7 +66,6 @@ Boston, MA 02111-1307, USA. */
builtin_define ("_X86_=1"); \ builtin_define ("_X86_=1"); \
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
builtin_assert ("system=unix"); \ builtin_assert ("system=unix"); \
builtin_assert ("system=interix"); \ builtin_assert ("system=interix"); \
if (preprocessing_asm_p ()) \ if (preprocessing_asm_p ()) \
......
...@@ -35,19 +35,11 @@ ...@@ -35,19 +35,11 @@
merge_decl_attributes. */ merge_decl_attributes. */
#define TARGET_DLLIMPORT_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() \ #define TARGET_CPU_CPP_BUILTINS() \
do \ do \
{ \ { \
builtin_define ("__mcore__"); \ builtin_define ("__mcore__"); \
builtin_define ("__MCORE__"); \ builtin_define ("__MCORE__"); \
builtin_define ("__declspec(x)=__attribute__((x))"); \
if (TARGET_LITTLE_END) \ if (TARGET_LITTLE_END) \
builtin_define ("__MCORELE__"); \ builtin_define ("__MCORELE__"); \
else \ else \
......
...@@ -27,14 +27,7 @@ ...@@ -27,14 +27,7 @@
/* Default to using the Renesas ABI. */ /* Default to using the Renesas ABI. */
#define TARGET_ABI_DEFAULT RENESAS_BIT #define TARGET_ABI_DEFAULT RENESAS_BIT
/* Support the __declspec keyword by turning them into attributes. #define SUBTARGET_CPP_SPEC ""
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))"
/* Get tree.c to declare merge_dllimport_decl_attributes(). */ /* Get tree.c to declare merge_dllimport_decl_attributes(). */
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES #define TARGET_DLLIMPORT_DECL_ATTRIBUTES
......
...@@ -415,6 +415,16 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \ ...@@ -415,6 +415,16 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
#define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM #define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
#endif #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++ /* By default, the preprocessor should be invoked the same way in C++
as in C. */ as in C. */
#ifndef CPLUSPLUS_CPP_SPEC #ifndef CPLUSPLUS_CPP_SPEC
......
...@@ -2177,7 +2177,7 @@ int i __attribute__ ((visibility ("hidden"))); ...@@ -2177,7 +2177,7 @@ int i __attribute__ ((visibility ("hidden")));
See the ELF gABI for complete details, but the short story is: See the ELF gABI for complete details, but the short story is:
@table @dfn @table @dfn
@c keep this list of visibilies in alphabetical order. @c keep this list of visibilities in alphabetical order.
@item default @item default
Default visibility is the normal case for ELF. This value is Default visibility is the normal case for ELF. This value is
......
...@@ -8346,6 +8346,15 @@ as the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. This is done ...@@ -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. in @file{i386/cygwin.h} and @file{i386/i386.c}, for example.
@end deftypefn @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}) @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 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 when it is being created. This is normally useful for back ends which
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment