Commit a01eb545 by Zack Weinberg Committed by Zack Weinberg

cppinit.c (lang_defaults): New table.

	* cppinit.c (lang_defaults): New table.
	(set_lang): Just read from lang_defaults into the live options
	structure.

From-SVN: r43699
parent 51817b10
2001-07-02 Zack Weinberg <zackw@stanford.edu> 2001-07-02 Zack Weinberg <zackw@stanford.edu>
* cppinit.c (lang_defaults): New table.
(set_lang): Just read from lang_defaults into the live options
structure.
2001-07-02 Zack Weinberg <zackw@stanford.edu>
* Makefile.in (doc): Depend on $(GENERATED_MANPAGES). * Makefile.in (doc): Depend on $(GENERATED_MANPAGES).
* doc/.cvsignore: Add gcc.1, cpp.1, gcov.1. * doc/.cvsignore: Add gcc.1, cpp.1, gcov.1.
* doc/gcc.1, doc/cpp.1, doc/gcov.1: Removed. * doc/gcc.1, doc/cpp.1, doc/gcov.1: Removed.
......
...@@ -370,85 +370,51 @@ merge_include_chains (pfile) ...@@ -370,85 +370,51 @@ merge_include_chains (pfile)
/* Sets internal flags correctly for a given language, and defines /* Sets internal flags correctly for a given language, and defines
macros if necessary. */ macros if necessary. */
struct lang_flags
{
char c99;
char objc;
char cplusplus;
char extended_numbers;
char trigraphs;
char dollars_in_ident;
char cplusplus_comments;
char digraphs;
};
/* ??? Enable $ in identifiers in assembly? */
static const struct lang_flags lang_defaults[] =
{ /* c99 objc c++ xnum trig dollar c++comm digr */
/* GNUC89 */ { 0, 0, 0, 1, 0, 1, 1, 1 },
/* GNUC99 */ { 1, 0, 0, 1, 0, 1, 1, 1 },
/* STDC89 */ { 0, 0, 0, 0, 1, 0, 0, 0 },
/* STDC94 */ { 0, 0, 0, 0, 1, 0, 0, 1 },
/* STDC99 */ { 1, 0, 0, 1, 1, 0, 1, 1 },
/* GNUCXX */ { 0, 0, 1, 1, 0, 1, 1, 1 },
/* CXX98 */ { 0, 0, 1, 1, 1, 0, 1, 1 },
/* OBJC */ { 0, 1, 0, 1, 0, 1, 1, 1 },
/* OBJCXX */ { 0, 1, 1, 1, 0, 1, 1, 1 },
/* ASM */ { 0, 0, 0, 1, 0, 0, 1, 0 }
};
static void static void
set_lang (pfile, lang) set_lang (pfile, lang)
cpp_reader *pfile; cpp_reader *pfile;
enum c_lang lang; enum c_lang lang;
{ {
/* Defaults. */ const struct lang_flags *l = &lang_defaults[(int) lang];
CPP_OPTION (pfile, lang) = lang;
CPP_OPTION (pfile, objc) = 0;
CPP_OPTION (pfile, cplusplus) = 0;
CPP_OPTION (pfile, extended_numbers) = 1; /* Allowed in GNU C and C99. */
switch (lang)
{
/* GNU C. */
case CLK_GNUC99:
CPP_OPTION (pfile, trigraphs) = 0;
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c99) = 1;
break;
case CLK_GNUC89:
CPP_OPTION (pfile, trigraphs) = 0;
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c99) = 0;
break;
/* ISO C. */
case CLK_STDC94:
case CLK_STDC89:
CPP_OPTION (pfile, trigraphs) = 1;
CPP_OPTION (pfile, dollars_in_ident) = 0;
CPP_OPTION (pfile, cplusplus_comments) = 0;
CPP_OPTION (pfile, digraphs) = lang == CLK_STDC94;
CPP_OPTION (pfile, c99) = 0;
CPP_OPTION (pfile, extended_numbers) = 0;
break;
case CLK_STDC99:
CPP_OPTION (pfile, trigraphs) = 1;
CPP_OPTION (pfile, dollars_in_ident) = 0;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c99) = 1;
break;
/* Objective C. */
case CLK_OBJCXX:
CPP_OPTION (pfile, cplusplus) = 1;
case CLK_OBJC:
CPP_OPTION (pfile, trigraphs) = 0;
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c99) = 0;
CPP_OPTION (pfile, objc) = 1;
break;
/* C++. */ CPP_OPTION (pfile, lang) = lang;
case CLK_GNUCXX:
case CLK_CXX98:
CPP_OPTION (pfile, cplusplus) = 1;
CPP_OPTION (pfile, trigraphs) = lang == CLK_CXX98;
CPP_OPTION (pfile, dollars_in_ident) = lang == CLK_GNUCXX;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c99) = 0;
break;
/* Assembler. */ CPP_OPTION (pfile, c99) = l->c99;
case CLK_ASM: CPP_OPTION (pfile, objc) = l->objc;
CPP_OPTION (pfile, trigraphs) = 0; CPP_OPTION (pfile, cplusplus) = l->cplusplus;
CPP_OPTION (pfile, dollars_in_ident) = 0; /* Maybe not? */ CPP_OPTION (pfile, extended_numbers) = l->extended_numbers;
CPP_OPTION (pfile, cplusplus_comments) = 1; CPP_OPTION (pfile, trigraphs) = l->trigraphs;
CPP_OPTION (pfile, digraphs) = 0; CPP_OPTION (pfile, dollars_in_ident) = l->dollars_in_ident;
CPP_OPTION (pfile, c99) = 0; CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments;
break; CPP_OPTION (pfile, digraphs) = l->digraphs;
}
} }
#ifdef HOST_EBCDIC #ifdef HOST_EBCDIC
......
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