aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-04-10 03:27:21 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-04-10 03:27:21 +0000
commit8c389f849ab65cfb5bc82fb2a3c4d815e193ecfd (patch)
treee001640b191e5f97c968fedc53d3750c074b5126 /gcc/cppinit.c
parent3a3677ff46c5e086f59fdf7dc64e5eb09354bf25 (diff)
downloadgcc-8c389f849ab65cfb5bc82fb2a3c4d815e193ecfd.zip
gcc-8c389f849ab65cfb5bc82fb2a3c4d815e193ecfd.tar.gz
gcc-8c389f849ab65cfb5bc82fb2a3c4d815e193ecfd.tar.bz2
cpphash.c (timestamp): Delete.
* cpphash.c (timestamp): Delete. (del_HASHNODE): If type is T_MCONST, free value.cpval. (special_symbol): Remove unnecessary braces. Remove T_VERSION. Treat T_STDC like T_CONST unless STDC_0_IN_SYSTEM_HEADERS. Render both __DATE__ and __TIME__ when one is encountered, then convert them into T_MCONST nodes. * cppinit.c (builtin_array): version_string is T_MCONST. __STDC__ has a "1" in its cpval. Don't have a terminator entry. Clean up which entries are dumped. (initialize_builtins): Only __STDC__ gets the special -traditional treatment. Count the length of builtin_array. Render version_string here. * cpphash.h: Remove T_VERSION. Add T_MCONST. * cpplib.h (struct cpp_reader): Remove timebuf. From-SVN: r33047
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index f4391ff..32293f6 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -588,9 +588,8 @@ cpp_cleanup (pfile)
be entered in the macro hash table under the name NAME, with value
VALUE (if any). FLAGS tweaks the behavior a little:
DUMP write debug info for this macro
- STDC define only if not -traditional
- ULP value is the global user_label_prefix (which can't be
- put directly into the table).
+ VERS value is the global version_string, quoted
+ ULP value is the global user_label_prefix
*/
struct builtin
@@ -601,35 +600,35 @@ struct builtin
unsigned short flags;
};
#define DUMP 0x01
-#define STDC 0x02
-#define VERS 0x04
-#define ULP 0x08
+#define VERS 0x02
+#define ULP 0x04
static const struct builtin builtin_array[] =
{
- { "__TIME__", 0, T_TIME, DUMP },
- { "__DATE__", 0, T_DATE, DUMP },
- { "__FILE__", 0, T_FILE, 0 },
- { "__BASE_FILE__", 0, T_BASE_FILE, 0 },
- { "__LINE__", 0, T_SPECLINE, 0 },
- { "__INCLUDE_LEVEL__", 0, T_INCLUDE_LEVEL, 0 },
- { "__VERSION__", 0, T_VERSION, DUMP|VERS },
- { "__STDC__", 0, T_STDC, DUMP|STDC },
-
- { "__USER_LABEL_PREFIX__", 0, T_CONST, ULP },
- { "__REGISTER_PREFIX__", REGISTER_PREFIX, T_CONST, 0 },
- { "__HAVE_BUILTIN_SETJMP__", "1", T_CONST, 0 },
+ { "__TIME__", 0, T_TIME, 0 },
+ { "__DATE__", 0, T_DATE, 0 },
+ { "__FILE__", 0, T_FILE, 0 },
+ { "__BASE_FILE__", 0, T_BASE_FILE, 0 },
+ { "__LINE__", 0, T_SPECLINE, 0 },
+ { "__INCLUDE_LEVEL__", 0, T_INCLUDE_LEVEL, 0 },
+
+ { "__VERSION__", 0, T_MCONST, DUMP|VERS },
+ { "__USER_LABEL_PREFIX__", 0, T_CONST, DUMP|ULP },
+ { "__STDC__", "1", T_STDC, DUMP },
+ { "__REGISTER_PREFIX__", REGISTER_PREFIX, T_CONST, DUMP },
+ { "__HAVE_BUILTIN_SETJMP__", "1", T_CONST, DUMP },
#ifndef NO_BUILTIN_SIZE_TYPE
- { "__SIZE_TYPE__", SIZE_TYPE, T_CONST, DUMP },
+ { "__SIZE_TYPE__", SIZE_TYPE, T_CONST, DUMP },
#endif
#ifndef NO_BUILTIN_PTRDIFF_TYPE
- { "__PTRDIFF_TYPE__", PTRDIFF_TYPE, T_CONST, DUMP },
+ { "__PTRDIFF_TYPE__", PTRDIFF_TYPE, T_CONST, DUMP },
#endif
#ifndef NO_BUILTIN_WCHAR_TYPE
- { "__WCHAR_TYPE__", WCHAR_TYPE, T_CONST, DUMP },
+ { "__WCHAR_TYPE__", WCHAR_TYPE, T_CONST, DUMP },
#endif
- { 0, 0, 0, 0 }
};
+#define builtin_array_end \
+ builtin_array + sizeof(builtin_array)/sizeof(struct builtin)
/* Subroutine of cpp_start_read; reads the builtins table above and
enters the macros into the hash table. */
@@ -641,15 +640,18 @@ initialize_builtins (pfile)
const struct builtin *b;
const char *val;
HASHNODE *hp;
- for(b = builtin_array; b->name; b++)
+ for(b = builtin_array; b < builtin_array_end; b++)
{
- if ((b->flags & STDC) && CPP_TRADITIONAL (pfile))
+ if (b->type == T_STDC && CPP_TRADITIONAL (pfile))
continue;
if (b->flags & ULP)
val = user_label_prefix;
else if (b->flags & VERS)
- val = version_string;
+ {
+ val = xmalloc (strlen (version_string) + 3);
+ sprintf ((char *)val, "\"%s\"", version_string);
+ }
else
val = b->value;
@@ -662,7 +664,6 @@ initialize_builtins (pfile)
if ((b->flags & DUMP) && CPP_OPTION (pfile, debug_output))
dump_special_to_buffer (pfile, b->name);
}
-
}
#undef DUMP
#undef STDC