]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libiberty: Expose choose_tmpdir, and fix constness of return type
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Oct 2014 20:20:05 +0000 (20:20 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Oct 2014 20:20:05 +0000 (20:20 +0000)
include/ChangeLog:
* libiberty.h (choose_tmpdir): New prototype.

libiberty/ChangeLog:
* choose-temp.c (choose_tmpdir): Remove now-redundant local
copy of prototype.
* functions.texi: Regenerate.
* make-temp-file.c (choose_tmpdir): Convert return type from
char * to const char * - given that this returns a pointer to
a memoized allocation, the caller must not touch it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216285 138bc75d-0d04-0410-961f-82ee72b054a4

include/ChangeLog
include/libiberty.h
libiberty/ChangeLog
libiberty/choose-temp.c
libiberty/functions.texi
libiberty/make-temp-file.c

index fd6274fde1c1f46de8de8ef77dc54ea716b0f26c..5198c249e7cda58fa4ae1fafa1f080bd650e4ce4 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-15  David Malcolm  <dmalcolm@redhat.com>
+
+       * libiberty.h (choose_tmpdir): New prototype.
+
 2013-10-02  Mark Wielaard  <mjw@redhat.com>
 
        PR debug/63239
index bcc1f9afaf7b731f486b752f0f42578e44455223..d09c9a54811a51a3deea31c39240de2e109a724a 100644 (file)
@@ -227,6 +227,11 @@ extern char *make_relative_prefix (const char *, const char *,
 extern char *make_relative_prefix_ignore_links (const char *, const char *,
                                                const char *) ATTRIBUTE_MALLOC;
 
+/* Returns a pointer to a directory path suitable for creating temporary
+   files in.  */
+
+extern const char *choose_tmpdir (void) ATTRIBUTE_RETURNS_NONNULL;
+
 /* Choose a temporary directory to use for scratch files.  */
 
 extern char *choose_temp_base (void) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
index 5211664c242e75fa5b8313d5b1de8c42bc512bc7..73dee14ad67753057f085332510443c1d54f0171 100644 (file)
@@ -1,3 +1,12 @@
+2014-10-15  David Malcolm  <dmalcolm@redhat.com>
+
+       * choose-temp.c (choose_tmpdir): Remove now-redundant local
+       copy of prototype.
+       * functions.texi: Regenerate.
+       * make-temp-file.c (choose_tmpdir): Convert return type from
+       char * to const char * - given that this returns a pointer to
+       a memoized allocation, the caller must not touch it.
+
 2014-10-14  Joel Brobecker  <brobecker@adacore.com>
 
        * d-demangle.c: Replace strtold with strtod in global comment.
index 0a454cfa7ca1c8eb0cfcc3da4eb2a15bb2977303..8e1e84be7651d05962810979c34696733b338fb3 100644 (file)
@@ -34,7 +34,6 @@ Boston, MA 02110-1301, USA.  */
 #endif
 
 #include "libiberty.h"
-extern char *choose_tmpdir (void);
 
 /* Name of temporary file.
    mktemp requires 6 trailing X's.  */
index 9323ff9f2e4f3098081d066b9105ed86ae8ca217..387aee0bb9c39305573094c27628b4e7cff3c706 100644 (file)
@@ -125,7 +125,7 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of
 
 @end deftypefn
 
-@c choose-temp.c:46
+@c choose-temp.c:45
 @deftypefn Extension char* choose_temp_base (void)
 
 Return a prefix for temporary file names or @code{NULL} if unable to
@@ -139,7 +139,7 @@ not recommended.
 @end deftypefn
 
 @c make-temp-file.c:96
-@deftypefn Replacement char* choose_tmpdir ()
+@deftypefn Replacement const char* choose_tmpdir ()
 
 Returns a pointer to a directory path suitable for creating temporary
 files in.
@@ -160,9 +160,8 @@ number of seconds used.
   @dots{}, @code{NULL})
 
 Concatenate zero or more of strings and return the result in freshly
-@code{xmalloc}ed memory.  Returns @code{NULL} if insufficient memory is
-available.  The argument list is terminated by the first @code{NULL}
-pointer encountered.  Pointers to empty strings are ignored.
+@code{xmalloc}ed memory.  The argument list is terminated by the first
+@code{NULL} pointer encountered.  Pointers to empty strings are ignored.
 
 @end deftypefn
 
@@ -528,7 +527,7 @@ nineteen EBCDIC varying characters is tested; exercise caution.)
 @end ftable
 @end defvr
 
-@c hashtab.c:336
+@c hashtab.c:328
 @deftypefn Supplemental htab_t htab_create_typed_alloc (size_t @var{size}, @
 htab_hash @var{hash_f}, htab_eq @var{eq_f}, htab_del @var{del_f}, @
 htab_alloc @var{alloc_tab_f}, htab_alloc @var{alloc_f}, @
@@ -1163,7 +1162,7 @@ control over the state of the random number generator.
 
 @end deftypefn
 
-@c concat.c:174
+@c concat.c:160
 @deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @
   @dots{}, @code{NULL})
 
index 7b74f8179b101e9c37c6bb8683b3cc588ed1fc27..244cc23c5090e1c0d227820dc703adbc8022f8d5 100644 (file)
@@ -93,7 +93,7 @@ static char *memoized_tmpdir;
 
 /*
 
-@deftypefn Replacement char* choose_tmpdir ()
+@deftypefn Replacement const char* choose_tmpdir ()
 
 Returns a pointer to a directory path suitable for creating temporary
 files in.
@@ -102,7 +102,7 @@ files in.
 
 */
 
-char *
+const char *
 choose_tmpdir (void)
 {
   if (!memoized_tmpdir)