From: Andrew Burgess Date: Thu, 11 Apr 2019 22:51:48 +0000 (+0100) Subject: gdb: Remove LANG_MAGIC X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62253a61473764b0d084b01eff06a93fb38bb2e3;p=binutils-gdb.git gdb: Remove LANG_MAGIC The language_defn structure has an la_magic field, this used to be used as a basic check that the language_defn structure had the expected layout - at least the end of the structure was where we expected it to be. This feature only really makes sense if we imagine GDB dynamically loading language support from dynamic libraries, where a version mismatch might cause problems. However, in current GDB language support is statically built into GDB, and since this commit: commit 47e77640be31fc1a4eb3718f594ed5fd0faff065 Date: Thu Jul 20 18:28:01 2017 +0100 Make language_def O(1) the existing (if pointless) check of the la_magic field was removed. There now appears to be no use of the la_magic field, and I propose that we delete it. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_defn): Remove use of LANG_MAGIC. * c-lang.c (c_language_defn): Likewise. (cplus_language_defn): Likewise. (asm_language_defn): Likewise. (minimal_language_defn): Likewise. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Likewise. * go-lang.c (go_language_defn): Likewise. * language.c (unknown_language_defn): Likewise. (auto_language_defn): Likewise. * language.h (struct language_defn): Remove la_magic field. (LANG_MAGIC): Delete. * m2-lang.c (m2_language_defn): Remove use of LANG_MAGIC. * objc-lang.c (objc_language_defn): Likewise. * opencl-lang.c (opencl_language_defn): Likewise. * p-lang.c (pascal_language_defn): Likewise. * rust-lang.c (rust_language_defn): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 92a286b5463..33bcef307e8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2019-04-12 Andrew Burgess + + * ada-lang.c (ada_language_defn): Remove use of LANG_MAGIC. + * c-lang.c (c_language_defn): Likewise. + (cplus_language_defn): Likewise. + (asm_language_defn): Likewise. + (minimal_language_defn): Likewise. + * d-lang.c (d_language_defn): Likewise. + * f-lang.c (f_language_defn): Likewise. + * go-lang.c (go_language_defn): Likewise. + * language.c (unknown_language_defn): Likewise. + (auto_language_defn): Likewise. + * language.h (struct language_defn): Remove la_magic field. + (LANG_MAGIC): Delete. + * m2-lang.c (m2_language_defn): Remove use of LANG_MAGIC. + * objc-lang.c (objc_language_defn): Likewise. + * opencl-lang.c (opencl_language_defn): Likewise. + * p-lang.c (pascal_language_defn): Likewise. + * rust-lang.c (rust_language_defn): Likewise. + 2019-04-11 Andrew Burgess * riscv-tdep.c (riscv_type_align): New function. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c141adbef3e..ccf8ed8039e 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -14380,8 +14380,7 @@ extern const struct language_defn ada_language_defn = { default_search_name_hash, &ada_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; /* Command-list for the "set/show ada" prefix command. */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 36c750204da..33506f1d1ed 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -873,8 +873,7 @@ extern const struct language_defn c_language_defn = default_search_name_hash, &c_varobj_ops, c_get_compile_context, - c_compute_program, - LANG_MAGIC + c_compute_program }; enum cplus_primitive_types { @@ -1018,8 +1017,7 @@ extern const struct language_defn cplus_language_defn = cp_search_name_hash, &cplus_varobj_ops, cplus_get_compile_context, - cplus_compute_program, - LANG_MAGIC + cplus_compute_program }; static const char *asm_extensions[] = @@ -1072,8 +1070,7 @@ extern const struct language_defn asm_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; /* The following language_defn does not represent a real language. @@ -1126,6 +1123,5 @@ extern const struct language_defn minimal_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 637e012b32e..08b638009ff 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -250,8 +250,7 @@ extern const struct language_defn d_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; /* Build all D language types for the specified architecture. */ diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 7bd119690b4..f3a806e7a6f 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -377,8 +377,7 @@ extern const struct language_defn f_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; static void * diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 5af88f805a7..f74cee4ccd8 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -611,8 +611,7 @@ extern const struct language_defn go_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; static void * diff --git a/gdb/language.c b/gdb/language.c index 435243e9eed..954e4c200f0 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -876,8 +876,7 @@ const struct language_defn unknown_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; /* These two structs define fake entries for the "local" and "auto" @@ -927,8 +926,7 @@ const struct language_defn auto_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; diff --git a/gdb/language.h b/gdb/language.h index a982e1977d2..3e0bc9d0d46 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -449,16 +449,8 @@ struct language_defn struct gdbarch *gdbarch, const struct block *expr_block, CORE_ADDR expr_pc); - - /* Add fields above this point, so the magic number is always last. */ - /* Magic number for compat checking. */ - - long la_magic; - }; -#define LANG_MAGIC 910823L - /* Pointer to the language_defn for our current language. This pointer always points to *some* valid struct; it can be used without checking it for validity. diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 1a72aba73c9..b4eb2628571 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -398,8 +398,7 @@ extern const struct language_defn m2_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; static void * diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index be1a27f0d78..1853a69e754 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -408,8 +408,7 @@ extern const struct language_defn objc_language_defn = { default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; /* diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 03699b14251..c1ea66eea39 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1086,8 +1086,7 @@ extern const struct language_defn opencl_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; static void * diff --git a/gdb/p-lang.c b/gdb/p-lang.c index b61273f356b..9340861761b 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -459,6 +459,5 @@ extern const struct language_defn pascal_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL }; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index c3857eed2a2..9a123c338ef 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -2141,6 +2141,5 @@ extern const struct language_defn rust_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL, - LANG_MAGIC + NULL };