cppinit.c (set_lang): Move builtin handling to...
* cppinit.c (set_lang): Move builtin handling to... (init_builtins): ...here. (_cpp_create_reader): Move call to set_lang. From-SVN: r39934
This commit is contained in:
parent
064a552c29
commit
c740cee29d
|
@ -1,3 +1,9 @@
|
|||
2001-02-20 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* cppinit.c (set_lang): Move builtin handling to...
|
||||
(init_builtins): ...here.
|
||||
(_cpp_create_reader): Move call to set_lang.
|
||||
|
||||
2001-02-20 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* stmt.c (expand_return): If an attempt is made to return the
|
||||
|
|
|
@ -371,8 +371,6 @@ set_lang (pfile, lang)
|
|||
cpp_reader *pfile;
|
||||
enum c_lang lang;
|
||||
{
|
||||
struct cpp_pending *pend = CPP_OPTION (pfile, pending);
|
||||
|
||||
/* Defaults. */
|
||||
CPP_OPTION (pfile, lang) = lang;
|
||||
CPP_OPTION (pfile, objc) = 0;
|
||||
|
@ -388,7 +386,6 @@ set_lang (pfile, lang)
|
|||
CPP_OPTION (pfile, cplusplus_comments) = 1;
|
||||
CPP_OPTION (pfile, digraphs) = 1;
|
||||
CPP_OPTION (pfile, c99) = 1;
|
||||
new_pending_directive (pend, "__STDC_VERSION__=199901L", cpp_define);
|
||||
break;
|
||||
case CLK_GNUC89:
|
||||
CPP_OPTION (pfile, trigraphs) = 0;
|
||||
|
@ -400,7 +397,6 @@ set_lang (pfile, lang)
|
|||
|
||||
/* ISO C. */
|
||||
case CLK_STDC94:
|
||||
new_pending_directive (pend, "__STDC_VERSION__=199409L", cpp_define);
|
||||
case CLK_STDC89:
|
||||
CPP_OPTION (pfile, trigraphs) = 1;
|
||||
CPP_OPTION (pfile, dollars_in_ident) = 0;
|
||||
|
@ -408,7 +404,6 @@ set_lang (pfile, lang)
|
|||
CPP_OPTION (pfile, digraphs) = lang == CLK_STDC94;
|
||||
CPP_OPTION (pfile, c99) = 0;
|
||||
CPP_OPTION (pfile, extended_numbers) = 0;
|
||||
new_pending_directive (pend, "__STRICT_ANSI__", cpp_define);
|
||||
break;
|
||||
case CLK_STDC99:
|
||||
CPP_OPTION (pfile, trigraphs) = 1;
|
||||
|
@ -416,13 +411,10 @@ set_lang (pfile, lang)
|
|||
CPP_OPTION (pfile, cplusplus_comments) = 1;
|
||||
CPP_OPTION (pfile, digraphs) = 1;
|
||||
CPP_OPTION (pfile, c99) = 1;
|
||||
new_pending_directive (pend, "__STRICT_ANSI__", cpp_define);
|
||||
new_pending_directive (pend, "__STDC_VERSION__=199901L", cpp_define);
|
||||
break;
|
||||
|
||||
/* Objective C. */
|
||||
case CLK_OBJCXX:
|
||||
new_pending_directive (pend, "__cplusplus", cpp_define);
|
||||
CPP_OPTION (pfile, cplusplus) = 1;
|
||||
case CLK_OBJC:
|
||||
CPP_OPTION (pfile, trigraphs) = 0;
|
||||
|
@ -431,7 +423,6 @@ set_lang (pfile, lang)
|
|||
CPP_OPTION (pfile, digraphs) = 1;
|
||||
CPP_OPTION (pfile, c99) = 0;
|
||||
CPP_OPTION (pfile, objc) = 1;
|
||||
new_pending_directive (pend, "__OBJC__", cpp_define);
|
||||
break;
|
||||
|
||||
/* C++. */
|
||||
|
@ -443,7 +434,6 @@ set_lang (pfile, lang)
|
|||
CPP_OPTION (pfile, cplusplus_comments) = 1;
|
||||
CPP_OPTION (pfile, digraphs) = 1;
|
||||
CPP_OPTION (pfile, c99) = 0;
|
||||
new_pending_directive (pend, "__cplusplus", cpp_define);
|
||||
break;
|
||||
|
||||
/* Assembler. */
|
||||
|
@ -453,7 +443,6 @@ set_lang (pfile, lang)
|
|||
CPP_OPTION (pfile, cplusplus_comments) = 1;
|
||||
CPP_OPTION (pfile, digraphs) = 0;
|
||||
CPP_OPTION (pfile, c99) = 0;
|
||||
new_pending_directive (pend, "__ASSEMBLER__", cpp_define);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -509,6 +498,7 @@ cpp_create_reader (lang)
|
|||
|
||||
pfile = (cpp_reader *) xcalloc (1, sizeof (cpp_reader));
|
||||
|
||||
set_lang (pfile, lang);
|
||||
CPP_OPTION (pfile, warn_import) = 1;
|
||||
CPP_OPTION (pfile, discard_comments) = 1;
|
||||
CPP_OPTION (pfile, show_column) = 1;
|
||||
|
@ -518,9 +508,6 @@ cpp_create_reader (lang)
|
|||
CPP_OPTION (pfile, pending) =
|
||||
(struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending));
|
||||
|
||||
/* After creating pfile->pending. */
|
||||
set_lang (pfile, lang);
|
||||
|
||||
/* It's simplest to just create this struct whether or not it will
|
||||
be needed. */
|
||||
pfile->deps = deps_init ();
|
||||
|
@ -757,6 +744,23 @@ init_builtins (pfile)
|
|||
_cpp_define_builtin (pfile, str);
|
||||
}
|
||||
}
|
||||
|
||||
if (CPP_OPTION (pfile, cplusplus))
|
||||
_cpp_define_builtin (pfile, "__cplusplus 1");
|
||||
if (CPP_OPTION (pfile, objc))
|
||||
_cpp_define_builtin (pfile, "__OBJC__ 1");
|
||||
|
||||
if (CPP_OPTION (pfile, lang) == CLK_STDC94)
|
||||
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
|
||||
else if (CPP_OPTION (pfile, c99))
|
||||
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");
|
||||
|
||||
if (CPP_OPTION (pfile, lang) == CLK_STDC89
|
||||
|| CPP_OPTION (pfile, lang) == CLK_STDC94
|
||||
|| CPP_OPTION (pfile, lang) == CLK_STDC99)
|
||||
_cpp_define_builtin (pfile, "__STRICT_ANSI__ 1");
|
||||
else if (CPP_OPTION (pfile, lang) == CLK_ASM)
|
||||
_cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
|
||||
}
|
||||
#undef BUILTIN
|
||||
#undef OPERATOR
|
||||
|
|
Loading…
Reference in New Issue