public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kwok Yeung <kcy@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] Fix string formatting issues
Date: Thu, 30 Jun 2022 23:23:19 +0000 (GMT)	[thread overview]
Message-ID: <20220630232319.AA5B53858437@sourceware.org> (raw)

https://gcc.gnu.org/g:e9ee746093bd989c33685e3197c75b901aef2cc1

commit e9ee746093bd989c33685e3197c75b901aef2cc1
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date:   Thu Jun 30 15:31:41 2022 +0100

    Fix string formatting issues
    
    Stricter format-string checking in more recent versions of GCC can cause
    build failures.
    
    2022-06-30  Kwok Cheung Yeung  <kcy@codesourcery.com>
    
            gcc/
            * omp-data-optimize.cc (omp_data_optimize_add_candidate): Suppress
            format checking.
            (omp_data_optimize_can_be_private): Likewise.
            (omp_data_optimize_can_be_private): Likewise.
    
    (This should be a fixup to ab53d5a6a27dce2a92f28a62ceb6e184c8356f25: 'openacc:
    Add data optimization pass')
    
    2022-06-30  Kwok Cheung Yeung  <kcy@codesourcery.com>
    
            gcc/
            * gimplify.cc (gimplify_scan_omp_clauses): Remove extra
            '%<..%>' pair in format string.
    
    (This should be a fixup to dbc770c4351c8824e8083f8aff6117a6b4ba3c0d: 'openmp:
    Implement uses_allocators clause')

Diff:
---
 gcc/ChangeLog.omp        | 12 ++++++++++++
 gcc/gimplify.cc          |  2 +-
 gcc/omp-data-optimize.cc | 28 ++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 29740139fd2..1455a9605c2 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,15 @@
+2022-06-30  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+	* gimplify.cc (gimplify_scan_omp_clauses): Remove extra
+	'%<..%>' pair in format string.
+
+2022-06-30  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+	* omp-data-optimize.cc (omp_data_optimize_add_candidate): Suppress
+	format checking.
+	(omp_data_optimize_can_be_private): Likewise.
+	(omp_data_optimize_can_be_private): Likewise.
+
 2022-05-13  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
 	* omp-expand.cc (expand_omp_target): Gimplify launch dimensions used
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 8e8151cfc35..e0af57058d8 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -11384,7 +11384,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 		      }
 		  if (uc == NULL_TREE)
 		    {
-		      error_at (OMP_CLAUSE_LOCATION (c), "allocator %<%qE%> "
+		      error_at (OMP_CLAUSE_LOCATION (c), "allocator %qE "
 				"requires %<uses_allocators(%E)%> clause in "
 				"target region", allocator, allocator);
 		      remove = true;
diff --git a/gcc/omp-data-optimize.cc b/gcc/omp-data-optimize.cc
index 31f615c1d2b..a64f933b2d4 100644
--- a/gcc/omp-data-optimize.cc
+++ b/gcc/omp-data-optimize.cc
@@ -154,6 +154,10 @@ omp_data_optimize_add_candidate (const dump_user_location_t &loc, tree var,
   inhibit_descriptor in;
   in.stmt = NULL;
 
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat"
+#endif
   if (DECL_EXTERNAL (var))
     {
       if (dump_enabled_p () && dump_flags & TDF_DETAILS)
@@ -187,6 +191,9 @@ omp_data_optimize_add_candidate (const dump_user_location_t &loc, tree var,
 
       in.kind = INHIBIT_NOT;
     }
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
 
   if (state->candidates.put (var, in))
     gcc_unreachable ();
@@ -575,6 +582,10 @@ omp_data_optimize_can_be_private (tree var, gimple *target_stmt)
       state.bb = *state.scanned_bb.get (root_id);
     }
 
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat"
+#endif
   if (dump_enabled_p () && dump_flags & TDF_DETAILS)
     {
       for (hash_map<const void*,ODO_BB>::iterator it = state.scanned_bb.begin ();
@@ -613,6 +624,9 @@ omp_data_optimize_can_be_private (tree var, gimple *target_stmt)
 		      : state.bb.access == ACCESS_UNKNOWN
 		      ? "complex control flow"
 		      : "unknown reason"));
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
 
   return state.bb.access == ACCESS_DEF_FIRST;
 }
@@ -698,12 +712,19 @@ omp_data_optimize_stmt_target (gimple *stmt, ODO_State *state)
         if (!id) {
           /* The variable was not a parameter or named in any bind, so it
              must be in an external scope, and therefore live-on-exit.  */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat"
+#endif
           if (dump_enabled_p ())
             dump_printf_loc(MSG_MISSED_OPTIMIZATION, DUMP_LOC (*pc),
                             "%qs not optimized: %<%T%> is unsuitable"
                             " for privatization\n",
                             c_s_prev, var);
           continue;
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
 	    }
 
 	  switch (id->kind)
@@ -746,6 +767,10 @@ omp_data_optimize_stmt_target (gimple *stmt, ODO_State *state)
 		}
 	      break;
 
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat"
+#endif
 	    case INHIBIT_USE:  /* Optimization inhibited by a variable use.  */
 	      if (dump_enabled_p ())
 		{
@@ -776,6 +801,9 @@ omp_data_optimize_stmt_target (gimple *stmt, ODO_State *state)
 				   " for privatization\n", c_s_prev, var);
 		}
 	      break;
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
 
 	    default:
 	      gcc_unreachable ();


                 reply	other threads:[~2022-06-30 23:23 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=20220630232319.AA5B53858437@sourceware.org \
    --to=kcy@gcc.gnu.org \
    --cc=gcc-cvs@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).