Commit 507df939 by Zack Weinberg Committed by Zack Weinberg

cppinit.c (install_predefs): Delete function.

1999-04-06 12:51 -0400  Zack Weinberg  <zack@rabi.columbia.edu>
	* cppinit.c (install_predefs): Delete function.
	(cpp_start_read): Don't call install_predefs.
	(cpp_handle_option): Remove case 'u' and all refs to
	opts->inhibit_predefs.
	(print_help): Don't mention -undef.
	(initialize_builtins): Define __HAVE_BUILTIN_SETJMP__, to
	match cccp.
	* cpplib.h (struct cpp_options): Remove inhibit_predefs
	member.
	* cccp.c (predefs): Delete variable.
	(main): Remove case 'u' in argument parse loop,
	'inhibit_predefs' variable, and the code block that would
	process CPP_PREDEFINES.
	(initialize_builtins): Don't define __OBJC__, the driver will
	do that.
	* gcc.c (default_compilers): Remove -undef from all specs that
	invoke a C preprocessor.
	* ch/lang-specs.h: Likewise.
	* cp/lang-specs.h: Likewise.
	* f/lang-specs.h: Likewise.
	* objc/lang-specs.h: Likewise.

From-SVN: r26212
parent 0793b35e
1999-04-06 12:51 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* cppinit.c (install_predefs): Delete function.
(cpp_start_read): Don't call install_predefs.
(cpp_handle_option): Remove case 'u' and all refs to
opts->inhibit_predefs.
(print_help): Don't mention -undef.
(initialize_builtins): Define __HAVE_BUILTIN_SETJMP__, to
match cccp.
* cpplib.h (struct cpp_options): Remove inhibit_predefs
member.
* cccp.c (predefs): Delete variable.
(main): Remove case 'u' in argument parse loop,
'inhibit_predefs' variable, and the code block that would
process CPP_PREDEFINES.
(initialize_builtins): Don't define __OBJC__, the driver will
do that.
* gcc.c (default_compilers): Remove -undef from all specs that
invoke a C preprocessor.
* ch/lang-specs.h: Likewise.
* cp/lang-specs.h: Likewise.
* f/lang-specs.h: Likewise.
* objc/lang-specs.h: Likewise.
Mon Apr 5 11:55:31 1999 Donn Terry (donn@interix.com)
* Makefile.in (SUBDIR_FLAGS_TO_PASS): Fix misapplied patch.
......
......@@ -658,13 +658,6 @@ static HASHNODE *hashtab[HASHSIZE];
#define HASHSTEP(old, c) ((old << 2) + c)
#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
/* Symbols to predefine. */
#ifdef CPP_PREDEFINES
static char *predefs = CPP_PREDEFINES;
#else
static char *predefs = "";
#endif
/* We let tm.h override the types used here, to handle trivial differences
such as the choice of unsigned int or long unsigned int for size_t.
......@@ -1210,7 +1203,6 @@ main (argc, argv)
This is preparation for supporting more than one option for making
an assertion. */
char **pend_assertion_options;
int inhibit_predefs = 0;
int no_standard_includes = 0;
int no_standard_cplusplus_includes = 0;
int missing_newline = 0;
......@@ -1659,7 +1651,6 @@ main (argc, argv)
on the command line. That way we can get rid of any
that were passed automatically in from GCC. */
int j;
inhibit_predefs = 1;
for (j = 0; j < i; j++)
pend_defs[j] = pend_assertions[j] = 0;
} else {
......@@ -1727,12 +1718,6 @@ main (argc, argv)
remap = 1;
break;
case 'u':
/* Sun compiler passes undocumented switch "-undef".
Let's assume it means to inhibit the predefined symbols. */
inhibit_predefs = 1;
break;
case '\0': /* JF handle '-' as file name meaning stdin or stdout */
if (in_fname == NULL) {
in_fname = "";
......@@ -1783,135 +1768,6 @@ main (argc, argv)
and option processing. */
initialize_builtins (fp, &outbuf);
/* Do standard #defines and assertions
that identify system and machine type. */
if (!inhibit_predefs) {
char *p = (char *) alloca (strlen (predefs) + 1);
#ifdef VMS
struct dsc$descriptor_s lcl_name;
struct item_list {
unsigned short length; /* input length */
unsigned short code; /* item code */
unsigned long dptr; /* data ptr */
unsigned long lptr; /* output length ptr */
};
unsigned long syi_length;
char syi_data[16];
struct item_list items[] = {
{ 16, SYI$_VERSION, 0, 0 },
{ 0, 0, 0, 0 }
};
items[0].dptr = (unsigned long)syi_data;
items[0].lptr = (unsigned long)(&syi_length);
if (SYS$GETSYIW (0, 0, 0, items, NULL, NULL, NULL, NULL) == SS$_NORMAL)
{
unsigned long vms_version_value;
char *vers;
vers = syi_data;
vms_version_value = 0;
if (*vers == 'V')
vers++;
if (ISDIGIT (*vers))
{
vms_version_value = (*vers - '0') * 10000000;
}
vers++;
if (*vers == '.')
{
vers++;
if (ISDIGIT (*vers))
{
vms_version_value += (*vers - '0') * 100000;
}
}
if (vms_version_value > 0)
{
char versbuf[32];
sprintf (versbuf, "__VMS_VER=%08ld", vms_version_value);
if (debug_output)
output_line_directive (fp, &outbuf, 0, same_file);
make_definition (versbuf);
}
}
#endif
strcpy (p, predefs);
while (*p) {
char *q;
while (*p == ' ' || *p == '\t')
p++;
/* Handle -D options. */
if (p[0] == '-' && p[1] == 'D') {
q = &p[2];
while (*p && *p != ' ' && *p != '\t')
p++;
if (*p != 0)
*p++= 0;
if (debug_output)
output_line_directive (fp, &outbuf, 0, same_file);
make_definition (q);
while (*p == ' ' || *p == '\t')
p++;
} else if (p[0] == '-' && p[1] == 'A') {
/* Handle -A options (assertions). */
char *assertion;
char *past_name;
char *value;
char *past_value;
char *termination;
int save_char;
assertion = &p[2];
past_name = assertion;
/* Locate end of name. */
while (*past_name && *past_name != ' '
&& *past_name != '\t' && *past_name != '(')
past_name++;
/* Locate `(' at start of value. */
value = past_name;
while (*value && (*value == ' ' || *value == '\t'))
value++;
if (*value++ != '(')
abort ();
while (*value && (*value == ' ' || *value == '\t'))
value++;
past_value = value;
/* Locate end of value. */
while (*past_value && *past_value != ' '
&& *past_value != '\t' && *past_value != ')')
past_value++;
termination = past_value;
while (*termination && (*termination == ' ' || *termination == '\t'))
termination++;
if (*termination++ != ')')
abort ();
if (*termination && *termination != ' ' && *termination != '\t')
abort ();
/* Temporarily null-terminate the value. */
save_char = *termination;
*termination = '\0';
/* Install the assertion. */
make_assertion ("-A", assertion);
*termination = (char) save_char;
p = termination;
while (*p == ' ' || *p == '\t')
p++;
} else {
abort ();
}
}
}
/* Now handle the command line options. */
/* Do -U's, -D's and -A's in the order they were seen. */
......@@ -10217,8 +10073,6 @@ initialize_builtins (inp, outp)
install ((U_CHAR *) "__STDC__", -1, T_CONST, "1", -1);
install ((U_CHAR *) "__STDC_VERSION__", -1, T_CONST, "199409L", -1);
}
if (objc)
install ((U_CHAR *) "__OBJC__", -1, T_CONST, "1", -1);
/* This is supplied using a -D by the compiler driver
so that it is present only when truly compiling with GNU C. */
/* install ((U_CHAR *) "__GNUC__", -1, T_CONST, "2", -1); */
......
......@@ -26,7 +26,7 @@ Boston, MA 02111-1307, USA. */
{"@chill",
{"cpp -lang-chill %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU CHILL does not support -C without using -E}}\
-undef -D__GNUCHILL__=%v1 -D__GNUC_MINOR__=%v2\
-D__GNUCHILL__=%v1 -D__GNUC_MINOR__=%v2\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional} %{!undef:%{!ansi:%p} %P} %{trigraphs}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
......
......@@ -33,7 +33,7 @@ Boston, MA 02111-1307, USA. */
"%{E|M|MM:cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C++ does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
-D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
%{!fno-exceptions:-D__EXCEPTIONS}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
......@@ -43,7 +43,7 @@ Boston, MA 02111-1307, USA. */
%{!E:%{!M:%{!MM:cc1plus %i %1 %2\
-lang-c++ %{nostdinc*} %{C} %{A*} %{I*} %{P} %I\
%{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus\
-D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus\
-D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
%{!fno-exceptions:-D__EXCEPTIONS}\
......@@ -64,7 +64,7 @@ Boston, MA 02111-1307, USA. */
{"cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C++ does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
-D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
%{!fno-exceptions:-D__EXCEPTIONS}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
......
......@@ -204,10 +204,6 @@ static void append_include_chain PARAMS ((cpp_reader *,
struct cpp_pending *,
char *, int));
#ifdef CPP_PREDEFINES
static void install_predefs PARAMS ((cpp_reader *));
#endif
/* Last argument to append_include_chain: chain to use */
enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
......@@ -627,6 +623,7 @@ initialize_builtins (pfile)
cpp_install (pfile, NAME("__WCHAR_TYPE__"), T_CONST, WCHAR_TYPE, -1);
cpp_install (pfile, NAME("__USER_LABEL_PREFIX__"), T_CONST, user_label_prefix, -1);
cpp_install (pfile, NAME("__REGISTER_PREFIX__"), T_CONST, REGISTER_PREFIX, -1);
cpp_install (pfile, NAME("__HAVE_BUILTIN_SETJMP__"), T_CONST, "1", -1);
if (!CPP_TRADITIONAL (pfile))
{
cpp_install (pfile, NAME("__STDC__"), T_STDC, 0, -1);
......@@ -657,44 +654,6 @@ initialize_builtins (pfile)
}
}
/* Subroutine of cpp_start_read. Installs the predefined macros
and assertions found in CPP_PREDEFINES.
CPP_PREDEFINES is a string of -D and -A options separated by
whitespace, like this:
"-D__unix__ -D__sparc__ -Asystem(unix) -Amachine(sparc)" */
#ifdef CPP_PREDEFINES
static void
install_predefs (pfile)
cpp_reader *pfile;
{
char *p = (char *) alloca (strlen (CPP_PREDEFINES) + 1);
char *q;
strcpy (p, CPP_PREDEFINES);
while (*p)
{
while (*p == ' ' || *p == '\t') p++;
if (*p != '-')
abort();
p = q = p + 2;
while (*p && *p != ' ' && *p != '\t') p++;
if (*p != 0)
*p++= 0;
if (CPP_OPTIONS (pfile)->debug_output)
output_line_command (pfile, 0, same_file);
if (q[-1] == 'D')
cpp_define (pfile, q);
else if (q[-1] == 'A')
cpp_assert (pfile, q);
else
abort ();
}
}
#endif
/* Another subroutine of cpp_start_read. This one sets up to do
dependency-file output. */
static void
......@@ -850,13 +809,6 @@ cpp_start_read (pfile, fname)
and option processing. */
initialize_builtins (pfile);
#ifdef CPP_PREDEFINES
/* Do standard #defines and assertions
that identify system and machine type. */
if (!opts->inhibit_predefs)
install_predefs (pfile);
#endif
/* Do -U's, -D's and -A's in the order they were seen. */
p = opts->pending->define_head;
while (p)
......@@ -1621,8 +1573,6 @@ cpp_handle_option (pfile, argc, argv)
opts->pending->assert_tail = NULL;
opts->pending->define_head = NULL;
opts->pending->define_tail = NULL;
opts->inhibit_predefs = 1;
}
}
break;
......@@ -1682,11 +1632,6 @@ cpp_handle_option (pfile, argc, argv)
opts->remap = 1;
break;
case 'u':
if (!strcmp (argv[i], "-undef"))
opts->inhibit_predefs = 1;
break;
case '\0': /* JF handle '-' as file name meaning stdin or stdout */
if (opts->in_fname == NULL)
opts->in_fname = "";
......@@ -1789,7 +1734,6 @@ Switches:\n\
-D<macro>=<val> Define a <macro> with <val> as its value\n\
-A<question> (<answer>) Assert the <answer> to <question>\n\
-U<macro> Undefine <macro> \n\
-u or -undef Do not predefine any macros\n\
-v Display the version number\n\
-H Print the name of header files as they are used\n\
-C Do not discard comments\n\
......
......@@ -453,7 +453,6 @@ struct cpp_options {
char *include_prefix;
int include_prefix_len;
char inhibit_predefs;
char no_standard_includes;
char no_standard_cplusplus_includes;
......
......@@ -38,7 +38,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
{"cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
%{!undef:%P} -D_LANGUAGE_FORTRAN %{trigraphs} \
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} -traditional\
......@@ -88,7 +88,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
{"cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I \
%{C:%{!E:%eGNU C does not support -C without using -E}} \
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} \
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 \
-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 \
%{ansi:-trigraphs -$ -D__STRICT_ANSI__} \
%{!undef:%P} -D_LANGUAGE_FORTRAN %{trigraphs} \
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} -traditional \
......
......@@ -592,7 +592,7 @@ static struct compiler default_compilers[] =
%{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi|std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
......@@ -606,7 +606,7 @@ static struct compiler default_compilers[] =
%{std*} %{nostdinc*} %{A*} %{I*} %I\
%{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\
%{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi|std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
......@@ -629,7 +629,7 @@ static struct compiler default_compilers[] =
%{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi|std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
......@@ -657,7 +657,7 @@ static struct compiler default_compilers[] =
%{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi|std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
......@@ -674,7 +674,7 @@ static struct compiler default_compilers[] =
cpp %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\
%{!undef:%{!std=*:%p}%{std=gnu*:%p} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
......@@ -705,7 +705,7 @@ static struct compiler default_compilers[] =
{"cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{trigraphs}\
-undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
-$ %{!undef:%p %P} -D__ASSEMBLER__ \
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
%{ffast-math:-D__FAST_MATH__}\
%{traditional} %{ftraditional:-traditional}\
......
......@@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */
{"%{E|M|MM:cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
......@@ -40,7 +40,7 @@ Boston, MA 02111-1307, USA. */
"%{!M:%{!MM:%{!E:cc1obj %i %1 \
%{nostdinc*} %{A*} %{I*} %{P} %I\
%{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
%{ffast-math:-D__FAST_MATH__}\
......@@ -58,7 +58,7 @@ Boston, MA 02111-1307, USA. */
{"cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
-D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
......
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