public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2 3/4] libcc1: Add 'set compile-gcc'
  2015-04-23 20:38 [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1 Jan Kratochvil
@ 2015-04-23 20:38 ` Jan Kratochvil
  2015-04-23 21:57   ` Jeff Law
  2015-04-27 15:23   ` Pedro Alves
  2015-04-23 20:38 ` [PATCH v2 4/4] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

Hi,

already approved, reposting just to keep it a part of the series:
	https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01299.html

As discussed in
	How to use compile & execute function in GDB
	https://sourceware.org/ml/gdb/2015-04/msg00026.html

GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but one cannot
override which one.  GDB would provide new option 'set compile-gcc'.

This patch does not change the libcc1 API as it overloads the triplet_regexp
parameter of GCC's set_arguments according to:

+  if (access (triplet_regexp, X_OK) == 0)

GDB counterpart:
	[PATCH v2 2/2] compile: Add 'set compile-gcc'
	https://sourceware.org/ml/gdb-patches/2015-04/msg00910.html
	Message-ID: <20150423203402.23140.92757.stgit@host1.jankratochvil.net>


Jan


include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-interface.h (enum gcc_base_api_version): Add comment to
	GCC_FE_VERSION_1.
	(struct gcc_base_vtable): Describe triplet_regexp parameter overload
	for set_arguments.

libcc1/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* libcc1.cc (libcc1_set_arguments): Implement filenames for
	triplet_regexp.
---
 include/gcc-interface.h |    7 ++++-
 libcc1/libcc1.cc        |   62 +++++++++++++++++++++++++++--------------------
 2 files changed, 41 insertions(+), 28 deletions(-)

diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index 21cc403..95b9b12 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -46,7 +46,9 @@ enum gcc_base_api_version
 {
   GCC_FE_VERSION_0 = 0,
 
-  /* Parameter verbose has been moved from compile to set_arguments.  */
+  /* Parameter verbose has been moved from compile to set_arguments.
+     Parameter triplet_regexp of set_arguments can be also gcc driver
+     executable.  */
   GCC_FE_VERSION_1 = 1,
 };
 
@@ -104,7 +106,8 @@ struct gcc_base_vtable
 
   /* Set the compiler's command-line options for the next compilation.
      TRIPLET_REGEXP is a regular expression that is used to match the
-     configury triplet prefix to the compiler.
+     configury triplet prefix to the compiler; TRIPLET_REGEXP can be
+     also absolute filename  to the computer.
      The arguments are copied by GCC.  ARGV need not be
      NULL-terminated.  The arguments must be set separately for each
      compilation; that is, after a compile is requested, the
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index 06a91f6..c2a1d5f 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -322,38 +322,48 @@ libcc1_set_arguments (struct gcc_base_context *s,
 
   self->verbose = verbose != 0;
 
-  std::string rx = make_regexp (triplet_regexp, COMPILER_NAME);
-  // Simulate fnotice by fprintf.
-  if (self->verbose)
-    fprintf (stderr, _("searching for compiler matching regex %s\n"),
-	     rx.c_str());
-  code = regcomp (&triplet, rx.c_str (), REG_EXTENDED | REG_NOSUB);
-  if (code != 0)
+  std::string compiler;
+  if (access (triplet_regexp, X_OK) == 0)
     {
-      size_t len = regerror (code, &triplet, NULL, 0);
-      char err[len];
+      compiler = triplet_regexp;
+      // Simulate fnotice by fprintf.
+      if (self->verbose)
+	fprintf (stderr, _("using explicit compiler filename %s\n"),
+		 compiler.c_str());
+    }
+  else
+    {
+      std::string rx = make_regexp (triplet_regexp, COMPILER_NAME);
+      if (self->verbose)
+	fprintf (stderr, _("searching for compiler matching regex %s\n"),
+		 rx.c_str());
+      code = regcomp (&triplet, rx.c_str (), REG_EXTENDED | REG_NOSUB);
+      if (code != 0)
+	{
+	  size_t len = regerror (code, &triplet, NULL, 0);
+	  char err[len];
 
-      regerror (code, &triplet, err, len);
+	  regerror (code, &triplet, err, len);
 
-      return concat ("Could not compile regexp \"",
-		     rx.c_str (),
-		     "\": ",
-		     err,
-		     (char *) NULL);
-    }
+	  return concat ("Could not compile regexp \"",
+			 rx.c_str (),
+			 "\": ",
+			 err,
+			 (char *) NULL);
+	}
 
-  std::string compiler;
-  if (!find_compiler (triplet, &compiler))
-    {
+      if (!find_compiler (triplet, &compiler))
+	{
+	  regfree (&triplet);
+	  return concat ("Could not find a compiler matching \"",
+			 rx.c_str (),
+			 "\"",
+			 (char *) NULL);
+	}
       regfree (&triplet);
-      return concat ("Could not find a compiler matching \"",
-		     rx.c_str (),
-		     "\"",
-		     (char *) NULL);
+      if (self->verbose)
+	fprintf (stderr, _("found compiler %s\n"), compiler.c_str());
     }
-  regfree (&triplet);
-  if (self->verbose)
-    fprintf (stderr, _("found compiler %s\n"), compiler.c_str());
 
   self->args.push_back (compiler);
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 2/4] libcc1: set debug compile: Display GCC driver filename
  2015-04-23 20:38 [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1 Jan Kratochvil
  2015-04-23 20:38 ` [PATCH v2 3/4] libcc1: Add 'set compile-gcc' Jan Kratochvil
  2015-04-23 20:38 ` [PATCH v2 4/4] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
@ 2015-04-23 20:38 ` Jan Kratochvil
  2015-04-23 20:42   ` Jan Kratochvil
  2015-04-23 21:56   ` Jeff Law
  2015-04-23 21:54 ` [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1 Jeff Law
  3 siblings, 2 replies; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

Hi,

already approved, reposting just to keep it a part of the series:
	https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01301.html

As discussed in
	How to use compile & execute function in GDB
	https://sourceware.org/ml/gdb/2015-04/msg00026.html

GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but it does not
display which one.  It cannot, GCC method set_arguments() does not yet know
whether 'set debug compile' is enabled or not.

Unfortunately this changes libcc1 API in an incompatible way.  There is
a possibility of a hack to keep the API the same - one could pass "-v" option
explicitly to set_arguments(), set_arguments() could compare the "-v" string
and print the GCC filename accordingly.  Then the 'verbose' parameter of
compile() would lose its meaning.  What do you think?

GDB counterpart:
	[PATCH v2 1/2] compile: set debug compile: Display GCC driver filename
	https://sourceware.org/ml/gdb-patches/2015-04/msg00909.html
	Message-ID: <20150423203402.23140.92757.stgit@host1.jankratochvil.net>


Jan


include/ChangeLog
2015-04-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-interface.h (enum gcc_base_api_version): Add comment to
	GCC_FE_VERSION_1.
	(struct gcc_base_vtable): Rename set_arguments to set_arguments_v0.
	Update comment for compile.  New method set_arguments.

libcc1/ChangeLog
2015-04-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* libcc1.cc: Include intl.h.
	(struct libcc1): Add field verbose.
	(libcc1::libcc1): Initialize it.
	(libcc1_set_arguments): Add parameter verbose, implement it.
	(libcc1_set_arguments_v0): New function.
	(libcc1_compile): Set parameter verbose to SELF.
	(vtable): Use libcc1_set_arguments_v0 and add libcc1_set_arguments.
---
 include/gcc-interface.h |   45 +++++++++++++++++++++++++++++----------------
 libcc1/libcc1.cc        |   34 +++++++++++++++++++++++++++++-----
 2 files changed, 58 insertions(+), 21 deletions(-)

diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index dcfa6ce..21cc403 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -45,6 +45,8 @@ struct gcc_base_context;
 enum gcc_base_api_version
 {
   GCC_FE_VERSION_0 = 0,
+
+  /* Parameter verbose has been moved from compile to set_arguments.  */
   GCC_FE_VERSION_1 = 1,
 };
 
