cpp.texi: Update for -MQ.
* cpp.texi: Update for -MQ. * cppinit.c (cpp_create_reader): Always create pfile->deps. (cpp_cleanup): Always free pfile->deps. (initialize_dependency_output): Don't create pfile->deps. (cpp_handle_option): Similarly. (OPT_MQ): New. * gcc.c (cpp_options): Handle -MQ. (DEFAULT_WORD_SWITCH_TAKES_ARG): Add -MQ. * mkdeps.c (base_name): Remove. (deps_init): Don't allocate vector space until it's needed. (deps_free): Only free vectors if allocated. (deps_add_target, deps_add_dep): Update for initial allocation. (deps_add_default_target): Don't strip to the base_name. From-SVN: r38735
This commit is contained in:
parent
a64761a3ca
commit
f7114e1750
@ -1,3 +1,19 @@
|
|||||||
|
2001-01-05 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
|
* cpp.texi: Update for -MQ.
|
||||||
|
* cppinit.c (cpp_create_reader): Always create pfile->deps.
|
||||||
|
(cpp_cleanup): Always free pfile->deps.
|
||||||
|
(initialize_dependency_output): Don't create pfile->deps.
|
||||||
|
(cpp_handle_option): Similarly.
|
||||||
|
(OPT_MQ): New.
|
||||||
|
* gcc.c (cpp_options): Handle -MQ.
|
||||||
|
(DEFAULT_WORD_SWITCH_TAKES_ARG): Add -MQ.
|
||||||
|
* mkdeps.c (base_name): Remove.
|
||||||
|
(deps_init): Don't allocate vector space until it's needed.
|
||||||
|
(deps_free): Only free vectors if allocated.
|
||||||
|
(deps_add_target, deps_add_dep): Update for initial allocation.
|
||||||
|
(deps_add_default_target): Don't strip to the base_name.
|
||||||
|
|
||||||
2001-01-05 DJ Delorie <dj@redhat.com>
|
2001-01-05 DJ Delorie <dj@redhat.com>
|
||||||
|
|
||||||
* config/v850/v850.h (RETURN_ADDR_RTX): Define.
|
* config/v850/v850.h (RETURN_ADDR_RTX): Define.
|
||||||
|
26
gcc/cpp.texi
26
gcc/cpp.texi
@ -3491,24 +3491,36 @@ This is typical output:-
|
|||||||
/tmp/test.h:
|
/tmp/test.h:
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
|
@item -MQ @var{target}
|
||||||
@item -MT @var{target}
|
@item -MT @var{target}
|
||||||
@findex -MT
|
@findex -MT
|
||||||
By default CPP uses the base file name and appends the object suffix,
|
@findex -MQ
|
||||||
normally ``.o'', to it to obtain the name of the target for dependency
|
By default CPP uses the main file name, including any path, and appends
|
||||||
generation. With @samp{-MT} you can specify a target yourself,
|
the object suffix, normally ``.o'', to it to obtain the name of the
|
||||||
overriding the default one.
|
target for dependency generation. With @samp{-MT} you can specify a
|
||||||
|
target yourself, overriding the default one.
|
||||||
|
|
||||||
If you want multiple targets, you can specify them as a single argument
|
If you want multiple targets, you can specify them as a single argument
|
||||||
to @samp{-MT}, or use multiple @samp{-MT} options.
|
to @samp{-MT}, or use multiple @samp{-MT} options.
|
||||||
|
|
||||||
The targets you specify are output in the order they appear on the
|
The targets you specify are output in the order they appear on the
|
||||||
command line, and, unlike the default target, are not quoted for MAKE.
|
command line. @samp{-MQ} is identical to @samp{-MT}, except that the
|
||||||
This allows you to do things like, for example,
|
target name is quoted for Make, but with @samp{-MT} it isn't. For
|
||||||
|
example, -MT '$(objpfx)foo.o' gives
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
-MT '$(objpfx)foo.o $(objpfx)foo.os $(objpfx)foo.op'
|
$(objpfx)foo.o: /tmp/foo.c
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
|
but -MQ '$(objpfx)foo.o' gives
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
$$(objpfx)foo.o: /tmp/foo.c
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
The default target is automatically quoted, as if it were given with
|
||||||
|
@samp{-MQ}.
|
||||||
|
|
||||||
@item -H
|
@item -H
|
||||||
@findex -H
|
@findex -H
|
||||||
Print the name of each header file used, in addition to other normal
|
Print the name of each header file used, in addition to other normal
|
||||||
|
@ -499,6 +499,10 @@ cpp_create_reader (lang)
|
|||||||
/* After creating pfile->pending. */
|
/* After creating pfile->pending. */
|
||||||
set_lang (pfile, lang);
|
set_lang (pfile, lang);
|
||||||
|
|
||||||
|
/* It's simplest to just create this struct whether or not it will
|
||||||
|
be needed. */
|
||||||
|
pfile->deps = deps_init ();
|
||||||
|
|
||||||
/* Initialize lexer state. */
|
/* Initialize lexer state. */
|
||||||
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
|
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
|
||||||
|
|
||||||
@ -552,8 +556,7 @@ cpp_cleanup (pfile)
|
|||||||
if (pfile->macro_buffer)
|
if (pfile->macro_buffer)
|
||||||
free ((PTR) pfile->macro_buffer);
|
free ((PTR) pfile->macro_buffer);
|
||||||
|
|
||||||
if (pfile->deps)
|
deps_free (pfile->deps);
|
||||||
deps_free (pfile->deps);
|
|
||||||
|
|
||||||
_cpp_cleanup_includes (pfile);
|
_cpp_cleanup_includes (pfile);
|
||||||
_cpp_cleanup_stacks (pfile);
|
_cpp_cleanup_stacks (pfile);
|
||||||
@ -753,9 +756,6 @@ initialize_dependency_output (pfile)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! pfile->deps)
|
|
||||||
pfile->deps = deps_init ();
|
|
||||||
|
|
||||||
/* Find the space before the DEPS_TARGET, if there is one. */
|
/* Find the space before the DEPS_TARGET, if there is one. */
|
||||||
s = strchr (spec, ' ');
|
s = strchr (spec, ' ');
|
||||||
if (s)
|
if (s)
|
||||||
@ -1083,6 +1083,7 @@ new_pending_directive (pend, text, handler)
|
|||||||
DEF_OPT("MM", 0, OPT_MM) \
|
DEF_OPT("MM", 0, OPT_MM) \
|
||||||
DEF_OPT("MMD", no_fil, OPT_MMD) \
|
DEF_OPT("MMD", no_fil, OPT_MMD) \
|
||||||
DEF_OPT("MP", 0, OPT_MP) \
|
DEF_OPT("MP", 0, OPT_MP) \
|
||||||
|
DEF_OPT("MQ", no_tgt, OPT_MQ) \
|
||||||
DEF_OPT("MT", no_tgt, OPT_MT) \
|
DEF_OPT("MT", no_tgt, OPT_MT) \
|
||||||
DEF_OPT("P", 0, OPT_P) \
|
DEF_OPT("P", 0, OPT_P) \
|
||||||
DEF_OPT("U", no_mac, OPT_U) \
|
DEF_OPT("U", no_mac, OPT_U) \
|
||||||
@ -1494,9 +1495,6 @@ cpp_handle_option (pfile, argc, argv)
|
|||||||
case OPT_MD:
|
case OPT_MD:
|
||||||
case OPT_MM:
|
case OPT_MM:
|
||||||
case OPT_MMD:
|
case OPT_MMD:
|
||||||
if (! pfile->deps)
|
|
||||||
pfile->deps = deps_init ();
|
|
||||||
|
|
||||||
if (opt_code == OPT_M || opt_code == OPT_MD)
|
if (opt_code == OPT_M || opt_code == OPT_MD)
|
||||||
CPP_OPTION (pfile, print_deps) = 2;
|
CPP_OPTION (pfile, print_deps) = 2;
|
||||||
else
|
else
|
||||||
@ -1515,11 +1513,10 @@ cpp_handle_option (pfile, argc, argv)
|
|||||||
CPP_OPTION (pfile, deps_phony_targets) = 1;
|
CPP_OPTION (pfile, deps_phony_targets) = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPT_MQ:
|
||||||
case OPT_MT:
|
case OPT_MT:
|
||||||
/* Add a target. */
|
/* Add a target. -MQ quotes for Make. */
|
||||||
if (! pfile->deps)
|
deps_add_target (pfile->deps, arg, opt_code == OPT_MQ);
|
||||||
pfile->deps = deps_init ();
|
|
||||||
deps_add_target (pfile->deps, arg, 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_A:
|
case OPT_A:
|
||||||
|
@ -584,7 +584,7 @@ static const char *cpp_options =
|
|||||||
"%{C:%{!E:%eGNU C does not support -C without using -E}}\
|
"%{C:%{!E:%eGNU C does not support -C without using -E}}\
|
||||||
%{std*} %{nostdinc*}\
|
%{std*} %{nostdinc*}\
|
||||||
%{C} %{v} %{I*} %{P} %{$} %I\
|
%{C} %{v} %{I*} %{P} %{$} %I\
|
||||||
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{MP} %{MT}\
|
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{MP} %{MQ} %{MT}\
|
||||||
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
|
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
|
||||||
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
|
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
|
||||||
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
|
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
|
||||||
@ -663,7 +663,7 @@ static struct user_specs *user_specs_head, *user_specs_tail;
|
|||||||
|| !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
|
|| !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
|
||||||
|| !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
|
|| !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
|
||||||
|| !strcmp (STR, "isystem") || !strcmp (STR, "specs") \
|
|| !strcmp (STR, "isystem") || !strcmp (STR, "specs") \
|
||||||
|| !strcmp (STR, "MF") || !strcmp (STR, "MT"))
|
|| !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ"))
|
||||||
|
|
||||||
#ifndef WORD_SWITCH_TAKES_ARG
|
#ifndef WORD_SWITCH_TAKES_ARG
|
||||||
#define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
|
#define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
|
||||||
|
61
gcc/mkdeps.c
61
gcc/mkdeps.c
@ -38,7 +38,6 @@ struct deps
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const char *munge PARAMS ((const char *));
|
static const char *munge PARAMS ((const char *));
|
||||||
static const char *base_name PARAMS ((const char *));
|
|
||||||
|
|
||||||
/* Given a filename, quote characters in that filename which are
|
/* Given a filename, quote characters in that filename which are
|
||||||
significant to Make. Note that it's not possible to quote all such
|
significant to Make. Note that it's not possible to quote all such
|
||||||
@ -107,33 +106,6 @@ munge (filename)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a pathname, calculate the non-directory part. This always
|
|
||||||
knows how to handle Unix-style pathnames, and understands VMS and
|
|
||||||
DOS paths on those systems. */
|
|
||||||
|
|
||||||
/* Find the base name of a (partial) pathname FNAME.
|
|
||||||
Returns a pointer into the string passed in.
|
|
||||||
Accepts Unix (/-separated) paths on all systems,
|
|
||||||
DOS and VMS paths on those systems. */
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
base_name (fname)
|
|
||||||
const char *fname;
|
|
||||||
{
|
|
||||||
const char *s = fname;
|
|
||||||
const char *p;
|
|
||||||
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
|
||||||
if (ISALPHA (s[0]) && s[1] == ':') s += 2;
|
|
||||||
if ((p = strrchr (s, '\\'))) s = p + 1;
|
|
||||||
#elif defined VMS
|
|
||||||
if ((p = strrchr (s, ':'))) s = p + 1; /* Skip device. */
|
|
||||||
if ((p = strrchr (s, ']'))) s = p + 1; /* Skip directory. */
|
|
||||||
if ((p = strrchr (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */
|
|
||||||
#endif
|
|
||||||
if ((p = strrchr (s, '/'))) s = p + 1;
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Public routines. */
|
/* Public routines. */
|
||||||
|
|
||||||
struct deps *
|
struct deps *
|
||||||
@ -141,15 +113,15 @@ deps_init ()
|
|||||||
{
|
{
|
||||||
struct deps *d = (struct deps *) xmalloc (sizeof (struct deps));
|
struct deps *d = (struct deps *) xmalloc (sizeof (struct deps));
|
||||||
|
|
||||||
/* Allocate space for the vectors now. */
|
/* Allocate space for the vectors only if we need it. */
|
||||||
|
|
||||||
d->targetv = (const char **) xmalloc (2 * sizeof (const char *));
|
d->targetv = 0;
|
||||||
d->depv = (const char **) xmalloc (8 * sizeof (const char *));
|
d->depv = 0;
|
||||||
|
|
||||||
d->ntargets = 0;
|
d->ntargets = 0;
|
||||||
d->targets_size = 2;
|
d->targets_size = 0;
|
||||||
d->ndeps = 0;
|
d->ndeps = 0;
|
||||||
d->deps_size = 8;
|
d->deps_size = 0;
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@ -160,14 +132,20 @@ deps_free (d)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < d->ntargets; i++)
|
if (d->targetv)
|
||||||
free ((PTR) d->targetv[i]);
|
{
|
||||||
|
for (i = 0; i < d->ntargets; i++)
|
||||||
|
free ((PTR) d->targetv[i]);
|
||||||
|
free (d->targetv);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < d->ndeps; i++)
|
if (d->depv)
|
||||||
free ((PTR) d->depv[i]);
|
{
|
||||||
|
for (i = 0; i < d->ndeps; i++)
|
||||||
|
free ((PTR) d->depv[i]);
|
||||||
|
free (d->depv);
|
||||||
|
}
|
||||||
|
|
||||||
free (d->targetv);
|
|
||||||
free (d->depv);
|
|
||||||
free (d);
|
free (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +159,7 @@ deps_add_target (d, t, quote)
|
|||||||
{
|
{
|
||||||
if (d->ntargets == d->targets_size)
|
if (d->ntargets == d->targets_size)
|
||||||
{
|
{
|
||||||
d->targets_size *= 2;
|
d->targets_size = d->targets_size * 2 + 4;
|
||||||
d->targetv = (const char **) xrealloc (d->targetv,
|
d->targetv = (const char **) xrealloc (d->targetv,
|
||||||
d->targets_size * sizeof (const char *));
|
d->targets_size * sizeof (const char *));
|
||||||
}
|
}
|
||||||
@ -212,7 +190,6 @@ deps_add_default_target (d, tgt)
|
|||||||
deps_add_target (d, "-", 1);
|
deps_add_target (d, "-", 1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tgt = base_name (tgt);
|
|
||||||
o = (char *) alloca (strlen (tgt) + 8);
|
o = (char *) alloca (strlen (tgt) + 8);
|
||||||
|
|
||||||
strcpy (o, tgt);
|
strcpy (o, tgt);
|
||||||
@ -239,7 +216,7 @@ deps_add_dep (d, t)
|
|||||||
|
|
||||||
if (d->ndeps == d->deps_size)
|
if (d->ndeps == d->deps_size)
|
||||||
{
|
{
|
||||||
d->deps_size *= 2;
|
d->deps_size *= 2 + 8;
|
||||||
d->depv = (const char **)
|
d->depv = (const char **)
|
||||||
xrealloc (d->depv, d->deps_size * sizeof (const char *));
|
xrealloc (d->depv, d->deps_size * sizeof (const char *));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user