diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-08-04 19:37:19 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-08-04 19:37:19 +0000 |
commit | 63c5b4952ee1141038f756fc5a44511296ad7f8e (patch) | |
tree | 3e625b8f05cee8c131162ddd24141215d432a989 /gcc | |
parent | 564076f545d934c127dcef53c0e7c60e199cf55e (diff) | |
download | gcc-63c5b4952ee1141038f756fc5a44511296ad7f8e.zip gcc-63c5b4952ee1141038f756fc5a44511296ad7f8e.tar.gz gcc-63c5b4952ee1141038f756fc5a44511296ad7f8e.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 22 | ||||
-rw-r--r-- | gcc/c-cppbuiltin.c | 9 | ||||
-rw-r--r-- | gcc/config/arm/pe.h | 9 | ||||
-rw-r--r-- | gcc/config/arm/symbian.h | 5 | ||||
-rw-r--r-- | gcc/config/i386/beos-elf.h | 3 | ||||
-rw-r--r-- | gcc/config/i386/cygming.h | 9 | ||||
-rw-r--r-- | gcc/config/i386/i386-interix.h | 3 | ||||
-rw-r--r-- | gcc/config/mcore/mcore.h | 8 | ||||
-rw-r--r-- | gcc/config/sh/symbian-pre.h | 9 | ||||
-rw-r--r-- | gcc/defaults.h | 10 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 2 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 9 |
12 files changed, 61 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64fff1d..0461d10 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index 3f0f688..441a38e 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -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 diff --git a/gcc/config/arm/pe.h b/gcc/config/arm/pe.h index 8eea54c..7db549e 100644 --- a/gcc/config/arm/pe.h +++ b/gcc/config/arm/pe.h @@ -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. diff --git a/gcc/config/arm/symbian.h b/gcc/config/arm/symbian.h index 05930d4..2f8320d 100644 --- a/gcc/config/arm/symbian.h +++ b/gcc/config/arm/symbian.h @@ -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 diff --git a/gcc/config/i386/beos-elf.h b/gcc/config/i386/beos-elf.h index 50c3926..b0de9bb 100644 --- a/gcc/config/i386/beos-elf.h +++ b/gcc/config/i386/beos-elf.h @@ -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) \ { \ diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index 69d7f79..9c2e22a 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -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__))"); \ diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h index 2a99ce5..4119aa2 100644 --- a/gcc/config/i386/i386-interix.h +++ b/gcc/config/i386/i386-interix.h @@ -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 ()) \ diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index b800a93..dde4e09 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -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 \ diff --git a/gcc/config/sh/symbian-pre.h b/gcc/config/sh/symbian-pre.h index aa23535..44fb4a9 100644 --- a/gcc/config/sh/symbian-pre.h +++ b/gcc/config/sh/symbian-pre.h @@ -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 diff --git a/gcc/defaults.h b/gcc/defaults.h index cd45f91..3cd779c 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -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 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 291e4fd..1b4b76b 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -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 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index cc3cfee..2a0147c 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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 |