@@ -65,20 +67,13 @@ struct gcc_base_vtable
 
   unsigned int version;
 
-  /* Set the compiler's command-line options for the next compilation.
-     TRIPLET_REGEXP is a regular expression that is used to match the
-     configury triplet prefix to the compiler.
-     The arguments are copied by GCC.  ARGV need not be
-     NULL-terminated.  The arguments must be set separately for each
-     compilation; that is, after a compile is requested, the
-     previously-set arguments cannot be reused.
-
-     This returns NULL on success.  On failure, returns a malloc()d
-     error message.  The caller is responsible for freeing it.  */
+  /* Deprecated GCC_FE_VERSION_0 variant of the GCC_FE_VERSION_1
+     set_arguments method.  GCC_FE_VERSION_0 version did not have the
+     verbose parameter.  */
 
-  char *(*set_arguments) (struct gcc_base_context *self,
-			  const char *triplet_regexp,
-			  int argc, char **argv);
+  char *(*set_arguments_v0) (struct gcc_base_context *self,
+			     const char *triplet_regexp,
+			     int argc, char **argv);
 
   /* Set the file name of the program to compile.  The string is
      copied by the method implementation, but the caller must
@@ -95,9 +90,9 @@ struct gcc_base_vtable
 			      void *datum);
 
   /* Perform the compilation.  FILENAME is the name of the resulting
-     object file.  VERBOSE can be set to cause GCC to print some
-     information as it works.  Returns true on success, false on
-     error.  */
+     object file.  VERBOSE should be the same value as passed
+     to gcc_base_vtable::set_arguments.  Returns true on success, false
+     on error.  */
 
   int /* bool */ (*compile) (struct gcc_base_context *self,
 			     const char *filename,
@@ -106,6 +101,24 @@ struct gcc_base_vtable
   /* Destroy this object.  */
 
   void (*destroy) (struct gcc_base_context *self);
+
+  /* Set the compiler's command-line options for the next compilation.
+     TRIPLET_REGEXP is a regular expression that is used to match the
+     configury triplet prefix to the compiler.
+     The arguments are copied by GCC.  ARGV need not be
+     NULL-terminated.  The arguments must be set separately for each
+     compilation; that is, after a compile is requested, the
+     previously-set arguments cannot be reused.  VERBOSE can be set
+     to cause GCC to print some information as it works.  
+
+     This returns NULL on success.  On failure, returns a malloc()d
+     error message.  The caller is responsible for freeing it.
+     
+     This method is only available since GCC_FE_VERSION_1.  */
+
+  char *(*set_arguments) (struct gcc_base_context *self,
+			  const char *triplet_regexp,
+			  int argc, char **argv, int /* bool */ verbose);
 };
 
 /* The GCC object.  */
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index 99a0fa1..06a91f6 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "xregex.h"
 #include "findcomp.hh"
 #include "compiler-name.h"
