Commit e0322d5c by Neil Booth Committed by Neil Booth

c-common.c (preprocessing_asm): New macro.

	* c-common.c (preprocessing_asm): New macro.
	* c-lex.h (builtin_define, builtin_assert): Use pfile.
doc:
	* tm.texi: Update.
config/alpha:
	* alpha.h (CPLUSPLUS_CPP_SPEC): Remove.
	(CPP_SPEC): Simplify.
	(TARGET_CPU_CPP_BUILTINS): Update.
	* freebsd.h (TARGET_OS_CPP_BUILTINS): New.
	(CPP_SPEC): Simplify.
	* linux.h (CPLUSPLUS_CPP_SPEC): Remove.
	(TARGET_OS_CPP_BUILTINS): Update.
	* osf.h (CPP_XFLOAT_SPEC): Kill.
	(TARGET_OS_CPP_BUILTINS): Update.
	(CPP_SUBTARGET_SPEC, SUBTARGET_EXTRA_SPECS): Simplify.
	* osf5.h (CPP_XFLOAT_SPEC): Kill.
	* vms.h (CPP_SUBTARGET_SPEC): Kill.
	(TARGET_OS_CPP_BUILTINS): Update.

From-SVN: r53641
parent e3227f2c
2002-05-19 Neil Booth <neil@daikokuya.demon.co.uk>
* c-common.c (preprocessing_asm): New macro.
* c-lex.h (builtin_define, builtin_assert): Use pfile.
doc:
* tm.texi: Update.
config/alpha:
* alpha.h (CPLUSPLUS_CPP_SPEC): Remove.
(CPP_SPEC): Simplify.
(TARGET_CPU_CPP_BUILTINS): Update.
* freebsd.h (TARGET_OS_CPP_BUILTINS): New.
(CPP_SPEC): Simplify.
* linux.h (CPLUSPLUS_CPP_SPEC): Remove.
(TARGET_OS_CPP_BUILTINS): Update.
* osf.h (CPP_XFLOAT_SPEC): Kill.
(TARGET_OS_CPP_BUILTINS): Update.
(CPP_SUBTARGET_SPEC, SUBTARGET_EXTRA_SPECS): Simplify.
* osf5.h (CPP_XFLOAT_SPEC): Kill.
* vms.h (CPP_SUBTARGET_SPEC): Kill.
(TARGET_OS_CPP_BUILTINS): Update.
2002-05-19 Richard Henderson <rth@redhat.com> 2002-05-19 Richard Henderson <rth@redhat.com>
* varasm.c (default_binds_local_p): Fix typo. * varasm.c (default_binds_local_p): Fix typo.
......
...@@ -4374,6 +4374,7 @@ cb_register_builtins (pfile) ...@@ -4374,6 +4374,7 @@ cb_register_builtins (pfile)
/* A straightforward target hook doesn't work, because of problems /* A straightforward target hook doesn't work, because of problems
linking that hook's body when part of non-C front ends. */ linking that hook's body when part of non-C front ends. */
#define preprocessing_asm_p() (cpp_get_options (pfile)->lang == CLK_ASM)
TARGET_CPU_CPP_BUILTINS (); TARGET_CPU_CPP_BUILTINS ();
TARGET_OS_CPP_BUILTINS (); TARGET_OS_CPP_BUILTINS ();
} }
...@@ -4407,10 +4408,6 @@ builtin_define_std (macro) ...@@ -4407,10 +4408,6 @@ builtin_define_std (macro)
/* If it was in user's namespace... */ /* If it was in user's namespace... */
if (p != buff + 2) if (p != buff + 2)
{ {
/* Define the original macro if permitted. */
if (!flag_iso)
cpp_define (parse_in, macro);
/* Define the macro with leading and following __. */ /* Define the macro with leading and following __. */
if (q[-1] != '_') if (q[-1] != '_')
*q++ = '_'; *q++ = '_';
...@@ -4418,6 +4415,10 @@ builtin_define_std (macro) ...@@ -4418,6 +4415,10 @@ builtin_define_std (macro)
*q++ = '_'; *q++ = '_';
*q = '\0'; *q = '\0';
cpp_define (parse_in, p); cpp_define (parse_in, p);
/* Finally, define the original macro if permitted. */
if (!flag_iso)
cpp_define (parse_in, macro);
} }
} }
......
...@@ -35,8 +35,8 @@ extern int indent_level; ...@@ -35,8 +35,8 @@ extern int indent_level;
struct cpp_reader; struct cpp_reader;
extern struct cpp_reader* parse_in; extern struct cpp_reader* parse_in;
#define builtin_define(TXT) cpp_define (parse_in, TXT) #define builtin_define(TXT) cpp_define (pfile, TXT)
#define builtin_assert(TXT) cpp_assert (parse_in, TXT) #define builtin_assert(TXT) cpp_assert (pfile, TXT)
/* 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
namespace, defines it unconditionally. Otherwise define a version namespace, defines it unconditionally. Otherwise define a version
......
...@@ -67,21 +67,25 @@ Boston, MA 02111-1307, USA. */ ...@@ -67,21 +67,25 @@ Boston, MA 02111-1307, USA. */
builtin_define ("__IEEE_FP"); \ builtin_define ("__IEEE_FP"); \
if (TARGET_IEEE_WITH_INEXACT) \ if (TARGET_IEEE_WITH_INEXACT) \
builtin_define ("__IEEE_FP_INEXACT"); \ builtin_define ("__IEEE_FP_INEXACT"); \
\
/* Macros dependent on the C dialect. */ \
if (preprocessing_asm_p ()) \
builtin_define_std ("LANGUAGE_ASSEMBLY"); \
else if (c_language == clk_c) \
builtin_define_std ("LANGUAGE_C"); \
else if (c_language == clk_cplusplus) \
{ \
builtin_define ("__LANGUAGE_C_PLUS_PLUS"); \
builtin_define ("__LANGUAGE_C_PLUS_PLUS__");\
} \
else if (c_language == clk_objective_c) \
{ \
builtin_define ("__LANGUAGE_OBJECTIVE_C"); \
builtin_define ("__LANGUAGE_OBJECTIVE_C__");\
} \
} while (0) } while (0)
/* For C++ we need to ensure that __LANGUAGE_C_PLUS_PLUS is defined independent #define CPP_SPEC "%(cpp_subtarget)"
of the source file extension. */
#define CPLUSPLUS_CPP_SPEC "-D__LANGUAGE_C_PLUS_PLUS__\
-D__LANGUAGE_C_PLUS_PLUS %(cpp)"
/* Write out the correct language type definition for the header files.
Unless we have assembler language, write out the symbols for C. */
#define CPP_SPEC "\
%{!undef:\
%{.S:-D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY }}\
%{.m:-D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C }\
%{!.S:%{!.cc:%{!.cxx:%{!.cpp:%{!.cp:%{!.c++:%{!.C:%{!.m:-D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C }}}}}}}}}}\
%(cpp_subtarget)"
#ifndef CPP_SUBTARGET_SPEC #ifndef CPP_SUBTARGET_SPEC
#define CPP_SUBTARGET_SPEC "" #define CPP_SUBTARGET_SPEC ""
......
...@@ -24,10 +24,19 @@ Boston, MA 02111-1307, USA. */ ...@@ -24,10 +24,19 @@ Boston, MA 02111-1307, USA. */
the GCC option `-posix', and PIC issues as on all FreeBSD platforms, we must the GCC option `-posix', and PIC issues as on all FreeBSD platforms, we must
deal with the Alpha's FP issues. */ deal with the Alpha's FP issues. */
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
if (flag_pic) \
{ \
builtin_define ("__PIC__"); \
builtin_define ("__pic__"); \
} \
}
while (0)
#undef CPP_SPEC #undef CPP_SPEC
#define CPP_SPEC "%(cpp_subtarget) \ #define CPP_SPEC "%(cpp_subtarget) %{posix:-D_POSIX_SOURCE}"
%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \
%{posix:-D_POSIX_SOURCE}"
#define LINK_SPEC "%{G*} %{relax:-relax} \ #define LINK_SPEC "%{G*} %{relax:-relax} \
%{p:%e`-p' not supported; use `-pg' and gprof(1)} \ %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
......
...@@ -30,12 +30,11 @@ Boston, MA 02111-1307, USA. */ ...@@ -30,12 +30,11 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("linux"); \ builtin_define_std ("linux"); \
builtin_define_std ("unix"); \ builtin_define_std ("unix"); \
builtin_assert ("system=linux"); \ builtin_assert ("system=linux"); \
/* The GNU C++ standard library requires this. */ \
if (c_language == clk_cplusplus) \
builtin_define ("_GNU_SOURCE"); \
} while (0) } while (0)
/* The GNU C++ standard library requires that these macros be defined. */
#undef CPLUSPLUS_CPP_SPEC
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
#undef LIB_SPEC #undef LIB_SPEC
#define LIB_SPEC \ #define LIB_SPEC \
"%{shared: -lc} \ "%{shared: -lc} \
......
...@@ -39,23 +39,23 @@ Boston, MA 02111-1307, USA. */ ...@@ -39,23 +39,23 @@ Boston, MA 02111-1307, USA. */
builtin_define ("_SYSTYPE_BSD"); \ builtin_define ("_SYSTYPE_BSD"); \
builtin_define ("__osf__"); \ builtin_define ("__osf__"); \
builtin_define ("_LONGLONG"); \ builtin_define ("_LONGLONG"); \
builtin_define ("__EXTERN_PREFIX"); \
builtin_assert ("system=unix"); \ builtin_assert ("system=unix"); \
builtin_assert ("system=xpg4"); \ builtin_assert ("system=xpg4"); \
/* Tru64 UNIX V5 has a 16 byte long \
double type and requires __X_FLOAT \
to be defined for <math.h>. */ \
if (LONG_DOUBLE_TYPE_SIZE == 128) \
builtin_define ("__X_FLOAT"); \
} while (0) } while (0)
/* Tru64 UNIX V5 requires additional definitions for 16 byte long double
support. Empty by default. */
#define CPP_XFLOAT_SPEC ""
/* Accept DEC C flags for multithreaded programs. We use _PTHREAD_USE_D4 /* Accept DEC C flags for multithreaded programs. We use _PTHREAD_USE_D4
instead of PTHREAD_USE_D4 since both have the same effect and the former instead of PTHREAD_USE_D4 since both have the same effect and the former
doesn't invade the users' namespace. */ doesn't invade the users' namespace. */
#undef CPP_SUBTARGET_SPEC #undef CPP_SUBTARGET_SPEC
#define CPP_SUBTARGET_SPEC \ #define CPP_SUBTARGET_SPEC \
"%{pthread|threads:-D_REENTRANT} %{threads:-D_PTHREAD_USE_D4} %(cpp_xfloat) \ "%{pthread|threads:-D_REENTRANT} %{threads:-D_PTHREAD_USE_D4}"
-D__EXTERN_PREFIX"
/* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */ /* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */
...@@ -143,9 +143,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -143,9 +143,7 @@ Boston, MA 02111-1307, USA. */
#endif #endif
#undef SUBTARGET_EXTRA_SPECS #undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \ #define SUBTARGET_EXTRA_SPECS { "asm_oldas", ASM_OLDAS_SPEC }
{ "cpp_xfloat", CPP_XFLOAT_SPEC }, \
{ "asm_oldas", ASM_OLDAS_SPEC }
/* Indicate that we have a stamp.h to use. */ /* Indicate that we have a stamp.h to use. */
#ifndef CROSS_COMPILE #ifndef CROSS_COMPILE
......
...@@ -21,13 +21,6 @@ ...@@ -21,13 +21,6 @@
#undef LONG_DOUBLE_TYPE_SIZE #undef LONG_DOUBLE_TYPE_SIZE
#define LONG_DOUBLE_TYPE_SIZE 128 #define LONG_DOUBLE_TYPE_SIZE 128
/* Tru64 UNIX V5 has a 16 byte long double type and requires __X_FLOAT to be
defined to get the appropriate prototypes for the long double functions
in <math.h>. */
#undef CPP_XFLOAT_SPEC
#define CPP_XFLOAT_SPEC "-D__X_FLOAT"
/* In Tru64 UNIX V5.1, Compaq introduced a new assembler /* In Tru64 UNIX V5.1, Compaq introduced a new assembler
(/usr/lib/cmplrs/cc/adu) which currently (versions between 3.04.29 and (/usr/lib/cmplrs/cc/adu) which currently (versions between 3.04.29 and
3.04.32) breaks mips-tfile. Passing the undocumented -oldas flag reverts 3.04.32) breaks mips-tfile. Passing the undocumented -oldas flag reverts
......
...@@ -35,14 +35,12 @@ Boston, MA 02111-1307, USA. */ ...@@ -35,14 +35,12 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("VMS"); \ builtin_define_std ("VMS"); \
builtin_define ("__ALPHA"); \ builtin_define ("__ALPHA"); \
builtin_assert ("system=vms"); \ builtin_assert ("system=vms"); \
if (TARGET_FLOAT_VAX) \
builtin_define ("__G_FLOAT"); \
else \
builtin_define ("__IEEE_FLOAT"); \
} while (0) } while (0)
#undef CPP_SUBTARGET_SPEC
#define CPP_SUBTARGET_SPEC "\
%{mfloat-ieee:-D__IEEE_FLOAT} \
%{mfloat-vax:-D__G_FLOAT} \
%{!mfloat-vax:-D__IEEE_FLOAT}"
/* By default, allow $ to be part of an identifier. */ /* By default, allow $ to be part of an identifier. */
#define DOLLARS_IN_IDENTIFIERS 2 #define DOLLARS_IN_IDENTIFIERS 2
......
...@@ -609,6 +609,13 @@ and possibly @code{unix}; passing @code{_mips} defines @code{__mips}, ...@@ -609,6 +609,13 @@ and possibly @code{unix}; passing @code{_mips} defines @code{__mips},
@code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64} @code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64}
defines only @code{_ABI64}. defines only @code{_ABI64}.
You can also test for the C dialect being compiled. The variable
@code{c_language} is set to one of @code{clk_c}, @code{clk_cplusplus}
or @code{clk_objective_c}. Note that if we are preprocessing
assembler, this variable will be @code{clk_c} but the function-like
macro @code{preprocessing_asm_p()} will return true, so you might want
to check for that first.
With @code{TARGET_OS_CPP_BUILTINS} this macro obsoletes the With @code{TARGET_OS_CPP_BUILTINS} this macro obsoletes the
@code{CPP_PREDEFINES} target macro. @code{CPP_PREDEFINES} target macro.
......
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