aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2002-05-16 19:03:02 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-05-16 19:03:02 +0000
commit5279d7394efe3e6d39e9c5f0bbb066e63f4cf398 (patch)
tree7ba2394a66b4c75f323247f002ba280c373fb85a /gcc/cppinit.c
parent62e6ca55bd6a235d9feccd4ac48c2b89e0bc32e5 (diff)
downloadgcc-5279d7394efe3e6d39e9c5f0bbb066e63f4cf398.zip
gcc-5279d7394efe3e6d39e9c5f0bbb066e63f4cf398.tar.gz
gcc-5279d7394efe3e6d39e9c5f0bbb066e63f4cf398.tar.bz2
c-common.c (STDC_0_IN_SYSTEM_HEADERS, [...]): Default-define here.
* c-common.c (STDC_0_IN_SYSTEM_HEADERS, REGISTER_PREFIX): Default-define here. (builtin_define_with_value): Can now wrap the expansion in quotation marks if such is wanted. (cb_register_builtins): Update calls to builtin_define_with_value. Define __REGISTER_PREFIX__, __USER_LABEL_PREFIX__, and __VERSION__ here. (c_common_init): Set options->stdc_0_in_system_headers. * c-lex.h: Update prototype of builtin_define_with_value. * cppdefault.h: Remove default definitions of USER_LABEL_PREFIX and REGISTER_PREFIX. * cppinit.c (VERS, ULP, C, X): Kill. (builtin_array): Remove entries for __VERSION__, __USER_LABEL_PREFIX__, __REGISTER_PREFIX__, and __HAVE_BUILTIN_SETJMP__. Make __STDC__ always a builtin, not a constant. (init_builtins): Kill off a bunch of now-dead code. (COMMAND_LINE_OPTIONS): Remove -fleading-underscore and -fno-leading-underscore. (cpp_handle_option): Remove code to set user_label_prefix. (cpp_post_options): Likewise. * cpplib.h (struct cpp_options): Remove user_label_prefix. (stdc_0_in_system_headers): New. * cppmacro.c (builtin_macro): Check CPP_OPTION (pfile, stdc_0_in_system_headers) too to decide the value of __STDC__. * tradcpp.c (user_label_prefix): Kill. (main): Remove code handling -f(no-)leading-underscore. (initialize_builtins): Don't define __REGISTER_PREFIX__ or __USER_LABEL_PREFIX__. (install_value): Wrap compound statement in dummy loop so the macro works properly in an if statement. From-SVN: r53525
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c77
1 files changed, 9 insertions, 68 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 57fa4c0..a03450c 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -623,11 +623,6 @@ cpp_destroy (pfile)
known at build time should not be flagged BUILTIN, as then they do
not appear in macro dumps with e.g. -dM or -dD.
- Two values are not compile time constants, so we tag
- them in the FLAGS field instead:
- VERS value is the global version_string, quoted
- ULP value is the global user_label_prefix
-
Also, macros with CPLUS set in the flags field are entered only for C++. */
struct builtin
{
@@ -638,15 +633,11 @@ struct builtin
unsigned short flags;
unsigned short len;
};
-#define VERS 0x01
-#define ULP 0x02
#define CPLUS 0x04
#define BUILTIN 0x08
#define OPERATOR 0x10
#define B(n, t) { U n, 0, t, 0, BUILTIN, sizeof n - 1 }
-#define C(n, v) { U n, v, 0, 0, 0, sizeof n - 1 }
-#define X(n, f) { U n, 0, 0, 0, f, sizeof n - 1 }
#define O(n, c, f) { U n, 0, 0, c, OPERATOR | f, sizeof n - 1 }
static const struct builtin builtin_array[] =
{
@@ -657,16 +648,7 @@ static const struct builtin builtin_array[] =
B("__LINE__", BT_SPECLINE),
B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL),
B("_Pragma", BT_PRAGMA),
-
- X("__VERSION__", VERS),
- X("__USER_LABEL_PREFIX__", ULP),
- C("__REGISTER_PREFIX__", REGISTER_PREFIX),
- C("__HAVE_BUILTIN_SETJMP__", "1"),
-#ifdef STDC_0_IN_SYSTEM_HEADERS
B("__STDC__", BT_STDC),
-#else
- C("__STDC__", "1"),
-#endif
/* Named operators known to the preprocessor. These cannot be #defined
and always have their stated meaning. They are treated like normal
@@ -685,8 +667,6 @@ static const struct builtin builtin_array[] =
O("xor_eq", CPP_XOR_EQ, CPLUS)
};
#undef B
-#undef C
-#undef X
#undef O
#define builtin_array_end (builtin_array + ARRAY_SIZE (builtin_array))
@@ -700,51 +680,24 @@ init_builtins (pfile)
for(b = builtin_array; b < builtin_array_end; b++)
{
+ cpp_hashnode *hp;
if ((b->flags & CPLUS) && ! CPP_OPTION (pfile, cplusplus))
continue;
if ((b->flags & OPERATOR) && ! CPP_OPTION (pfile, operator_names))
continue;
- if (b->flags & (OPERATOR | BUILTIN))
+ hp = cpp_lookup (pfile, b->name, b->len);
+ if (b->flags & OPERATOR)
{
- cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
- if (b->flags & OPERATOR)
- {
- hp->flags |= NODE_OPERATOR;
- hp->value.operator = b->operator;
- }
- else
- {
- hp->type = NT_MACRO;
- hp->flags |= NODE_BUILTIN | NODE_WARN;
- hp->value.builtin = b->builtin;
- }
+ hp->flags |= NODE_OPERATOR;
+ hp->value.operator = b->operator;
}
- else /* A standard macro of some kind. */
+ else
{
- const char *val;
- char *str;
-
- if (b->flags & VERS)
- {
- /* Allocate enough space for 'name "value"\n\0'. */
- str = alloca (b->len + strlen (version_string) + 5);
- sprintf (str, "%s \"%s\"\n", b->name, version_string);
- }
- else
- {
- if (b->flags & ULP)
- val = CPP_OPTION (pfile, user_label_prefix);
- else
- val = b->value;
-
- /* Allocate enough space for "name value\n\0". */
- str = alloca (b->len + strlen (val) + 3);
- sprintf(str, "%s %s\n", b->name, val);
- }
-
- _cpp_define_builtin (pfile, str);
+ hp->type = NT_MACRO;
+ hp->flags |= NODE_BUILTIN | NODE_WARN;
+ hp->value.builtin = b->builtin;
}
}
@@ -1209,8 +1162,6 @@ new_pending_directive (pend, text, handler)
DEF_OPT("U", no_mac, OPT_U) \
DEF_OPT("W", no_arg, OPT_W) /* arg optional */ \
DEF_OPT("d", no_arg, OPT_d) \
- DEF_OPT("fleading-underscore", 0, OPT_fleading_underscore) \
- DEF_OPT("fno-leading-underscore", 0, OPT_fno_leading_underscore) \
DEF_OPT("fno-operator-names", 0, OPT_fno_operator_names) \
DEF_OPT("fno-preprocessed", 0, OPT_fno_preprocessed) \
DEF_OPT("fno-show-column", 0, OPT_fno_show_column) \
@@ -1408,12 +1359,6 @@ cpp_handle_option (pfile, argc, argv, ignore)
{
case N_OPTS: /* Shut GCC up. */
break;
- case OPT_fleading_underscore:
- CPP_OPTION (pfile, user_label_prefix) = "_";
- break;
- case OPT_fno_leading_underscore:
- CPP_OPTION (pfile, user_label_prefix) = "";
- break;
case OPT_fno_operator_names:
CPP_OPTION (pfile, operator_names) = 0;
break;
@@ -1843,10 +1788,6 @@ cpp_post_options (pfile)
if (CPP_OPTION (pfile, cplusplus))
CPP_OPTION (pfile, warn_traditional) = 0;
- /* Set this if it hasn't been set already. */
- if (CPP_OPTION (pfile, user_label_prefix) == NULL)
- CPP_OPTION (pfile, user_label_prefix) = USER_LABEL_PREFIX;
-
/* Permanently disable macro expansion if we are rescanning
preprocessed text. */
if (CPP_OPTION (pfile, preprocessed))