diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2003-07-03 04:24:01 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2003-07-03 04:24:01 +0000 |
commit | 3dce14083fc35cc2b60906577cf797e0ae49f1b8 (patch) | |
tree | 37ea22037f920e97ce155abc8dd8f4290af8dba6 | |
parent | bacb96b24f038ebc8072abfcdb145ff6568a8554 (diff) | |
download | gcc-3dce14083fc35cc2b60906577cf797e0ae49f1b8.zip gcc-3dce14083fc35cc2b60906577cf797e0ae49f1b8.tar.gz gcc-3dce14083fc35cc2b60906577cf797e0ae49f1b8.tar.bz2 |
system.h: Include filenames.h.
* system.h: Include filenames.h.
(IS_DIR_SEPARATOR, IS_ABSOLUTE_PATHNAME): Don't define.
(DIR_SEPARATOR, DIR_SEPARATOR_2): If not already defined,
define based on HAVE_DOS_BASED_FILE_SYSTEM.
* config/i386/xm-cygwin.h, config/i386/xm-djgpp.h
* config/i386/xm-mingw32.h: Don't define
HAVE_DOS_BASED_FILE_SYSTEM,
DIR_SEPARATOR, or DIR_SEPARATOR_2.
* doc/hostconfig.texi: Update to match.
* cppfiles.c, gcc.c, gensupport.c, protoize.c,
config/i386/cygwin.h:
Use IS_ABSOLUTE_PATH throughout.
* gcc.c (DIR_UP): Delete, unused.
* protoize.c (IS_SAME_PATH): Define in terms of
FILENAME_CMP.
(is_abspath): Delete.
java:
* jcf-path.c: Don't default-define PATH_SEPARATOR nor
DIR_SEPARATOR.
Use FILENAME_CMP.
* jcf-write.c: Don't default-define DIR_SEPARATOR.
* jcf.h: Delete COMPARE_FILENAMES definition.
From-SVN: r68863
-rw-r--r-- | gcc/ChangeLog | 40 | ||||
-rw-r--r-- | gcc/config/i386/cygwin.h | 2 | ||||
-rw-r--r-- | gcc/config/i386/xm-cygwin.h | 13 | ||||
-rw-r--r-- | gcc/config/i386/xm-djgpp.h | 7 | ||||
-rw-r--r-- | gcc/config/i386/xm-mingw32.h | 8 | ||||
-rw-r--r-- | gcc/cppfiles.c | 6 | ||||
-rw-r--r-- | gcc/doc/hostconfig.texi | 49 | ||||
-rw-r--r-- | gcc/gcc.c | 22 | ||||
-rw-r--r-- | gcc/gensupport.c | 2 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/java/jcf-path.c | 15 | ||||
-rw-r--r-- | gcc/java/jcf-write.c | 4 | ||||
-rw-r--r-- | gcc/java/jcf.h | 9 | ||||
-rw-r--r-- | gcc/protoize.c | 27 | ||||
-rw-r--r-- | gcc/system.h | 30 |
15 files changed, 92 insertions, 150 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f88010..576d2eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2003-07-02 Zack Weinberg <zack@codesourcery.com> + + * system.h: Include filenames.h. + (IS_DIR_SEPARATOR, IS_ABSOLUTE_PATHNAME): Don't define. + (DIR_SEPARATOR, DIR_SEPARATOR_2): If not already defined, + define based on HAVE_DOS_BASED_FILE_SYSTEM. + * config/i386/xm-cygwin.h, config/i386/xm-djgpp.h + * config/i386/xm-mingw32.h: Don't define + HAVE_DOS_BASED_FILE_SYSTEM, + DIR_SEPARATOR, or DIR_SEPARATOR_2. + * doc/hostconfig.texi: Update to match. + + * cppfiles.c, gcc.c, gensupport.c, protoize.c, + config/i386/cygwin.h: + Use IS_ABSOLUTE_PATH throughout. + * gcc.c (DIR_UP): Delete, unused. + * protoize.c (IS_SAME_PATH): Define in terms of + FILENAME_CMP. + (is_abspath): Delete. + 2003-07-02 Kazu Hirata <kazu@cs.umass.edu> * config/i386/emmintrin.h: Fix comment typos. @@ -136,7 +156,7 @@ Wed Jul 2 08:12:36 CEST 2003 Jan Hubicka <jh@suse.cz> (DEFAULT_SIGNED_CHAR): Likewise. (ASM_OUTPUT_ASCII): Moved here from iris4.h. Fix IRIX spelling. - + * config/mips/iris3.h: Remove, unused. * config/mips/iris4.h: Likewise. @@ -148,7 +168,7 @@ Wed Jul 2 08:12:36 CEST 2003 Jan Hubicka <jh@suse.cz> * config/mips/iris5.h: Move explicit includes ... * config.gcc (mips-sgi-irix6*o32, mips-sgi-irix5*): ... here. - + * config/mips/iris6.h (MIPS_ISA_DEFAULT, MIPS_ABI_DEFAULT): Move ... * config.gcc (mips-sgi-irix6*, mips-sgi-irix5cross64): ... here to tm_defines. @@ -159,7 +179,7 @@ Wed Jul 2 08:12:36 CEST 2003 Jan Hubicka <jh@suse.cz> * config/mips/iris6.h: Fix IRIX spelling. (MULTILIB_DEFAULTS): Undef before redefinition. - + * config/mips/iris6.h: Move explicit includes ... * config.gcc (mips-sgi-irix6*, mips-sgi-irix5cross64): ... here. @@ -210,7 +230,7 @@ Wed Jul 2 02:12:51 CEST 2003 Jan Hubicka <jh@suse.cz> * dbxout.c (DBXOUT_DECR_NESTING): Emit pending bincls, if required. (binclstatus): New. - (struct dbx_file): New members - bincl_status, pending_bincl_name and + (struct dbx_file): New members - bincl_status, pending_bincl_name and prev. (pending_bincls): New. (dbxout_init): Initialize new dbx_file members. @@ -218,7 +238,7 @@ Wed Jul 2 02:12:51 CEST 2003 Jan Hubicka <jh@suse.cz> (emit_bincl_stab): New function. (emit_pending_bincls): Same. (emit_pending_bincls_if_required): Same. - (dbxout_end_source_file): Emit EINCL stab only if BINCL is already + (dbxout_end_source_file): Emit EINCL stab only if BINCL is already processed. (dbxout_begin_block): Emit pending BINCL stabs. (dbxout_end_block): Same. @@ -229,7 +249,7 @@ Wed Jul 2 02:12:51 CEST 2003 Jan Hubicka <jh@suse.cz> (dbxout_symbol): Same. (dbxout_symbol_location): Same. (dbxout_parms): Same. - + 2003-07-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * c-semantics.c (genrtl_case_label): Fix format specifier bug. @@ -472,7 +492,7 @@ Wed Jul 2 02:12:51 CEST 2003 Jan Hubicka <jh@suse.cz> displacements. 2003-06-30 Hartmut Penner <hpenner@de.ibm.com> - Ulrich Weigand <uweigand@de.ibm.com> + Ulrich Weigand <uweigand@de.ibm.com> * config/s390/2084.md: New file. * config/s390/s390.md: Include it. @@ -607,8 +627,8 @@ Mon Jun 30 15:36:29 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-06-30 Hartmut Penner <hpenner@de.ibm.com> - * config/rs6000/rs6000.c (rs6000_split_altivec_in_gprs): New function. - (altivec_in_gprs_p): New function. + * config/rs6000/rs6000.c (rs6000_split_altivec_in_gprs): New function. + (altivec_in_gprs_p): New function. * config/rs6000/rs6000-protos (rs6000_split_altivec_in_gprs): New prototype. @@ -730,7 +750,7 @@ Sun Jun 29 23:06:32 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-06-29 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> - * pa.c (update_total_code_bytes): New function. + * pa.c (update_total_code_bytes): New function. (last_address): Number of bytes output for a function and its associated thunks. (compute_frame_size): Use BITS_PER_UNIT. diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 993423f..ea50574 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -213,7 +213,7 @@ do \ { \ char *cprefix = concat (tooldir_base_prefix, spec_machine, \ dir_separator_str, NULL); \ - if (!IS_ABSOLUTE_PATHNAME (cprefix)) \ + if (!IS_ABSOLUTE_PATH (cprefix)) \ cprefix = concat (standard_exec_prefix, spec_machine, dir_separator_str, \ spec_version, dir_separator_str, tooldir_prefix, NULL); \ add_prefix (&exec_prefixes,\ diff --git a/gcc/config/i386/xm-cygwin.h b/gcc/config/i386/xm-cygwin.h index 721c435..390e18e 100644 --- a/gcc/config/i386/xm-cygwin.h +++ b/gcc/config/i386/xm-cygwin.h @@ -20,16 +20,3 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define HOST_EXECUTABLE_SUFFIX ".exe" - -/* Even though Cygwin tries to hide the DOS based filesystem, it - still shows though at times. */ -#define HAVE_DOS_BASED_FILE_SYSTEM - -/* We support both "/" and "\" since everybody tests both but we - default to "/". This is important because if gcc produces Win32 - paths containing backslashes, make and configure may treat the - backslashes as escape characters. Many Win32 programs use forward - slashes so using a forward slash shouldn't be problematic from the - perspective of wanting gcc to produce native Win32 paths. */ -#undef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' diff --git a/gcc/config/i386/xm-djgpp.h b/gcc/config/i386/xm-djgpp.h index 71cb116..a0457b7 100644 --- a/gcc/config/i386/xm-djgpp.h +++ b/gcc/config/i386/xm-djgpp.h @@ -23,13 +23,6 @@ Boston, MA 02111-1307, USA. */ #define HOST_EXECUTABLE_SUFFIX ".exe" -/* Even though we support "/", allow "\" since everybody tests both. */ -#define DIR_SEPARATOR '/' -#define DIR_SEPARATOR_2 '\\' - -/* Allow test for DOS drive names. */ -#define HAVE_DOS_BASED_FILE_SYSTEM - /* System dependent initialization for collect2 to tell system() to act like Unix. */ #define COLLECT2_HOST_INITIALIZATION \ diff --git a/gcc/config/i386/xm-mingw32.h b/gcc/config/i386/xm-mingw32.h index 19b102d..9984bf9 100644 --- a/gcc/config/i386/xm-mingw32.h +++ b/gcc/config/i386/xm-mingw32.h @@ -19,14 +19,6 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Even though we support "/", allow "\" since everybody tests both. */ -#define DIR_SEPARATOR '\\' -#define DIR_SEPARATOR_2 '/' - -/* Mingw32 does not try to hide the underlying DOS-based file system - like Cygwin does. */ -#define HAVE_DOS_BASED_FILE_SYSTEM - #define HOST_EXECUTABLE_SUFFIX ".exe" #undef PATH_SEPARATOR diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index ceb6413..019b005 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -547,7 +547,7 @@ cpp_included (cpp_reader *pfile, const char *fname) char *name, *n; splay_tree_node nd; - if (IS_ABSOLUTE_PATHNAME (fname)) + if (IS_ABSOLUTE_PATH (fname)) { /* Just look it up. */ nd = splay_tree_lookup (pfile->all_include_files, (splay_tree_key) fname); @@ -592,7 +592,7 @@ find_include_file (cpp_reader *pfile, const char *fname, int angle_brackets, return NO_INCLUDE_PATH; } - if (IS_ABSOLUTE_PATHNAME (fname)) + if (IS_ABSOLUTE_PATH (fname)) return open_file_pch (pfile, fname); /* For #include_next, skip in the search path past the dir in which @@ -962,7 +962,7 @@ read_name_map (cpp_reader *pfile, const char *dirname) ptr->map_from = from; /* Make the real filename absolute. */ - if (IS_ABSOLUTE_PATHNAME (to)) + if (IS_ABSOLUTE_PATH (to)) ptr->map_to = to; else { diff --git a/gcc/doc/hostconfig.texi b/gcc/doc/hostconfig.texi index c13d364..626a893 100644 --- a/gcc/doc/hostconfig.texi +++ b/gcc/doc/hostconfig.texi @@ -47,35 +47,40 @@ common thing to do in this hook is to detect stack overflow. @cindex configuration file @cindex @file{xm-@var{machine}.h} -GCC supports some filesystems that are very different to standard Unix -filesystems. These macros, defined in @file{xm-@var{machine}.h}, -let you choose. +GCC needs to know a number of things about the semantics of the host +machine's filesystem. Filesystems with Unix and MS-DOS semantics are +automatically detected. For other systems, you can define the +following macros in @file{xm-@var{machine}.h}. @ftable @code -@item VMS -Define this macro if the host system is VMS@. - @item HAVE_DOS_BASED_FILE_SYSTEM -Define this macro if the host file system obeys the semantics defined by -MS-DOS instead of Unix. DOS file systems are case insensitive, file -specifications may begin with a drive letter, and both forward slash and -backslash (@samp{/} and @samp{\}) are directory separators. If you -define this macro, you probably need to define the next three macros too. - -@item PATH_SEPARATOR -If defined, this macro should expand to a character constant specifying -the separator for elements of search paths. The default value is a -colon (@samp{:}). DOS-based systems usually use semicolon (@samp{;}). +This macro is automatically defined by @file{system.h} if the host +file system obeys the semantics defined by MS-DOS instead of Unix. +DOS file systems are case insensitive, file specifications may begin +with a drive letter, and both forward slash and backslash (@samp{/} +and @samp{\}) are directory separators. @item DIR_SEPARATOR @itemx DIR_SEPARATOR_2 If defined, these macros expand to character constants specifying -separators for directory names within a file specification. They are -used somewhat inconsistently throughout the compiler. If your system -behaves like Unix (only forward slash separates pathnames), define -neither of them. If your system behaves like DOS (both forward and -backward slash can be used), define @code{DIR_SEPARATOR} to @samp{/} -and @code{DIR_SEPARATOR_2} to @samp{\}. +separators for directory names within a file specification. +@file{system.h} will automatically give them appropriate values on +Unix and MS-DOS file systems. If your file system is neither of +these, define one or both appropriately in @file{xm-@var{machine}.h}. + +However, operating systems like VMS, where constructing a pathname is +more complicated than just stringing together directory names +separated by a special character, should not define either of these +macros. + +@item PATH_SEPARATOR +If defined, this macro should expand to a character constant +specifying the separator for elements of search paths. The default +value is a colon (@samp{:}). DOS-based systems usually, but not +always, use semicolon (@samp{;}). + +@item VMS +Define this macro if the host system is VMS@. @item HOST_OBJECT_SUFFIX Define this macro to be a C string representing the suffix for object @@ -111,14 +111,6 @@ extern int getrusage PARAMS ((int, struct rusage *)); #define TARGET_OBJECT_SUFFIX ".o" #endif -#ifndef VMS -/* FIXME: the location independence code for VMS is hairier than this, - and hasn't been written. */ -#ifndef DIR_UP -#define DIR_UP ".." -#endif /* DIR_UP */ -#endif /* VMS */ - static const char dir_separator_str[] = { DIR_SEPARATOR, 0 }; /* Most every one is fine with LIBRARY_PATH. For some, it conflicts. */ @@ -2442,7 +2434,7 @@ find_a_file (pprefix, name, mode, multilib) /* Determine the filename to execute (special case for absolute paths). */ - if (IS_ABSOLUTE_PATHNAME (name)) + if (IS_ABSOLUTE_PATH (name)) { if (access (name, mode) == 0) { @@ -2626,7 +2618,7 @@ add_sysrooted_prefix (pprefix, prefix, component, priority, int *warn; int os_multilib; { - if (!IS_ABSOLUTE_PATHNAME (prefix)) + if (!IS_ABSOLUTE_PATH (prefix)) abort (); if (target_system_root) @@ -3823,7 +3815,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" directories, so that we can search both the user specified directory and the standard place. */ - if (!IS_ABSOLUTE_PATHNAME (tooldir_prefix)) + if (!IS_ABSOLUTE_PATH (tooldir_prefix)) { if (gcc_exec_prefix) { @@ -4530,7 +4522,7 @@ do_spec_1 (spec, inswitch, soft_matched_part) /* Relative directories always come from -B, and it is better not to use them for searching at run time. In particular, stage1 loses. */ - if (!IS_ABSOLUTE_PATHNAME (pl->prefix)) + if (!IS_ABSOLUTE_PATH (pl->prefix)) continue; #endif /* Try subdirectory if there is one. */ @@ -6205,7 +6197,7 @@ main (argc, argv) standard_exec_prefix. This lets us move the installed tree as a unit. If GCC_EXEC_PREFIX is defined, base standard_startfile_prefix on that as well. */ - if (IS_ABSOLUTE_PATHNAME (standard_startfile_prefix)) + if (IS_ABSOLUTE_PATH (standard_startfile_prefix)) add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1); @@ -7453,7 +7445,7 @@ if_exists_spec_function (argc, argv) const char **argv; { /* Must have only one argument. */ - if (argc == 1 && IS_ABSOLUTE_PATHNAME (argv[0]) && ! access (argv[0], R_OK)) + if (argc == 1 && IS_ABSOLUTE_PATH (argv[0]) && ! access (argv[0], R_OK)) return argv[0]; return NULL; @@ -7473,7 +7465,7 @@ if_exists_else_spec_function (argc, argv) if (argc != 2) return NULL; - if (IS_ABSOLUTE_PATHNAME (argv[0]) && ! access (argv[0], R_OK)) + if (IS_ABSOLUTE_PATH (argv[0]) && ! access (argv[0], R_OK)) return argv[0]; return argv[1]; diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 32bbcf2..a255a72 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -195,7 +195,7 @@ process_include (rtx desc, int lineno) FILE *input_file; /* If specified file name is absolute, skip the include stack. */ - if (! IS_ABSOLUTE_PATHNAME (filename)) + if (! IS_ABSOLUTE_PATH (filename)) { struct file_name_list *stackp; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 3cdbf8c..db3a7b0 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2003-07-02 Zack Weinberg <zack@codesourcery.com> + + * jcf-path.c: Don't default-define PATH_SEPARATOR nor + DIR_SEPARATOR. + Use FILENAME_CMP. + * jcf-write.c: Don't default-define DIR_SEPARATOR. + * jcf.h: Delete COMPARE_FILENAMES definition. + 2003-07-02 Neil Booth <neil@daikokuya.co.uk> * lang.c (java_init_options): Update prototype. diff --git a/gcc/java/jcf-path.c b/gcc/java/jcf-path.c index 8771e6f..eae44c0 100644 --- a/gcc/java/jcf-path.c +++ b/gcc/java/jcf-path.c @@ -34,15 +34,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "jcf.h" -/* By default, colon separates directories in a path. */ -#ifndef PATH_SEPARATOR -#define PATH_SEPARATOR ':' -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - #ifndef DIR_UP #define DIR_UP ".." #endif @@ -147,15 +138,15 @@ add_entry (struct entry **entp, const char *filename, int is_system) len = strlen (filename); - if (len > 4 && (COMPARE_FILENAMES (filename + len - 4, ".zip") == 0 - || COMPARE_FILENAMES (filename + len - 4, ".jar") == 0)) + if (len > 4 && (FILENAME_CMP (filename + len - 4, ".zip") == 0 + || FILENAME_CMP (filename + len - 4, ".jar") == 0)) { n->flags |= FLAG_ZIP; /* If the user uses -classpath then he'll have to include libgcj.jar in the value. We check for this in a simplistic way. Symlinks will fool this test. This is only used for -MM and -MMD, so it probably isn't terribly important. */ - if (! COMPARE_FILENAMES (filename, LIBGCJ_ZIP_FILE)) + if (! FILENAME_CMP (filename, LIBGCJ_ZIP_FILE)) n->flags |= FLAG_SYSTEM; } diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 36f009b..fcdd424 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -40,10 +40,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "ggc.h" #include "tm_p.h" -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - extern struct obstack temporary_obstack; /* Base directory in which `.class' files should be written. diff --git a/gcc/java/jcf.h b/gcc/java/jcf.h index 962db12..9706567 100644 --- a/gcc/java/jcf.h +++ b/gcc/java/jcf.h @@ -54,15 +54,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #define JCF_USE_SCANDIR 0 #endif -/* On case-insensitive file systems, file name components must be - compared using "strcasecmp", if available, instead of "strcmp". - Assumes "config.h" has already been included. */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) && defined (HAVE_STRCASECMP) -#define COMPARE_FILENAMES(X, Y) strcasecmp ((X), (Y)) -#else -#define COMPARE_FILENAMES(X, Y) strcmp ((X), (Y)) -#endif - /* On case-insensitive file systems, we need to ensure that a request to open a .java or .class file is honored only if the file to be opened is of the exact case we are asking for. In other words, we diff --git a/gcc/protoize.c b/gcc/protoize.c index e89aa73..2f86de7 100644 --- a/gcc/protoize.c +++ b/gcc/protoize.c @@ -48,11 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif /* Macro to see if the paths match. */ -#ifdef HAVE_DOS_BASED_FILE_SYSTEM -#define IS_SAME_PATH(a,b) (strcasecmp (a, b) == 0) -#else -#define IS_SAME_PATH(a,b) (strcmp (a, b) == 0) -#endif +#define IS_SAME_PATH(a,b) (FILENAME_CMP (a, b) == 0) /* Suffix for aux-info files. */ #ifdef __MSDOS__ @@ -94,7 +90,6 @@ static int directory_specified_p PARAMS ((const char *)); static int file_excluded_p PARAMS ((const char *)); static char *unexpand_if_needed PARAMS ((const char *)); static char *abspath PARAMS ((const char *, const char *)); -static int is_abspath PARAMS ((const char *)); static void check_aux_info PARAMS ((int)); static const char *find_corresponding_lparen PARAMS ((const char *)); static int referenced_file_is_newer PARAMS ((const char *, time_t)); @@ -694,7 +689,7 @@ in_system_include_dir (path) { const struct default_include *p; - if (! is_abspath (path)) + if (! IS_ABSOLUTE_PATH (path)) abort (); /* Must be an absolutized filename. */ for (p = cpp_include_defaults; p->fname; p++) @@ -1114,20 +1109,6 @@ continue_outer: ; return (got_unexpanded ? savestring (line_buf, copy_p - line_buf) : 0); } -/* Return 1 if pathname is absolute. */ - -static int -is_abspath (path) - const char *path; -{ - return (IS_DIR_SEPARATOR (path[0]) -#ifdef HAVE_DOS_BASED_FILE_SYSTEM - /* Check for disk name on MS-DOS-based systems. */ - || (path[0] && path[1] == ':' && IS_DIR_SEPARATOR (path[2])) -#endif - ); -} - /* Return the absolutized filename for the given relative filename. Note that if that filename is already absolute, it may still be returned in a modified form because this routine also @@ -1156,7 +1137,7 @@ abspath (cwd, rel_filename) { const char *src_p; - if (! is_abspath (rel_filename)) + if (! IS_ABSOLUTE_PATH (rel_filename)) { src_p = cwd2; while ((*endp++ = *src_p++)) @@ -2264,7 +2245,7 @@ start_over: ; continue; aux_info_second_line = p; aux_info_relocated_name = 0; - if (! is_abspath (invocation_filename)) + if (! IS_ABSOLUTE_PATH (invocation_filename)) { /* INVOCATION_FILENAME is relative; append it to BASE_SOURCE_FILENAME's dir. */ diff --git a/gcc/system.h b/gcc/system.h index 369f566..67ddaff 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -458,29 +458,15 @@ extern void abort (void); #define PATH_SEPARATOR ':' #endif +/* Filename handling macros. */ +#include "filenames.h" + +/* These should be phased out in favor of IS_DIR_SEPARATOR, where possible. */ #ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -/* Define IS_DIR_SEPARATOR. */ -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(CH) ((CH) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(CH) \ - (((CH) == DIR_SEPARATOR) || ((CH) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -/* Say how to test for an absolute pathname. On Unix systems, this is if - it starts with a leading slash or a '$', the latter meaning the value of - an environment variable is to be used. On machine with DOS-based - file systems, it is also absolute if it starts with a drive identifier. */ -#ifdef HAVE_DOS_BASED_FILE_SYSTEM -#define IS_ABSOLUTE_PATHNAME(STR) \ - (IS_DIR_SEPARATOR ((STR)[0]) || (STR)[0] == '$' \ - || ((STR)[0] != '\0' && (STR)[1] == ':' && IS_DIR_SEPARATOR ((STR)[2]))) -#else -#define IS_ABSOLUTE_PATHNAME(STR) \ - (IS_DIR_SEPARATOR ((STR)[0]) || (STR)[0] == '$') +# define DIR_SEPARATOR '/' +# ifdef HAVE_DOS_BASED_FILE_SYSTEM +# define DIR_SEPARATOR_2 '\\' +# endif #endif /* Get libiberty declarations. */ |