public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-9238] Fix version negotiation in libcc1 plugins
@ 2024-02-29 16:07 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2024-02-29 16:07 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:54137725cfb968803be0f5fa76906839d79a3067

commit r14-9238-g54137725cfb968803be0f5fa76906839d79a3067
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Feb 22 19:36:53 2024 -0700

    Fix version negotiation in libcc1 plugins
    
    This fixes version negotiation in the libcc1 plugins.  It's done in a
    simple way: the version number from the context object is now passed
    to base_gdb_plugin.
    
    The idea behind this is that when the client (gdb) requests version N,
    the plugin should respond with the newest version that it knows of
    that is backward compatible to N.  That is, the connection can be
    upgraded.  Note that the protocol does not change much, and no
    backward incompatibilities have ever been needed.
    
    The C plugin is also changed to advertise GCC_C_FE_VERSION_1.
    
    The version negotiation approach should of course be documented, but I
    did that in a subsequent patch, in order to only have one patch
    touching the 'include' directory and thus needing a merge to
    binutils-gdb.
    
    libcc1
    
            * libcp1.cc (libcp1::libcp1): Use FE version number from context.
            * libcc1.cc (libcc1::libcc1): Use FE version number from context.
            (c_vtable): Use GCC_C_FE_VERSION_1.

Diff:
---
 libcc1/libcc1.cc | 4 ++--
 libcc1/libcp1.cc | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index 8d4ddc5ddfe..992181e8fdc 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -54,7 +54,7 @@ struct libcc1 : public cc1_plugin::base_gdb_plugin<gcc_c_context>
 libcc1::libcc1 (const gcc_c_fe_vtable *cv)
   : cc1_plugin::base_gdb_plugin<gcc_c_context> ("libcc1plugin",
 						C_COMPILER_NAME,
-						GCC_C_FE_VERSION_1)
+						cv->c_version)
 {
   c_ops = cv;
 }
@@ -108,7 +108,7 @@ set_callbacks (struct gcc_c_context *s,
 
 static const struct gcc_c_fe_vtable c_vtable =
 {
-  GCC_C_FE_VERSION_0,
+  GCC_C_FE_VERSION_1,
   set_callbacks,
 
 #define GCC_METHOD0(R, N) \
diff --git a/libcc1/libcp1.cc b/libcc1/libcp1.cc
index ec3eec2c606..cc2915d30af 100644
--- a/libcc1/libcp1.cc
+++ b/libcc1/libcp1.cc
@@ -55,7 +55,7 @@ struct libcp1 : public cc1_plugin::base_gdb_plugin<gcc_cp_context>
 libcp1::libcp1 (const gcc_cp_fe_vtable *cv)
   : cc1_plugin::base_gdb_plugin<gcc_cp_context> ("libcp1plugin",
 						 CP_COMPILER_NAME,
-						 GCC_CP_FE_VERSION_0)
+						 cv->cp_version)
 {
   cp_ops = cv;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-29 16:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29 16:07 [gcc r14-9238] Fix version negotiation in libcc1 plugins Tom Tromey

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