|
GCC Middle and Back End API Reference
|
#include "config.h"#include "system.h"#include "coretypes.h"#include "prefix.h"#include "common/common-target.h"
Functions | |
| 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) |
| char * | update_path (const char *path, const char *key) |
| void | set_std_prefix (const char *prefix, int len) |
Variables | |
| static const char * | std_prefix = PREFIX |
|
static |
Given KEY, as above, return its value.
References free(), NULL, and std_prefix.
Referenced by translate_name().
|
static |
Return a copy of a string that has been placed in the heap.
Referenced by set_std_prefix().
| void set_std_prefix | ( | const char * | prefix, |
| int | len ) |
Reset the standard prefix.
References save_string(), and std_prefix.
Referenced by process_command().
|
static |
In a NUL-terminated STRING, replace character C1 with C2 in-place.
Referenced by expand_complex_div_wide(), and update_path().
|
static |
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.
References alloca, free(), get_key_value(), NULL, and std_prefix.
Referenced by update_path().
| char * update_path | ( | const char * | path, |
| const char * | key ) |
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.
Provide prototypes for functions exported from prefix.cc. Copyright (C) 1999-2026 Free Software Foundation, Inc. This file is part of GCC. 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 3 of the License, or (at your option) any later version. 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 COPYING3. If not see <http://www.gnu.org/licenses/>.
These functions are called by the Ada frontend with C convention.
Update PATH using KEY if PATH starts with PREFIX. The returned string is always malloc-ed, and the caller is responsible for freeing it.
References DIR_SEPARATOR, free(), NULL, path, std_prefix, tr(), translate_name(), and X_OK.
Referenced by add_prefix(), and add_standard_paths().
|
static |
Utility to update paths from internal to external forms. Copyright (C) 1997-2026 Free Software Foundation, Inc. This file is part of GCC. 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 3 of the License, or (at your option) any later version. 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 COPYING3. If not see <http://www.gnu.org/licenses/>.
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
an entry of "key" in
HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\<KEY>
if found, that value will be used. <KEY> defaults to GCC version
string, but can be overridden at configuration time.
-- 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,
if they are different.
NOTE: using resolve_keyed_path under Win32 requires linking with
advapi32.dll.
Referenced by get_key_value(), set_std_prefix(), translate_name(), and update_path().