public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: jit@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH, committed] fixes to gcc_jit_context_dump_reproducer_to_file
Date: Tue, 30 Jun 2015 19:28:00 -0000	[thread overview]
Message-ID: <1435692750-16780-1-git-send-email-dmalcolm@redhat.com> (raw)

Tested with "make check-jit" and visual inspection; jit.sum continues
to have 8014 passes.

Committed to trunk as r225204.

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.
---
 gcc/jit/jit-recording.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

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"
-- 
1.8.5.3

                 reply	other threads:[~2015-06-30 19:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1435692750-16780-1-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).