diff options
author | David Malcolm <dmalcolm@redhat.com> | 2015-06-30 19:18:34 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2015-06-30 19:18:34 +0000 |
commit | a6314e15e0c5671e71f4511011a125aab3cc3d6a (patch) | |
tree | c0e9a6fe7c2601958c3d008584862c73e00c43c9 | |
parent | adb6d84ba64c1513a4238691ec25e3137485f485 (diff) | |
download | gcc-a6314e15e0c5671e71f4511011a125aab3cc3d6a.zip gcc-a6314e15e0c5671e71f4511011a125aab3cc3d6a.tar.gz gcc-a6314e15e0c5671e71f4511011a125aab3cc3d6a.tar.bz2 |
fixes to gcc_jit_context_dump_reproducer_to_file
gcc/jit/ChangeLog:
* jit-recording.c
(gcc::jit::recording::context::dump_reproducer_to_file):
Add pragma to generated reproducers to disable -Wunused-variable.
Fix handling of NULL string options.
From-SVN: r225204
-rw-r--r-- | gcc/jit/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/jit/jit-recording.c | 18 |
2 files changed, 19 insertions, 6 deletions
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 10b8ec7..2ab6153 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,5 +1,12 @@ 2015-06-30 David Malcolm <dmalcolm@redhat.com> + * jit-recording.c + (gcc::jit::recording::context::dump_reproducer_to_file): + Add pragma to generated reproducers to disable -Wunused-variable. + Fix handling of NULL string options. + +2015-06-30 David Malcolm <dmalcolm@redhat.com> + * docs/cp/topics/expressions.rst: Remove stray semicolon. * docs/cp/topics/functions.rst: Remove stray backslash. * docs/_build/texinfo/libgccjit.texi: Regenerate. diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c index f379b58..11b9739 100644 --- a/gcc/jit/jit-recording.c +++ b/gcc/jit/jit-recording.c @@ -1494,6 +1494,7 @@ recording::context::dump_reproducer_to_file (const char *path) print_version (r.get_file (), " ", false); r.write ("*/\n"); r.write ("#include <libgccjit.h>\n\n"); + r.write ("#pragma GCC diagnostic ignored \"-Wunused-variable\"\n\n"); r.write ("static void\nset_options ("); r.write_params (contexts); r.write (");\n\n"); @@ -1564,12 +1565,17 @@ recording::context::dump_reproducer_to_file (const char *path) r.write (" /* String options. */\n"); for (int opt_idx = 0; opt_idx < GCC_JIT_NUM_STR_OPTIONS; opt_idx++) - r.write (" gcc_jit_context_set_str_option (%s,\n" - " %s,\n" - " \"%s\");\n", - r.get_identifier (contexts[ctxt_idx]), - str_option_reproducer_strings[opt_idx], - m_str_options[opt_idx] ? m_str_options[opt_idx] : "NULL"); + { + r.write (" gcc_jit_context_set_str_option (%s,\n" + " %s,\n", + r.get_identifier (contexts[ctxt_idx]), + str_option_reproducer_strings[opt_idx]); + if (m_str_options[opt_idx]) + r.write (" \"%s\");\n", + m_str_options[opt_idx]); + else + r.write (" NULL);\n"); + } r.write (" /* Int options. */\n"); for (int opt_idx = 0; opt_idx < GCC_JIT_NUM_INT_OPTIONS; opt_idx++) r.write (" gcc_jit_context_set_int_option (%s,\n" |