1997-10-19 18:29:32 +02:00
|
|
|
/* Utility to update paths from internal to external forms.
|
hooks.c, [...]: Update copyright.
* hooks.c, hooks.h, intl.c, opts.h, prefix.c, tree-gimple.c,
config/alpha/ev4.md, config/alpha/ev5.md, config/alpha/ev6.md,
config/alpha/freebsd.h, config/alpha/linux.h,
config/alpha/netbsd.h, config/alpha/osf5.h,
config/alpha/vms.h, config/arc/arc.c, config/arc/arc.h,
config/h8300/h8300-protos.h, config/h8300/h8300.c,
config/h8300/h8300.h, config/ia64/unwind-ia64.c,
doc/cppopts.texi: Update copyright.
From-SVN: r96686
2005-03-18 16:24:28 +01:00
|
|
|
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
2002-07-18 08:44:35 +02:00
|
|
|
Free Software Foundation, Inc.
|
1997-10-19 18:29:32 +02:00
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
This file is part of GCC.
|
1997-10-19 18:29:32 +02:00
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Library General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
your option) any later version.
|
1997-10-19 18:29:32 +02:00
|
|
|
|
|
|
|
GCC is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with GCC; see the file COPYING. If not, write to the Free
|
2005-06-25 04:02:01 +02:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
1997-10-19 18:29:32 +02:00
|
|
|
|
|
|
|
/* This file contains routines to update a path, both to canonicalize
|
|
|
|
the directory format and to handle any prefix translation.
|
|
|
|
|
|
|
|
This file must be compiled with -DPREFIX= to specify the "prefix"
|
|
|
|
value used by configure. If a filename does not begin with this
|
|
|
|
prefix, it will not be affected other than by directory canonicalization.
|
|
|
|
|
|
|
|
Each caller of 'update_path' may specify both a filename and
|
|
|
|
a translation prefix and consist of the name of the package that contains
|
|
|
|
the file ("@GCC", "@BINUTIL", "@GNU", etc).
|
|
|
|
|
|
|
|
If the prefix is not specified, the filename will only undergo
|
|
|
|
directory canonicalization.
|
|
|
|
|
|
|
|
If it is specified, the string given by PREFIX will be replaced
|
|
|
|
by the specified prefix (with a '@' in front unless the prefix begins
|
|
|
|
with a '$') and further translation will be done as follows
|
|
|
|
until none of the two conditions below are met:
|
|
|
|
|
|
|
|
1) If the filename begins with '@', the string between the '@' and
|
|
|
|
the end of the name or the first '/' or directory separator will
|
|
|
|
be considered a "key" and looked up as follows:
|
|
|
|
|
|
|
|
-- If this is a Win32 OS, then the Registry will be examined for
|
2002-05-20 20:06:55 +02:00
|
|
|
an entry of "key" in
|
1997-10-19 18:29:32 +02:00
|
|
|
|
1999-08-15 00:04:44 +02:00
|
|
|
HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\<KEY>
|
1997-10-19 18:29:32 +02:00
|
|
|
|
1999-08-15 00:04:44 +02:00
|
|
|
if found, that value will be used. <KEY> defaults to GCC version
|
|
|
|
string, but can be overridden at configuration time.
|
1997-10-19 18:29:32 +02:00
|
|
|
|
|
|
|
-- If not found (or not a Win32 OS), the environment variable
|
|
|
|
key_ROOT (the value of "key" concatenated with the constant "_ROOT")
|
|
|
|
is tried. If that fails, then PREFIX (see above) is used.
|
|
|
|
|
|
|
|
2) If the filename begins with a '$', the rest of the string up
|
|
|
|
to the end or the first '/' or directory separator will be used
|
|
|
|
as an environment variable, whose value will be returned.
|
|
|
|
|
|
|
|
Once all this is done, any '/' will be converted to DIR_SEPARATOR,
|
2002-05-20 20:06:55 +02:00
|
|
|
if they are different.
|
1997-10-19 18:29:32 +02:00
|
|
|
|
|
|
|
NOTE: using resolve_keyed_path under Win32 requires linking with
|
|
|
|
advapi32.dll. */
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
Major cutover to using system.h:
* Makefile.in (alias.o, bitmap.o, c-aux-info.o, c-common.o,
c-decl.o, c-iterate.o, c-lang.o, c-lex.o, c-pragma.o, c-typeck.o,
caller-save.o, calls.o, collect2.o, combine.o, cse.o, dbxout.o,
dwarf2out.o, dwarfout.o, emit-rtl.o, except.o, explow.o, expmed.o,
expr.o, final.o, flow.o, function.o, getpwd.o, global.o,
integrate.o, jump.o, local-alloc.o, loop.o, optabs.o, pexecute.o,
prefix.o, print-rtl.o, print-tree.o, profile.o, real.o, recog.o,
reg-stack.o, regclass.o, regmove.o, reload.o, reload1.o, reorg.o,
rtl.o, rtlanal.o, sdbout.o, stmt.o, stor-layout.o, stupid.o,
tlink.o, toplev.o, tree.o, unroll.o, varasm.o, xcoffout.o): Depend
on system.h.
* alias.c, bitmap.c, c-aux-info.c, c-common.c, c-decl.c,
c-iterate.c, c-lang.c, c-lex.c, c-pragma.c, c-typeck.c,
caller-save.c, calls.c, collect2.c, combine.c, cse.c, dbxout.c,
dwarf2out.c, dwarfout.c, emit-rtl.c, except.c, explow.c, expmed.c,
expr.c, final.c, flow.c, function.c, gcc.c, getpwd.c, global.c,
integrate.c, jump.c, local-alloc.c, loop.c, optabs.c, pexecute.c,
prefix.c, print-rtl.c, print-tree.c, profile.c, real.c, recog.c,
reg-stack.c, regclass.c, regmove.c, reload.c, reload1.c, reorg.c,
rtl.c, rtlanal.c, sched.c, sdbout.c, stmt.c, stor-layout.c,
stupid.c, tlink.c, toplev.c, tree.c, unroll.c, varasm.c,
xcoffout.c: Include system.h. Organize include ordering so
that stdarg/varargs comes before other system headers. Remove
spurious casts of functions assured of a prototype in system.h.
From-SVN: r18726
1998-03-20 15:58:42 +01:00
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tm.h"
|
1999-08-15 00:04:44 +02:00
|
|
|
#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
|
1997-10-19 18:29:32 +02:00
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
Makefile.in (gcc.o, [...]): Depend on prefix.h.
* Makefile.in (gcc.o, prefix.o, cccp.o, cpplib.o): Depend on prefix.h.
* cccp.c: Include prefix.h, don't prototype prefix.c functions.
(new_include_prefix): Constify char* parameters.
* cppfiles.c (read_name_map): Likewise.
(append_include_chain): Likewise. Also, use a writable char* copy
of parameter `dir' which we then modify, rather than using the
parameter itself to store the new writable string.
(remap_filename): Constify some variables. Also, use a writable
char* to store an allocated string which we will be modifying.
* cpplib.c: Include prefix.h, don't prototype prefix.c functions.
(cpp_start_read): Constify variable `str'.
* cpplib.h (append_include_chain): Constify a char* parameter.
* gcc.c Include prefix.h, don't prototype prefix.c functions.
(add_prefix, save_string): Constify char* parameters.
(fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes.
* prefix.c: Include prefix.h.
(get_key_value, translate_name, save_string, update_path,
set_std_prefix): Constify various char* parameters and variables.
(save_string): Use xmalloc, not malloc.
(translate_name): Use a writable temporary variable to create and
modify a string before setting it to a const char*.
* prefix.h: New file to prototype functions exported from prefix.c.
From-SVN: r24498
1999-01-05 20:11:22 +01:00
|
|
|
#include "prefix.h"
|
1997-10-19 18:29:32 +02:00
|
|
|
|
Makefile.in (gcc.o, [...]): Depend on prefix.h.
* Makefile.in (gcc.o, prefix.o, cccp.o, cpplib.o): Depend on prefix.h.
* cccp.c: Include prefix.h, don't prototype prefix.c functions.
(new_include_prefix): Constify char* parameters.
* cppfiles.c (read_name_map): Likewise.
(append_include_chain): Likewise. Also, use a writable char* copy
of parameter `dir' which we then modify, rather than using the
parameter itself to store the new writable string.
(remap_filename): Constify some variables. Also, use a writable
char* to store an allocated string which we will be modifying.
* cpplib.c: Include prefix.h, don't prototype prefix.c functions.
(cpp_start_read): Constify variable `str'.
* cpplib.h (append_include_chain): Constify a char* parameter.
* gcc.c Include prefix.h, don't prototype prefix.c functions.
(add_prefix, save_string): Constify char* parameters.
(fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes.
* prefix.c: Include prefix.h.
(get_key_value, translate_name, save_string, update_path,
set_std_prefix): Constify various char* parameters and variables.
(save_string): Use xmalloc, not malloc.
(translate_name): Use a writable temporary variable to create and
modify a string before setting it to a const char*.
* prefix.h: New file to prototype functions exported from prefix.c.
From-SVN: r24498
1999-01-05 20:11:22 +01:00
|
|
|
static const char *std_prefix = PREFIX;
|
1998-03-27 15:20:40 +01:00
|
|
|
|
2003-07-06 11:56:09 +02:00
|
|
|
static const char *get_key_value (char *);
|
|
|
|
static char *translate_name (char *);
|
|
|
|
static char *save_string (const char *, int);
|
|
|
|
static void tr (char *, int, int);
|
1997-10-19 18:29:32 +02:00
|
|
|
|
1999-08-15 00:04:44 +02:00
|
|
|
#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
|
2003-07-06 11:56:09 +02:00
|
|
|
static char *lookup_key (char *);
|
1997-10-19 18:29:32 +02:00
|
|
|
static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Given KEY, as above, return its value. */
|
|
|
|
|
Makefile.in (gcc.o, [...]): Depend on prefix.h.
* Makefile.in (gcc.o, prefix.o, cccp.o, cpplib.o): Depend on prefix.h.
* cccp.c: Include prefix.h, don't prototype prefix.c functions.
(new_include_prefix): Constify char* parameters.
* cppfiles.c (read_name_map): Likewise.
(append_include_chain): Likewise. Also, use a writable char* copy
of parameter `dir' which we then modify, rather than using the
parameter itself to store the new writable string.
(remap_filename): Constify some variables. Also, use a writable
char* to store an allocated string which we will be modifying.
* cpplib.c: Include prefix.h, don't prototype prefix.c functions.
(cpp_start_read): Constify variable `str'.
* cpplib.h (append_include_chain): Constify a char* parameter.
* gcc.c Include prefix.h, don't prototype prefix.c functions.
(add_prefix, save_string): Constify char* parameters.
(fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes.
* prefix.c: Include prefix.h.
(get_key_value, translate_name, save_string, update_path,
set_std_prefix): Constify various char* parameters and variables.
(save_string): Use xmalloc, not malloc.
(translate_name): Use a writable temporary variable to create and
modify a string before setting it to a const char*.
* prefix.h: New file to prototype functions exported from prefix.c.
From-SVN: r24498
1999-01-05 20:11:22 +01:00
|
|
|
static const char *
|
2003-07-06 11:56:09 +02:00
|
|
|
get_key_value (char *key)
|
1997-10-19 18:29:32 +02:00
|
|
|
{
|
Makefile.in (gcc.o, [...]): Depend on prefix.h.
* Makefile.in (gcc.o, prefix.o, cccp.o, cpplib.o): Depend on prefix.h.
* cccp.c: Include prefix.h, don't prototype prefix.c functions.
(new_include_prefix): Constify char* parameters.
* cppfiles.c (read_name_map): Likewise.
(append_include_chain): Likewise. Also, use a writable char* copy
of parameter `dir' which we then modify, rather than using the
parameter itself to store the new writable string.
(remap_filename): Constify some variables. Also, use a writable
char* to store an allocated string which we will be modifying.
* cpplib.c: Include prefix.h, don't prototype prefix.c functions.
(cpp_start_read): Constify variable `str'.
* cpplib.h (append_include_chain): Constify a char* parameter.
* gcc.c Include prefix.h, don't prototype prefix.c functions.
(add_prefix, save_string): Constify char* parameters.
(fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes.
* prefix.c: Include prefix.h.
(get_key_value, translate_name, save_string, update_path,
set_std_prefix): Constify various char* parameters and variables.
(save_string): Use xmalloc, not malloc.
(translate_name): Use a writable temporary variable to create and
modify a string before setting it to a const char*.
* prefix.h: New file to prototype functions exported from prefix.c.
From-SVN: r24498
1999-01-05 20:11:22 +01:00
|
|
|
const char *prefix = 0;
|
1998-03-27 15:20:40 +01:00
|
|
|
char *temp = 0;
|
1997-10-19 18:29:32 +02:00
|
|
|
|
1999-08-15 00:04:44 +02:00
|
|
|
#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
|
1997-10-19 18:29:32 +02:00
|
|
|
prefix = lookup_key (key);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (prefix == 0)
|
2001-04-29 14:43:20 +02:00
|
|
|
prefix = getenv (temp = concat (key, "_ROOT", NULL));
|
1997-10-19 18:29:32 +02:00
|
|
|
|
|
|
|
if (prefix == 0)
|
1998-03-27 15:20:40 +01:00
|
|
|
prefix = std_prefix;
|
|
|
|
|
|
|
|
if (temp)
|
|
|
|
free (temp);
|
1997-10-19 18:29:32 +02:00
|
|
|
|
|
|
|
return prefix;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return a copy of a string that has been placed in the heap. */
|
|
|
|
|
|
|
|
static char *
|
2003-07-06 11:56:09 +02:00
|
|
|
save_string (const char *s, int len)
|
1997-10-19 18:29:32 +02:00
|
|
|
{
|
2005-12-17 21:45:46 +01:00
|
|
|
char *result = XNEWVEC (char, len + 1);
|
1997-10-19 18:29:32 +02:00
|
|
|
|
alpha.c (check_float_value): Use memcpy, not bcopy.
* alpha.c (check_float_value): Use memcpy, not bcopy.
* arm.c (output_move_double): Likewise.
* arm.md: Likewise.
* m88k.c (legitimize_operand): Likewise.
* m88k.h (ORDER_REGS_FOR_LOCAL_ALLOC): Likewise.
* m88k.md: Likewise.
* mips.c (override_options): Likewise.
* mips.md: Likewise.
* romp.c (output_fpops): Likewise.
* rs6000.c (rs6000_override_options): Likewise.
* sh.md: Likewise.
* vax.c (check_float_value): Likewise.
* emit-rtl.c (copy_rtx_if_shared, init_emit_once): Likewise.
* expmed.c (synth_mult): Likewise.
* final.c (add_bb_string): Likewise.
* genattr.c (main): Likewise.
* genattrtab.c (attr_string, simplify_cond, copy_rtx_unchanging):
Likewise.
* jump.c (thread_jumps): Likewise.
* prefix.c (save_string): Likewise.
* real.h (REAL_VALUE_FROM_CONST_DOUBLE): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1): Likewise.
* reload1.c (reload, eliminate_regs): Likewise.
cp:
* decl.c (grokdeclarator, save_function_data): Use memcpy, not bcopy.
* lex.c (copy_lang_decl): Likewise.
java:
* decl.c (copy_lang_decl): Use memcpy, not bcopy.
* jcf-parse.c (jcf_figure_file_type): Likewise.
From-SVN: r37367
2000-11-10 17:01:28 +01:00
|
|
|
memcpy (result, s, len);
|
1997-10-19 18:29:32 +02:00
|
|
|
result[len] = 0;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
1999-08-15 00:04:44 +02:00
|
|
|
#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
|
1997-10-19 18:29:32 +02:00
|
|
|
|
gcc-version.m4: Delete.
config:
* gcc-version.m4: Delete.
fastjar:
* Makefile.am (fastjar_TEXINFOS): Add gcc-vers.texi.
(BASEVER, DEVPHASE): New variables.
(POD2MAN): Adjust setting of --release option.
(fastjar.1, grepjar.1, gcc-vers.texi): New rules.
* Makefile.in: Regenerate.
* configure.ac: Do not invoke TL_AC_GCC_VERSION.
* aclocal.m4, configure: Regenerate.
gcc:
* BASE-VER, DATESTAMP, DEV-PHASE: New files.
* Makefile.in (gcc_version, gcc_version_trigger, ): Delete.
(BASEVER, DEVPHASE, DATESTAMP, BASEVER_c, DEVPHASE_c, DATESTAMP_c)
(BASEVER_s, DEVPHASE_s, DATESTAMP_s): New variables.
(version): Define using $(BASEVER_c).
(Makefile, config.status, build/gcov-iov.o): No longer depends on
version.c.
(version.o): Depend on version files; add custom generation command.
(prefix.o): Define BASEVER on command line.
(s-iov): Depend on version files; adjust command.
(TEXI_CPP_FILES, TEX_IGCC_FILES, TEXI_GCCINT_FILES, TEXI_CPPINT_FILES):
Add gcc-vers.texi.
(gcc-vers.texi): New rule.
(doc/%.info, doc/%.dvi): Add -I . to command line.
(doc/gccinstall.dvi): Likewise.
(PACKAGE): Delete. All uses replaced with "gcc".
* aclocal.m4: Do not include gcc-version.m4.
* configure.ac: Do not invoke TL_AC_GCC_VERSION.
Do not AC_SUBST nor AC_DEFINE PACKAGE or VERSION.
Set is_release based on contents of DEV-PHASE.
Set gcc_version based on contents of BASE-VER.
Define WIN32_REGISTRY_KEY only if the user overrode the default.
* config.in, configure: Regenerate.
* gccbug.in: Determine version of GCC in use at runtime.
* gcov-iov.c: Get version number and development phase from
command line, not by including version.c.
* intl.c: Replace all uses of PACKAGE with "gcc".
* libada-mk.in: Delete unused "gcc_version" variable.
* prefix.c: Default WIN32_REGISTRY_KEY to BASEVER.
* version.c: (VERSUFFIX): New hook for redistributors; adjust
commentary to match.
(version_string): Put together from pieces.
* config/alpha/x-vms: Do not use $(gcc_version).
* config/i386/t-nwld: Likewise.
* doc/include/gcc-common.texi: Include gcc-vers.texi for
version-GCC and DEVELOPMENT.
gcc/ada:
* Make-lang.in (doc/gnat_ugn_unw.info, doc/gnat_rm.info)
(doc/gnat_ugn_unw.dvi, doc/gnat_rm.dvi): Add gcc-vers.texi
to dependencies.
gcc/fortran:
* Make-lang.in (GFORTRAN_TEXI): Add gcc-vers.texi.
gcc/java:
* Make-lang.in (TEXI_JAVA_FILES): Add gcc-vers.texi.
gcc/treelang:
* Make-lang.in (TEXI_TREELANG_FILES): Add gcc-vers.texi.
libstdc++-v3:
* include/Makefile.am (c++config.h): Depend on DATESTAMP from gcc
subdirectory. Generate #define of __GLIBCXX__ from contents of
that file.
* include/Makefile.in: Regenerate.
* include/bits/c++config: Do not define __GLIBCXX__.
maintainer-scripts:
* README: Update.
* gcc_release: Update gcc/DEV-PHASE if that file exists, instead
of gcc/version.c.
* update_version: Handle updating gcc/DATESTAMP.
* update_web_docs: Generate gcc-vers.texi first.
From-SVN: r96549
2005-03-16 07:04:10 +01:00
|
|
|
#ifndef WIN32_REGISTRY_KEY
|
|
|
|
# define WIN32_REGISTRY_KEY BASEVER
|
|
|
|
#endif
|
|
|
|
|
1997-10-19 18:29:32 +02:00
|
|
|
/* Look up "key" in the registry, as above. */
|
|
|
|
|
|
|
|
static char *
|
2003-07-06 11:56:09 +02:00
|
|
|
lookup_key (char *key)
|
1997-10-19 18:29:32 +02:00
|
|
|
{
|
|
|
|
char *dst;
|
|
|
|
DWORD size;
|
|
|
|
DWORD type;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
if (reg_key == (HKEY) INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
res = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE", 0,
|
|
|
|
KEY_READ, ®_key);
|
|
|
|
|
|
|
|
if (res == ERROR_SUCCESS)
|
|
|
|
res = RegOpenKeyExA (reg_key, "Free Software Foundation", 0,
|
|
|
|
KEY_READ, ®_key);
|
|
|
|
|
1999-08-15 00:04:44 +02:00
|
|
|
if (res == ERROR_SUCCESS)
|
|
|
|
res = RegOpenKeyExA (reg_key, WIN32_REGISTRY_KEY, 0,
|
|
|
|
KEY_READ, ®_key);
|
|
|
|
|
1997-10-19 18:29:32 +02:00
|
|
|
if (res != ERROR_SUCCESS)
|
2002-05-20 20:06:55 +02:00
|
|
|
{
|
|
|
|
reg_key = (HKEY) INVALID_HANDLE_VALUE;
|
|
|
|
return 0;
|
|
|
|
}
|
1997-10-19 18:29:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
size = 32;
|
2003-07-19 16:47:15 +02:00
|
|
|
dst = xmalloc (size);
|
1997-10-19 18:29:32 +02:00
|
|
|
|
2004-06-30 20:45:58 +02:00
|
|
|
res = RegQueryValueExA (reg_key, key, 0, &type, (LPBYTE) dst, &size);
|
1997-10-19 18:29:32 +02:00
|
|
|
if (res == ERROR_MORE_DATA && type == REG_SZ)
|
|
|
|
{
|
2003-07-19 16:47:15 +02:00
|
|
|
dst = xrealloc (dst, size);
|
2004-06-30 20:45:58 +02:00
|
|
|
res = RegQueryValueExA (reg_key, key, 0, &type, (LPBYTE) dst, &size);
|
1997-10-19 18:29:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (type != REG_SZ || res != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
free (dst);
|
|
|
|
dst = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
/* If NAME, a malloc-ed string, starts with a '@' or '$', apply the
|
|
|
|
translation rules above and return a newly malloc-ed name.
|
|
|
|
Otherwise, return the given name. */
|
1997-10-19 18:29:32 +02:00
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
static char *
|
2003-07-06 11:56:09 +02:00
|
|
|
translate_name (char *name)
|
1997-10-19 18:29:32 +02:00
|
|
|
{
|
2001-08-20 08:14:53 +02:00
|
|
|
char code;
|
|
|
|
char *key, *old_name;
|
|
|
|
const char *prefix;
|
1997-10-19 18:29:32 +02:00
|
|
|
int keylen;
|
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
code = name[0];
|
|
|
|
if (code != '@' && code != '$')
|
|
|
|
break;
|
|
|
|
|
|
|
|
for (keylen = 0;
|
|
|
|
(name[keylen + 1] != 0 && !IS_DIR_SEPARATOR (name[keylen + 1]));
|
|
|
|
keylen++)
|
|
|
|
;
|
|
|
|
|
2005-12-17 21:45:46 +01:00
|
|
|
key = (char *) alloca (keylen + 1);
|
2001-08-20 08:14:53 +02:00
|
|
|
strncpy (key, &name[1], keylen);
|
|
|
|
key[keylen] = 0;
|
|
|
|
|
|
|
|
if (code == '@')
|
|
|
|
{
|
|
|
|
prefix = get_key_value (key);
|
|
|
|
if (prefix == 0)
|
|
|
|
prefix = std_prefix;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
prefix = getenv (key);
|
1997-10-19 18:29:32 +02:00
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
if (prefix == 0)
|
|
|
|
prefix = PREFIX;
|
1997-10-19 18:29:32 +02:00
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
/* We used to strip trailing DIR_SEPARATORs here, but that can
|
|
|
|
sometimes yield a result with no separator when one was coded
|
|
|
|
and intended by the user, causing two path components to run
|
|
|
|
together. */
|
1997-10-19 18:29:32 +02:00
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
old_name = name;
|
|
|
|
name = concat (prefix, &name[keylen + 1], NULL);
|
|
|
|
free (old_name);
|
1997-10-19 18:29:32 +02:00
|
|
|
}
|
1998-04-04 15:32:39 +02:00
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
return name;
|
|
|
|
}
|
1997-10-19 18:29:32 +02:00
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
/* In a NUL-terminated STRING, replace character C1 with C2 in-place. */
|
|
|
|
static void
|
2003-07-06 11:56:09 +02:00
|
|
|
tr (char *string, int c1, int c2)
|
2001-08-20 08:14:53 +02:00
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (*string == c1)
|
|
|
|
*string = c2;
|
|
|
|
}
|
|
|
|
while (*string++);
|
1997-10-19 18:29:32 +02:00
|
|
|
}
|
|
|
|
|
2004-05-15 17:14:40 +02:00
|
|
|
/* Update PATH using KEY if PATH starts with PREFIX as a directory.
|
|
|
|
The returned string is always malloc-ed, and the caller is
|
|
|
|
responsible for freeing it. */
|
1997-10-19 18:29:32 +02:00
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
char *
|
2003-07-06 11:56:09 +02:00
|
|
|
update_path (const char *path, const char *key)
|
1997-10-19 18:29:32 +02:00
|
|
|
{
|
2002-07-18 08:44:35 +02:00
|
|
|
char *result, *p;
|
2004-05-15 17:14:40 +02:00
|
|
|
const int len = strlen (std_prefix);
|
2001-08-20 08:14:53 +02:00
|
|
|
|
2004-05-15 17:14:40 +02:00
|
|
|
if (! strncmp (path, std_prefix, len)
|
|
|
|
&& (IS_DIR_SEPARATOR(path[len])
|
|
|
|
|| path[len] == '\0')
|
|
|
|
&& key != 0)
|
1997-10-19 18:29:32 +02:00
|
|
|
{
|
2001-08-20 08:14:53 +02:00
|
|
|
bool free_key = false;
|
1997-10-19 18:29:32 +02:00
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
if (key[0] != '$')
|
|
|
|
{
|
|
|
|
key = concat ("@", key, NULL);
|
|
|
|
free_key = true;
|
|
|
|
}
|
|
|
|
|
2004-05-15 17:14:40 +02:00
|
|
|
result = concat (key, &path[len], NULL);
|
2001-08-20 08:14:53 +02:00
|
|
|
if (free_key)
|
|
|
|
free ((char *) key);
|
|
|
|
result = translate_name (result);
|
1997-10-19 18:29:32 +02:00
|
|
|
}
|
2001-08-20 08:14:53 +02:00
|
|
|
else
|
|
|
|
result = xstrdup (path);
|
1999-04-10 06:27:16 +02:00
|
|
|
|
2002-07-18 08:44:35 +02:00
|
|
|
#ifndef ALWAYS_STRIP_DOTDOT
|
|
|
|
#define ALWAYS_STRIP_DOTDOT 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
p = result;
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
char *src, *dest;
|
|
|
|
|
|
|
|
p = strchr (p, '.');
|
|
|
|
if (p == NULL)
|
|
|
|
break;
|
|
|
|
/* Look for `/../' */
|
2002-07-28 11:01:09 +02:00
|
|
|
if (p[1] == '.'
|
|
|
|
&& IS_DIR_SEPARATOR (p[2])
|
|
|
|
&& (p != result && IS_DIR_SEPARATOR (p[-1])))
|
2002-07-18 08:44:35 +02:00
|
|
|
{
|
|
|
|
*p = 0;
|
|
|
|
if (!ALWAYS_STRIP_DOTDOT && access (result, X_OK) == 0)
|
|
|
|
{
|
|
|
|
*p = '.';
|
2002-07-28 11:01:09 +02:00
|
|
|
break;
|
2002-07-18 08:44:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We can't access the dir, so we won't be able to
|
2002-07-28 11:01:09 +02:00
|
|
|
access dir/.. either. Strip out `dir/../'. If `dir'
|
|
|
|
turns out to be `.', strip one more path component. */
|
|
|
|
dest = p;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
--dest;
|
|
|
|
while (dest != result && IS_DIR_SEPARATOR (*dest))
|
|
|
|
--dest;
|
|
|
|
while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
|
|
|
|
--dest;
|
|
|
|
}
|
|
|
|
while (dest != result && *dest == '.');
|
|
|
|
/* If we have something like `./..' or `/..', don't
|
|
|
|
strip anything more. */
|
|
|
|
if (*dest == '.' || IS_DIR_SEPARATOR (*dest))
|
|
|
|
{
|
|
|
|
*p = '.';
|
|
|
|
break;
|
|
|
|
}
|
2002-07-18 08:44:35 +02:00
|
|
|
src = p + 3;
|
|
|
|
while (IS_DIR_SEPARATOR (*src))
|
|
|
|
++src;
|
|
|
|
p = dest;
|
|
|
|
while ((*dest++ = *src++) != 0)
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
|
2000-08-04 18:19:19 +02:00
|
|
|
#ifdef UPDATE_PATH_HOST_CANONICALIZE
|
2001-08-20 08:14:53 +02:00
|
|
|
/* Perform host dependent canonicalization when needed. */
|
2002-07-18 08:44:35 +02:00
|
|
|
UPDATE_PATH_HOST_CANONICALIZE (result);
|
2000-08-04 18:19:19 +02:00
|
|
|
#endif
|
|
|
|
|
1999-04-10 06:27:16 +02:00
|
|
|
#ifdef DIR_SEPARATOR_2
|
2001-08-13 01:40:53 +02:00
|
|
|
/* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
|
2001-08-20 08:14:53 +02:00
|
|
|
if (DIR_SEPARATOR_2 != DIR_SEPARATOR)
|
|
|
|
tr (result, DIR_SEPARATOR_2, DIR_SEPARATOR);
|
1999-04-10 06:27:16 +02:00
|
|
|
#endif
|
2001-08-20 08:14:53 +02:00
|
|
|
|
1999-04-10 06:27:16 +02:00
|
|
|
#if defined (DIR_SEPARATOR) && !defined (DIR_SEPARATOR_2)
|
1997-10-19 18:29:32 +02:00
|
|
|
if (DIR_SEPARATOR != '/')
|
2001-08-20 08:14:53 +02:00
|
|
|
tr (result, '/', DIR_SEPARATOR);
|
1997-10-19 18:29:32 +02:00
|
|
|
#endif
|
|
|
|
|
2001-08-20 08:14:53 +02:00
|
|
|
return result;
|
1997-10-19 18:29:32 +02:00
|
|
|
}
|
1998-03-27 15:20:40 +01:00
|
|
|
|
2003-06-29 15:53:12 +02:00
|
|
|
/* Reset the standard prefix. */
|
1998-03-27 15:20:40 +01:00
|
|
|
void
|
2003-07-06 11:56:09 +02:00
|
|
|
set_std_prefix (const char *prefix, int len)
|
1998-03-27 15:20:40 +01:00
|
|
|
{
|
|
|
|
std_prefix = save_string (prefix, len);
|
|
|
|
}
|