+#include "intl.h"
 
 struct libcc1;
 
@@ -66,6 +67,9 @@ struct libcc1 : public gcc_c_context
 
   std::vector<std::string> args;
   std::string source_file;
+
+  /* Non-zero as an equivalent to gcc driver option "-v".  */
+  bool verbose;
 };
 
 // A local subclass of connection that holds a back-pointer to the
@@ -97,7 +101,8 @@ libcc1::libcc1 (const gcc_base_vtable *v,
     print_function (NULL),
     print_datum (NULL),
     args (),
-    source_file ()
+    source_file (),
+    verbose (false)
 {
   base.ops = v;
   c_ops = cv;
@@ -309,13 +314,19 @@ make_regexp (const char *triplet_regexp, const char *compiler)
 static char *
 libcc1_set_arguments (struct gcc_base_context *s,
 		      const char *triplet_regexp,
-		      int argc, char **argv)
+		      int argc, char **argv, int verbose)
 {
   libcc1 *self = (libcc1 *) s;
   regex_t triplet;
   int code;
 
+  self->verbose = verbose != 0;
+
   std::string rx = make_regexp (triplet_regexp, COMPILER_NAME);
+  // Simulate fnotice by fprintf.
+  if (self->verbose)
+    fprintf (stderr, _("searching for compiler matching regex %s\n"),
+	     rx.c_str());
   code = regcomp (&triplet, rx.c_str (), REG_EXTENDED | REG_NOSUB);
   if (code != 0)
     {
@@ -341,6 +352,8 @@ libcc1_set_arguments (struct gcc_base_context *s,
 		     (char *) NULL);
     }
   regfree (&triplet);
+  if (self->verbose)
+    fprintf (stderr, _("found compiler %s\n"), compiler.c_str());
 
   self->args.push_back (compiler);
 
@@ -350,6 +363,14 @@ libcc1_set_arguments (struct gcc_base_context *s,
   return NULL;
 }
 
+static char *
+libcc1_set_arguments_v0 (struct gcc_base_context *s,
+			 const char *triplet_regexp,
+			 int argc, char **argv)
+{
+  return libcc1_set_arguments (s, triplet_regexp, argc, argv, false);
+}
+
 static void
 libcc1_set_source_file (struct gcc_base_context *s,
 			const char *file)
@@ -439,6 +460,8 @@ libcc1_compile (struct gcc_base_context *s,
 {
   libcc1 *self = (libcc1 *) s;
 
+  self->verbose = verbose != 0;
+
   int fds[2];
   if (socketpair (AF_UNIX, SOCK_STREAM, 0, fds) != 0)
     {
@@ -466,7 +489,7 @@ libcc1_compile (struct gcc_base_context *s,
   self->args.push_back ("-c");
   self->args.push_back ("-o");
   self->args.push_back (filename);
-  if (verbose)
+  if (self->verbose)
     self->args.push_back ("-v");
 
   self->connection = new libcc1_connection (fds[0], stderr_fds[0], self);
@@ -505,11 +528,12 @@ libcc1_destroy (struct gcc_base_context *s)
 static const struct gcc_base_vtable vtable =
 {
   GCC_FE_VERSION_1,
-  libcc1_set_arguments,
+  libcc1_set_arguments_v0,
   libcc1_set_source_file,
   libcc1_set_print_callback,
   libcc1_compile,
-  libcc1_destroy
+  libcc1_destroy,
+  libcc1_set_arguments,
 };
 
 extern "C" gcc_c_fe_context_function gcc_c_fe_context;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 4/4] libcc1: 'set debug compile': Display absolute GCC driver filename
  2015-04-23 20:38 [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1 Jan Kratochvil
  2015-04-23 20:38 ` [PATCH v2 3/4] libcc1: Add 'set compile-gcc' Jan Kratochvil
@ 2015-04-23 20:38 ` Jan Kratochvil
  2015-04-23 21:57   ` Jeff Law
  2015-04-23 20:38 ` [PATCH v2 2/4] libcc1: set debug compile: Display " Jan Kratochvil
  2015-04-23 21:54 ` [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1 Jeff Law
  3 siblings, 1 reply; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

Hi,

already approved, maybe it could be already checked in outside of the series:
	https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01298.html

With the patches so far after
        (gdb) set debug compile 1
one would get:
        searching for compiler matching regex ^(x86_64|i.86)(-[^-]*)?-linux(-gnu)?-gcc$
        found compiler x86_64-unknown-linux-gnu-gcc
But I believe it is more readable to see:
        searching for compiler matching regex ^(x86_64|i.86)(-[^-]*)?-linux(-gnu)?-gcc$
        found compiler /usr/bin/x86_64-unknown-linux-gnu-gcc

I do not think the change will have functionality impact, although the filename
gets used even for executing the command.


Jan


libcc1/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* findcomp.cc: Include system.h.
	(search_dir): Return absolute filename.
---
 libcc1/findcomp.cc |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcc1/findcomp.cc b/libcc1/findcomp.cc
index f02b1df..5d49e29 100644
--- a/libcc1/findcomp.cc
+++ b/libcc1/findcomp.cc
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "libiberty.h"
 #include "xregex.h"
 #include "findcomp.hh"
+#include "system.h"
 
 class scanner
 {
@@ -68,7 +69,7 @@ search_dir (const regex_t &regexp, const std::string &dir, std::string *result)
     {
       if (regexec (&regexp, filename, 0, NULL, 0) == 0)
 	{
-	  *result = filename;
+	  *result = dir + DIR_SEPARATOR + filename;
 	  return true;
 	}
     }

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1
@ 2015-04-23 20:38 Jan Kratochvil
  2015-04-23 20:38 ` [PATCH v2 3/4] libcc1: Add 'set compile-gcc' Jan Kratochvil
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

Hi,

in mail thread
	https://sourceware.org/ml/gdb-patches/2015-04/msg00804.html
the idea of breaking libcc1.so compatibility was rejected.

Therefore this patch series implements full backward/forward GCC/GDB ABI
compatibility.


Jan


include/ChangeLog
2015-04-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-interface.h (enum gcc_base_api_version): Add GCC_FE_VERSION_1.

libcc1/ChangeLog
2015-04-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* libcc1.cc (vtable): Update to GCC_FE_VERSION_1.
	(gcc_c_fe_context): Accept also GCC_FE_VERSION_1.
---
 include/gcc-interface.h |    3 ++-
 libcc1/libcc1.cc        |    5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index 34010f2..dcfa6ce 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -44,7 +44,8 @@ struct gcc_base_context;
 
 enum gcc_base_api_version
 {
-  GCC_FE_VERSION_0 = 0
+  GCC_FE_VERSION_0 = 0,
+  GCC_FE_VERSION_1 = 1,
 };
 
 /* The operations defined by the GCC base API.  This is the vtable for
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index 7d7d2c1..99a0fa1 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -504,7 +504,7 @@ libcc1_destroy (struct gcc_base_context *s)
 
 static const struct gcc_base_vtable vtable =
 {
-  GCC_FE_VERSION_0,
+  GCC_FE_VERSION_1,
   libcc1_set_arguments,
   libcc1_set_source_file,
   libcc1_set_print_callback,
@@ -523,7 +523,8 @@ struct gcc_c_context *
 gcc_c_fe_context (enum gcc_base_api_version base_version,
 		  enum gcc_c_api_version c_version)
 {
-  if (base_version != GCC_FE_VERSION_0 || c_version != GCC_C_FE_VERSION_0)
+  if ((base_version != GCC_FE_VERSION_0 && base_version != GCC_FE_VERSION_1)
+      || c_version != GCC_C_FE_VERSION_0)
     return NULL;
 
   return new libcc1 (&vtable, &c_vtable);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] libcc1: set debug compile: Display GCC driver filename
  2015-04-23 20:38 ` [PATCH v2 2/4] libcc1: set debug compile: Display " Jan Kratochvil
@ 2015-04-23 20:42   ` Jan Kratochvil
  2015-04-23 21:56   ` Jeff Law
  1 sibling, 0 replies; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

On Thu, 23 Apr 2015 22:38:34 +0200, Jan Kratochvil wrote:
> Unfortunately this changes libcc1 API in an incompatible way.  There is
> a possibility of a hack to keep the API the same - one could pass "-v" option
> explicitly to set_arguments(), set_arguments() could compare the "-v" string
> and print the GCC filename accordingly.  Then the 'verbose' parameter of
> compile() would lose its meaning.  What do you think?

This paragraph is no longer true, 'compile' keeps its parameter duplicate to
the new 'set_arguments's one.


Jan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1
  2015-04-23 20:38 [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1 Jan Kratochvil
                   ` (2 preceding siblings ...)
  2015-04-23 20:38 ` [PATCH v2 2/4] libcc1: set debug compile: Display " Jan Kratochvil
@ 2015-04-23 21:54 ` Jeff Law
  3 siblings, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-23 21:54 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/23/2015 02:38 PM, Jan Kratochvil wrote:
> Hi,
>
> in mail thread
> 	https://sourceware.org/ml/gdb-patches/2015-04/msg00804.html
> the idea of breaking libcc1.so compatibility was rejected.
>
> Therefore this patch series implements full backward/forward GCC/GDB ABI
> compatibility.
>
>
> Jan
>
>
> include/ChangeLog
> 2015-04-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* gcc-interface.h (enum gcc_base_api_version): Add GCC_FE_VERSION_1.
>
> libcc1/ChangeLog
> 2015-04-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* libcc1.cc (vtable): Update to GCC_FE_VERSION_1.
> 	(gcc_c_fe_context): Accept also GCC_FE_VERSION_1.
OK.
jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] libcc1: set debug compile: Display GCC driver filename
  2015-04-23 20:38 ` [PATCH v2 2/4] libcc1: set debug compile: Display " Jan Kratochvil
  2015-04-23 20:42   ` Jan Kratochvil
@ 2015-04-23 21:56   ` Jeff Law
  1 sibling, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-23 21:56 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/23/2015 02:38 PM, Jan Kratochvil wrote:
> Hi,
>
> already approved, reposting just to keep it a part of the series:
> 	https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01301.html
>
> As discussed in
> 	How to use compile & execute function in GDB
> 	https://sourceware.org/ml/gdb/2015-04/msg00026.html
>
> GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but it does not
> display which one.  It cannot, GCC method set_arguments() does not yet know
> whether 'set debug compile' is enabled or not.
>
> Unfortunately this changes libcc1 API in an incompatible way.  There is
> a possibility of a hack to keep the API the same - one could pass "-v" option
> explicitly to set_arguments(), set_arguments() could compare the "-v" string
> and print the GCC filename accordingly.  Then the 'verbose' parameter of
> compile() would lose its meaning.  What do you think?
>
> GDB counterpart:
> 	[PATCH v2 1/2] compile: set debug compile: Display GCC driver filename
> 	https://sourceware.org/ml/gdb-patches/2015-04/msg00909.html
> 	Message-ID: <20150423203402.23140.92757.stgit@host1.jankratochvil.net>
>
>
> Jan
>
>
> include/ChangeLog
> 2015-04-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* gcc-interface.h (enum gcc_base_api_version): Add comment to
> 	GCC_FE_VERSION_1.
> 	(struct gcc_base_vtable): Rename set_arguments to set_arguments_v0.
> 	Update comment for compile.  New method set_arguments.
>
> libcc1/ChangeLog
> 2015-04-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* libcc1.cc: Include intl.h.
> 	(struct libcc1): Add field verbose.
> 	(libcc1::libcc1): Initialize it.
> 	(libcc1_set_arguments): Add parameter verbose, implement it.
> 	(libcc1_set_arguments_v0): New function.
> 	(libcc1_compile): Set parameter verbose to SELF.
> 	(vtable): Use libcc1_set_arguments_v0 and add libcc1_set_arguments.
OK.
jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 3/4] libcc1: Add 'set compile-gcc'
  2015-04-23 20:38 ` [PATCH v2 3/4] libcc1: Add 'set compile-gcc' Jan Kratochvil
@ 2015-04-23 21:57   ` Jeff Law
  2015-04-27 15:23   ` Pedro Alves
  1 sibling, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-23 21:57 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/23/2015 02:38 PM, Jan Kratochvil wrote:
> Hi,
>
> already approved, reposting just to keep it a part of the series:
> 	https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01299.html
>
> As discussed in
> 	How to use compile & execute function in GDB
> 	https://sourceware.org/ml/gdb/2015-04/msg00026.html
>
> GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but one cannot
> override which one.  GDB would provide new option 'set compile-gcc'.
>
> This patch does not change the libcc1 API as it overloads the triplet_regexp
> parameter of GCC's set_arguments according to:
>
> +  if (access (triplet_regexp, X_OK) == 0)
>
> GDB counterpart:
> 	[PATCH v2 2/2] compile: Add 'set compile-gcc'
> 	https://sourceware.org/ml/gdb-patches/2015-04/msg00910.html
> 	Message-ID: <20150423203402.23140.92757.stgit@host1.jankratochvil.net>
>
>
> Jan
>
>
> include/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* gcc-interface.h (enum gcc_base_api_version): Add comment to
> 	GCC_FE_VERSION_1.
> 	(struct gcc_base_vtable): Describe triplet_regexp parameter overload
> 	for set_arguments.
>
> libcc1/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* libcc1.cc (libcc1_set_arguments): Implement filenames for
> 	triplet_regexp.
Still OK. :-)

jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 4/4] libcc1: 'set debug compile': Display absolute GCC driver filename
  2015-04-23 20:38 ` [PATCH v2 4/4] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
@ 2015-04-23 21:57   ` Jeff Law
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-23 21:57 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/23/2015 02:38 PM, Jan Kratochvil wrote:
> Hi,
>
> already approved, maybe it could be already checked in outside of the series:
> 	https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01298.html
>
> With the patches so far after
>          (gdb) set debug compile 1
> one would get:
>          searching for compiler matching regex ^(x86_64|i.86)(-[^-]*)?-linux(-gnu)?-gcc$
>          found compiler x86_64-unknown-linux-gnu-gcc
> But I believe it is more readable to see:
>          searching for compiler matching regex ^(x86_64|i.86)(-[^-]*)?-linux(-gnu)?-gcc$
>          found compiler /usr/bin/x86_64-unknown-linux-gnu-gcc
>
> I do not think the change will have functionality impact, although the filename
> gets used even for executing the command.
>
>
> Jan
>
>
> libcc1/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* findcomp.cc: Include system.h.
> 	(search_dir): Return absolute filename.
Still OK :-)
jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 3/4] libcc1: Add 'set compile-gcc'
  2015-04-23 20:38 ` [PATCH v2 3/4] libcc1: Add 'set compile-gcc' Jan Kratochvil
  2015-04-23 21:57   ` Jeff Law
@ 2015-04-27 15:23   ` Pedro Alves
  1 sibling, 0 replies; 10+ messages in thread
From: Pedro Alves @ 2015-04-27 15:23 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/23/2015 09:38 PM, Jan Kratochvil wrote:
> -     configury triplet prefix to the compiler.
> +     configury triplet prefix to the compiler; TRIPLET_REGEXP can be
> +     also absolute filename  to the computer.

"to the computer" is probably a typo for "to the compiler".
Also, double space after "filename".

>       The arguments are copied by GCC.  ARGV need not be


Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-04-27 15:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-23 20:38 [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1 Jan Kratochvil
2015-04-23 20:38 ` [PATCH v2 3/4] libcc1: Add 'set compile-gcc' Jan Kratochvil
2015-04-23 21:57   ` Jeff Law
2015-04-27 15:23   ` Pedro Alves
2015-04-23 20:38 ` [PATCH v2 4/4] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
2015-04-23 21:57   ` Jeff Law
2015-04-23 20:38 ` [PATCH v2 2/4] libcc1: set debug compile: Display " Jan Kratochvil
2015-04-23 20:42   ` Jan Kratochvil
2015-04-23 21:56   ` Jeff Law
2015-04-23 21:54 ` [PATCH v2 1/4] libcc1: Introduce GCC_FE_VERSION_1 Jeff Law

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).