Commit e1e97c4f by Neil Booth Committed by Neil Booth

cppinit.c (handle_option): Implement #unassert directive as -A- command line option.

2000-03-16  Neil Booth  <NeilB@earthling.net>

	* cppinit.c (handle_option):  Implement #unassert directive
        as -A- command line option.
	(print_help):  Update.
	* cpptexi.c:  Update.

From-SVN: r32584
parent d26eedb6
2000-03-16 Neil Booth <NeilB@earthling.net>
* cppinit.c (handle_option): Implement #unassert directive
as -A- command line option.
(print_help): Update.
* cpptexi.c: Update.
Thu Mar 16 02:14:16 2000 Hans-Peter Nilsson <hp@bitrange.com> Thu Mar 16 02:14:16 2000 Hans-Peter Nilsson <hp@bitrange.com>
* md.texi (Standard Names): Document `jump'. * md.texi (Standard Names): Document `jump'.
......
...@@ -2887,10 +2887,12 @@ Define the macros @var{__GNUC__}, @var{__GNUC_MINOR__} and ...@@ -2887,10 +2887,12 @@ Define the macros @var{__GNUC__}, @var{__GNUC_MINOR__} and
Make an assertion with the predicate @var{predicate} and answer Make an assertion with the predicate @var{predicate} and answer
@var{answer}. @xref{Assertions}. @var{answer}. @xref{Assertions}.
@noindent @item -A -@var{predicate}(@var{answer})
You can use @samp{-A-} to disable all predefined assertions; it also Disable an assertion with the predicate @var{predicate} and answer
undefines all predefined macros and all macros that preceded it on the @var{answer}. Specifiying no predicate, by @samp{-A-} or @samp{-A -},
command line. disables all predefined assertions and all assertions preceding it on
the command line; and also undefines all predefined macros and all
macros preceding it on the command line.
@item -dM @item -dM
@findex -dM @findex -dM
......
...@@ -1493,26 +1493,35 @@ handle_option (pfile, argc, argv) ...@@ -1493,26 +1493,35 @@ handle_option (pfile, argc, argv)
opts->no_output = 1; opts->no_output = 1;
break; break;
case OPT_A: case OPT_A:
if (strcmp (arg, "-")) if (arg[0] == '-')
new_pending_directive (opts, arg, cpp_assert);
else
{ {
/* -A- eliminates all predefined macros and assertions. /* -A with an argument beginning with '-' acts as
Let's include also any that were specified earlier #unassert on whatever immediately follows the '-'.
on the command line. That way we can get rid of any If "-" is the whole argument, we eliminate all
that were passed automatically in from GCC. */ predefined macros and assertions, including those
struct pending_option *o1, *o2; that were specified earlier on the command line.
That way we can get rid of any that were passed
o1 = opts->pending->directive_head; automatically in from GCC. */
while (o1)
if (arg[1] == '\0')
{ {
o2 = o1->next; struct pending_option *o1, *o2;
free (o1);
o1 = o2; o1 = opts->pending->directive_head;
while (o1)
{
o2 = o1->next;
free (o1);
o1 = o2;
}
opts->pending->directive_head = NULL;
opts->pending->directive_tail = NULL;
} }
opts->pending->directive_head = NULL; else
opts->pending->directive_tail = NULL; new_pending_directive (opts, arg + 1, cpp_unassert);
} }
else
new_pending_directive (opts, arg, cpp_assert);
break; break;
case OPT_U: case OPT_U:
new_pending_directive (opts, arg, cpp_undef); new_pending_directive (opts, arg, cpp_undef);
...@@ -1750,6 +1759,7 @@ Switches:\n\ ...@@ -1750,6 +1759,7 @@ Switches:\n\
-D<macro> Define a <macro> with string '1' as its value\n\ -D<macro> Define a <macro> with string '1' as its value\n\
-D<macro>=<val> Define a <macro> with <val> as its value\n\ -D<macro>=<val> Define a <macro> with <val> as its value\n\
-A<question> (<answer>) Assert the <answer> to <question>\n\ -A<question> (<answer>) Assert the <answer> to <question>\n\
-A-<question> (<answer>) Disable the <answer> to <question>\n\
-U<macro> Undefine <macro> \n\ -U<macro> Undefine <macro> \n\
-v Display the version number\n\ -v Display the version number\n\
-H Print the name of header files as they are used\n\ -H Print the name of header files as they are used\n\
......
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