public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: John Ericson <git@JohnEricson.me>
To: gcc-patches@gcc.gnu.org
Cc: Michael Matz <matz@suse.de>,
	Jonathan Wakely <jwakely.gcc@gmail.com>,
	Paul Koning <paulkoning@comcast.net>
Subject: [PATCH 2/3] driver: for_each_pass: Pass to callback whether dir is machine-disambiguated
Date: Wed, 18 Aug 2021 02:12:14 -0400	[thread overview]
Message-ID: <20210818061215.1064287-3-git@JohnEricson.me> (raw)
In-Reply-To: <20210818061215.1064287-1-git@JohnEricson.me>

We will use this in the subsequent diff to control what basenames we
search for. In machine-specific subdirectories, we should just look for
the original basename, but in machine-agnostic subdirectories, we might
additionally look for prefixed disambiguated names, as an alternate
method of keeping targets apart.
---
 gcc/gcc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 710cbfe9a66..f32c7a8de46 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2766,7 +2766,7 @@ static void *
 for_each_path (const struct path_prefix *paths,
 	       bool do_multi,
 	       size_t extra_space,
-	       void *(*callback) (char *, void *),
+	       void *(*callback) (char *, bool, void *),
 	       void *callback_info)
 {
   struct prefix_list *pl;
@@ -2827,7 +2827,7 @@ for_each_path (const struct path_prefix *paths,
 	  if (!skip_multi_dir)
 	    {
 	      memcpy (path + len, multi_suffix, suffix_len + 1);
-	      ret = callback (path, callback_info);
+	      ret = callback (path, true, callback_info);
 	      if (ret)
 		break;
 	    }
@@ -2838,7 +2838,7 @@ for_each_path (const struct path_prefix *paths,
 	      && pl->require_machine_suffix == 2)
 	    {
 	      memcpy (path + len, just_multi_suffix, just_suffix_len + 1);
-	      ret = callback (path, callback_info);
+	      ret = callback (path, true, callback_info);
 	      if (ret)
 		break;
 	    }
@@ -2848,7 +2848,7 @@ for_each_path (const struct path_prefix *paths,
 	      && !pl->require_machine_suffix && multiarch_dir)
 	    {
 	      memcpy (path + len, multiarch_suffix, multiarch_len + 1);
-	      ret = callback (path, callback_info);
+	      ret = callback (path, true, callback_info);
 	      if (ret)
 		break;
 	    }
@@ -2876,7 +2876,7 @@ for_each_path (const struct path_prefix *paths,
 	      else
 		path[len] = '\0';
 
-	      ret = callback (path, callback_info);
+	      ret = callback (path, false, callback_info);
 	      if (ret)
 		break;
 	    }
@@ -2931,7 +2931,7 @@ struct add_to_obstack_info {
 };
 
 static void *
-add_to_obstack (char *path, void *data)
+add_to_obstack (char *path, bool, void *data)
 {
   struct add_to_obstack_info *info = (struct add_to_obstack_info *) data;
 
@@ -3023,7 +3023,7 @@ struct file_at_path_info {
 };
 
 static void *
-file_at_path (char *path, void *data)
+file_at_path (char *path, bool, void *data)
 {
   struct file_at_path_info *info = (struct file_at_path_info *) data;
   size_t len = strlen (path);
@@ -3074,7 +3074,7 @@ find_a_file (const struct path_prefix *pprefix, const char *name, int mode,
    path. Like file_at_path but tries machine prefix and exe suffix too. */
 
 static void *
-program_at_path (char *path, void *data)
+program_at_path (char *path, bool machine_specific, void *data)
 {
   /* try first with machine-prefixed name */
   struct file_at_path_info *info = (struct file_at_path_info *) data;
@@ -5945,7 +5945,7 @@ struct spec_path_info {
 };
 
 static void *
-spec_path (char *path, void *data)
+spec_path (char *path, bool, void *data)
 {
   struct spec_path_info *info = (struct spec_path_info *) data;
   size_t len = 0;
-- 
2.31.1


  parent reply	other threads:[~2021-08-18  6:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9b1220b2-5407-4b6e-b6d1-5c33c52b4110@www.fastmail.com>
2021-08-18  6:12 ` Optional machine prefix for programs in for -B dirs John Ericson
2021-08-18  6:12   ` [PATCH 1/3] find_a_program: First search with machine prefix John Ericson
2021-08-18  6:12   ` John Ericson [this message]
2021-08-18  6:12   ` [PATCH 3/3] find_a_program: Only search for prefixed paths in undisambiguated dirs John Ericson

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=20210818061215.1064287-3-git@JohnEricson.me \
    --to=git@johnericson.me \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=matz@suse.de \
    --cc=paulkoning@comcast.net \
    /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).