summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 23:33:25 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 23:33:25 +0000
commit4d0069eeb7f1993e213d7c974d99345e16511ee1 (patch)
treed4db9e599db1d46abb0414b25660560c2823a504 /libiberty
parent766928aa6ac2c846c2d098ef4ef9e220feb4dcab (diff)
downloadgcc-4d0069eeb7f1993e213d7c974d99345e16511ee1.tar.gz
gcc/testsuite/ChangeLog:
2014-11-11 Anthony Brandon <anthony.brandon@gmail.com> Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/36312 * gcc.misc-tests/output.exp: New test case for identical input and output files. include/ChangeLog: 2014-11-11 Anthony Brandon <anthony.brandon@gmail.com> Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/36312 * filenames.h: Add prototype for canonical_filename_eq. gcc/ChangeLog: 2014-11-11 Anthony Brandon <anthony.brandon@gmail.com> Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/36312 * diagnostic-core.h: Add prototype for fatal_error. * diagnostic.c (fatal_error): New function fatal_error. * gcc.c (store_arg): Remove have_o_argbuf_index. (process_command): Check if input and output files are the same. * toplev.c (init_asm_output): Check if input and output files are the same. libiberty/ChangeLog: 2014-11-11 Anthony Brandon <anthony.brandon@gmail.com> Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/36312 * filename_cmp.c (canonical_filename_eq): New function to check if file names are the same. * functions.texi: Updated with documentation for new function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217391 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog8
-rw-r--r--libiberty/filename_cmp.c29
-rw-r--r--libiberty/functions.texi18
3 files changed, 51 insertions, 4 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index d82cce91489..98a7c5b34bc 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,11 @@
+2014-11-11 Anthony Brandon <anthony.brandon@gmail.com>
+ Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR driver/36312
+ * filename_cmp.c (canonical_filename_eq): New function to check if
+ file names are the same.
+ * functions.texi: Updated with documentation for new function.
+
2014-11-11 David Malcolm <dmalcolm@redhat.com>
* ChangeLog.jit: New.
diff --git a/libiberty/filename_cmp.c b/libiberty/filename_cmp.c
index 9e16d242086..150488cbab1 100644
--- a/libiberty/filename_cmp.c
+++ b/libiberty/filename_cmp.c
@@ -24,8 +24,13 @@
#include <string.h>
#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
#include "filenames.h"
#include "safe-ctype.h"
+#include "libiberty.h"
/*
@@ -190,3 +195,27 @@ filename_eq (const void *s1, const void *s2)
/* The casts are for -Wc++-compat. */
return filename_cmp ((const char *) s1, (const char *) s2) == 0;
}
+
+/*
+
+@deftypefn Extension int canonical_filename_eq (const char *@var{a}, const char *@var{b})
+
+Return non-zero if file names @var{a} and @var{b} are equivalent.
+This function compares the canonical versions of the filenames as returned by
+@code{lrealpath()}, so that so that different file names pointing to the same
+underlying file are treated as being identical.
+
+@end deftypefn
+
+*/
+
+int
+canonical_filename_eq (const char * a, const char * b)
+{
+ char * ca = lrealpath(a);
+ char * cb = lrealpath(b);
+ int res = filename_eq (ca, cb);
+ free (ca);
+ free (cb);
+ return res;
+}
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index 3627285f905..9ed9ff03438 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -125,6 +125,16 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of
@end deftypefn
+@c filename_cmp.c:201
+@deftypefn Extension int canonical_filename_eq (const char *@var{a}, const char *@var{b})
+
+Return non-zero if file names @var{a} and @var{b} are equivalent.
+This function compares the canonical versions of the filenames as returned by
+@code{lrealpath()}, so that so that different file names pointing to the same
+underlying file are treated as being identical.
+
+@end deftypefn
+
@c choose-temp.c:45
@deftypefn Extension char* choose_temp_base (void)
@@ -286,7 +296,7 @@ value 1). If @var{valu} is zero, zero is returned.
@end deftypefn
-@c filename_cmp.c:32
+@c filename_cmp.c:37
@deftypefn Extension int filename_cmp (const char *@var{s1}, const char *@var{s2})
Return zero if the two file names @var{s1} and @var{s2} are equivalent.
@@ -303,7 +313,7 @@ and backward slashes are equal.
@end deftypefn
-@c filename_cmp.c:178
+@c filename_cmp.c:183
@deftypefn Extension int filename_eq (const void *@var{s1}, const void *@var{s2})
Return non-zero if file names @var{s1} and @var{s2} are equivalent.
@@ -311,7 +321,7 @@ This function is for use with hashtab.c hash tables.
@end deftypefn
-@c filename_cmp.c:147
+@c filename_cmp.c:152
@deftypefn Extension hashval_t filename_hash (const void *@var{s})
Return the hash value for file name @var{s} that will be compared
@@ -320,7 +330,7 @@ This function is for use with hashtab.c hash tables.
@end deftypefn
-@c filename_cmp.c:89
+@c filename_cmp.c:94
@deftypefn Extension int filename_ncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
Return zero if the two file names @var{s1} and @var{s2} are equivalent