From: David Malcolm <dmalcolm@redhat.com>
To: jit@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH 1/5] libiberty: Expose choose_tmpdir, and fix constness of return type
Date: Mon, 13 Oct 2014 17:39:00 -0000 [thread overview]
Message-ID: <1413222308-25753-2-git-send-email-dmalcolm@redhat.com> (raw)
In-Reply-To: <1413222308-25753-1-git-send-email-dmalcolm@redhat.com>
The jit needs to create a temporary directory, so I need to expose
libiberty's choose_tmpdir as a public entrypoint.
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.
---
include/libiberty.h | 5 +++++
libiberty/choose-temp.c | 1 -
libiberty/functions.texi | 13 ++++++-------
libiberty/make-temp-file.c | 4 ++--
4 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/include/libiberty.h b/include/libiberty.h
index bcc1f9a..d09c9a5 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -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;
diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c
index 0a454cf..8e1e84b 100644
--- a/libiberty/choose-temp.c
+++ b/libiberty/choose-temp.c
@@ -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. */
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index 9323ff9..387aee0 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -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})
diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
index 7b74f81..244cc23 100644
--- a/libiberty/make-temp-file.c
+++ b/libiberty/make-temp-file.c
@@ -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)
--
1.8.5.3
next prev parent reply other threads:[~2014-10-13 17:39 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-13 17:39 [PATCH 0/5] Merger of jit branch (v2) David Malcolm
2014-10-13 17:39 ` [PATCH 2/5] gcc: configure and Makefile changes needed by jit David Malcolm
2014-10-15 17:37 ` Jeff Law
2014-10-15 18:48 ` David Malcolm
2014-10-15 19:00 ` Joseph S. Myers
2014-10-15 21:01 ` Jeff Law
2014-10-15 21:46 ` David Malcolm
2014-10-17 16:20 ` [PATCH] Avoid the need to install when running the jit testsuite David Malcolm
2014-10-17 17:58 ` Joseph S. Myers
2014-10-20 17:59 ` [jit] Drop libgccjit.pc David Malcolm
2014-10-20 20:12 ` Basile Starynkevitch
2014-10-20 20:30 ` Matthias Klose
2014-10-20 20:44 ` David Malcolm
2014-10-13 17:39 ` David Malcolm [this message]
2014-10-15 17:34 ` [PATCH 1/5] libiberty: Expose choose_tmpdir, and fix constness of return type Jeff Law
2014-10-15 19:10 ` David Malcolm
2014-10-15 19:22 ` DJ Delorie
2014-10-13 17:39 ` [PATCH 3/5] timevar.h: Add an auto_timevar class David Malcolm
2014-10-14 9:14 ` Richard Biener
2014-10-14 15:58 ` David Malcolm
2014-10-15 8:09 ` Richard Biener
2014-10-13 18:38 ` [PATCH 4/5] State cleanups David Malcolm
2014-10-16 22:08 ` [PATCH 4/5] State cleanups -- also note for MPX work Jeff Law
2014-10-17 2:12 ` David Malcolm
2014-10-17 17:04 ` Jeff Law
2014-10-14 15:14 ` Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2)) David Malcolm
2014-10-14 15:17 ` [PATCH 05/10] JIT-related changes outside of jit subdir David Malcolm
2014-10-15 17:46 ` Jeff Law
2014-10-17 21:52 ` Joseph S. Myers
2014-10-20 19:59 ` [jit] Add Sphinx to install.texi David Malcolm
2014-10-21 0:01 ` Joseph S. Myers
2014-10-21 16:20 ` Gerald Pfeifer
2014-10-21 19:30 ` David Malcolm
2014-10-30 3:08 ` [jit] Tweaks " David Malcolm
2014-10-14 15:22 ` [PATCH 06/10] Heart of the JIT implementation (was: Re: [PATCH 0/5] Merger of jit branch (v2)) David Malcolm
2014-10-17 21:54 ` Joseph S. Myers
2014-10-20 18:58 ` [jit] Error-handling within gcc::jit::dump David Malcolm
2014-10-21 0:01 ` Joseph S. Myers
2014-10-30 19:29 ` [PATCH 06/10] Heart of the JIT implementation (was: Re: [PATCH 0/5] Merger of jit branch (v2)) David Malcolm
2014-10-31 5:16 ` Joseph S. Myers
2014-10-31 6:30 ` [PATCH 06/10] Heart of the JIT implementation Jeff Law
2014-10-14 15:24 ` [PATCH 07/10] Testsuite for the JIT (Re: Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2))) David Malcolm
2014-10-15 17:50 ` [PATCH 07/10] Testsuite for the JIT (Re: Patches 5-10 of jit merger Jeff Law
2014-10-15 20:04 ` Mike Stump
2014-10-14 15:39 ` [PATCH 10/10] ChangeLog files (Re: Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2))) David Malcolm
2014-10-15 17:55 ` [PATCH 10/10] ChangeLog files (Re: Patches 5-10 of jit merger Jeff Law
2014-10-15 17:02 ` [PATCH 08/10] Documentation for the JIT library (Re: Patches 5-10 of jit merger) David Malcolm
2014-10-15 20:51 ` Jeff Law
2014-10-21 19:02 ` [jit] Update the docs David Malcolm
2014-10-15 17:03 ` [PATCH 09/10] Prebuilt texinfo documentation for the JIT library (Re: Patches 5-10 of jit merger) David Malcolm
2014-10-15 17:52 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413222308-25753-2-git-send-email-dmalcolm@redhat.com \
--to=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jit@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).