diff options
author | Ulrich Drepper <drepper@gmail.com> | 2014-12-11 04:31:52 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@gcc.gnu.org> | 2014-12-11 04:31:52 +0000 |
commit | c168eab92cc42d3c995cc0a1188e1554ebbcd63a (patch) | |
tree | 6a17665d977c9ac21479af8adc84e430135b76f1 /gcc/jit/jit-playback.c | |
parent | 67dab5e0a39887550a9d8681998ae7c5c723ccb7 (diff) | |
download | gcc-c168eab92cc42d3c995cc0a1188e1554ebbcd63a.zip gcc-c168eab92cc42d3c995cc0a1188e1554ebbcd63a.tar.gz gcc-c168eab92cc42d3c995cc0a1188e1554ebbcd63a.tar.bz2 |
Minor interface cleanups of libgccjit
Minor interface cleanups of libgccjit
* jit/jit-playback.c (convert_to_dso): Use auto_vec instead
of automatic array to build up command line.
* jit/jit-recording.c (recording::context::set_str_option):
Make copy of the string.
(recording::context::~context): Free string options.
* jit/jit-recording.h (recording::context): Adjust type
of m_str_options member.
* jit/libgccjit.h: Adjust comment about
gcc_jit_context_set_str_option parameter begin used after
the call.
Update comment now that all interfaces are copy strings
if necessary.
* jit/libgccjit++.h (gccjit::context): Add set_str_option
member function.
From-SVN: r218617
Diffstat (limited to 'gcc/jit/jit-playback.c')
-rw-r--r-- | gcc/jit/jit-playback.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c index 8498900..57ff50e 100644 --- a/gcc/jit/jit-playback.c +++ b/gcc/jit/jit-playback.c @@ -454,8 +454,8 @@ new_function (location *loc, playback::lvalue * playback::context:: new_global (location *loc, - type *type, - const char *name) + type *type, + const char *name) { gcc_assert (type); gcc_assert (name); @@ -943,7 +943,7 @@ new_array_access (location *loc, tree t_result = build4 (ARRAY_REF, t_type_star_ptr, t_ptr, t_index, NULL_TREE, NULL_TREE); if (loc) - set_tree_location (t_result, loc); + set_tree_location (t_result, loc); return new lvalue (this, t_result); } else @@ -958,12 +958,12 @@ new_array_access (location *loc, tree t_indirection = build1 (INDIRECT_REF, t_type_star_ptr, t_address); if (loc) - { - set_tree_location (t_sizeof, loc); - set_tree_location (t_offset, loc); - set_tree_location (t_address, loc); - set_tree_location (t_indirection, loc); - } + { + set_tree_location (t_sizeof, loc); + set_tree_location (t_offset, loc); + set_tree_location (t_address, loc); + set_tree_location (t_indirection, loc); + } return new lvalue (this, t_indirection); } @@ -1331,8 +1331,8 @@ add_assignment (location *loc, if (TREE_TYPE (t_rvalue) != TREE_TYPE (t_lvalue)) { t_rvalue = build1 (CONVERT_EXPR, - TREE_TYPE (t_lvalue), - t_rvalue); + TREE_TYPE (t_lvalue), + t_rvalue); if (loc) set_tree_location (t_rvalue, loc); } @@ -1818,18 +1818,19 @@ convert_to_dso (const char *ctxt_progname) TV_ASSEMBLE. */ auto_timevar assemble_timevar (TV_ASSEMBLE); const char *errmsg; - const char *argv[7]; + auto_vec <const char *> argvec; +#define ADD_ARG(arg) argvec.safe_push (arg) int exit_status = 0; int err = 0; const char *gcc_driver_name = GCC_DRIVER_NAME; - argv[0] = gcc_driver_name; - argv[1] = "-shared"; + ADD_ARG (gcc_driver_name); + ADD_ARG ("-shared"); /* The input: assembler. */ - argv[2] = m_tempdir->get_path_s_file (); + ADD_ARG (m_tempdir->get_path_s_file ()); /* The output: shared library. */ - argv[3] = "-o"; - argv[4] = m_tempdir->get_path_so_file (); + ADD_ARG ("-o"); + ADD_ARG (m_tempdir->get_path_so_file ()); /* Don't use the linker plugin. If running with just a "make" and not a "make install", then we'd @@ -1838,17 +1839,17 @@ convert_to_dso (const char *ctxt_progname) libto_plugin is a .la at build time, with it becoming installed with ".so" suffix: i.e. it doesn't exist with a .so suffix until install time. */ - argv[5] = "-fno-use-linker-plugin"; + ADD_ARG ("-fno-use-linker-plugin"); /* pex argv arrays are NULL-terminated. */ - argv[6] = NULL; + ADD_ARG (NULL); /* pex_one's error-handling requires pname to be non-NULL. */ gcc_assert (ctxt_progname); errmsg = pex_one (PEX_SEARCH, /* int flags, */ gcc_driver_name, - const_cast<char * const *> (argv), + const_cast <char *const *> (argvec.address ()), ctxt_progname, /* const char *pname */ NULL, /* const char *outname */ NULL, /* const char *errname */ @@ -1875,6 +1876,7 @@ convert_to_dso (const char *ctxt_progname) getenv ("PATH")); return; } +#undef ADD_ARG } /* Dynamically-link the built DSO file into this process, using dlopen. |