gdb: Remove LANG_MAGIC
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 11 Apr 2019 22:51:48 +0000 (23:51 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 12 Apr 2019 08:28:16 +0000 (09:28 +0100)
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.

13 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/c-lang.c
gdb/d-lang.c
gdb/f-lang.c
gdb/go-lang.c
gdb/language.c
gdb/language.h
gdb/m2-lang.c
gdb/objc-lang.c
gdb/opencl-lang.c
gdb/p-lang.c
gdb/rust-lang.c

index 92a286b54635b7c8b8baefbe666a6ee9ee507b4a..33bcef307e83d63916385677541e59afcca3c590 100644 (file)
@@ -1,3 +1,23 @@
+2019-04-12  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * 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  <andrew.burgess@embecosm.com>
 
        * riscv-tdep.c (riscv_type_align): New function.
index c141adbef3e636a7a106a87c89ebd66e42ee5553..ccf8ed8039e93459a249cc3710424f2322b6ec5b 100644 (file)
@@ -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.  */
index 36c750204dab3b1da0c5a0112377bcdd8760ada0..33506f1d1ed14518fad7bee6d163d240c885385f 100644 (file)
@@ -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
 };
index 637e012b32e76c6213e519849fcaa27f673d692a..08b638009ff06de4c40dad71bfffb1745e28652e 100644 (file)
@@ -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.  */
index 7bd119690b4049d2716eb825f2b14367be587b7d..f3a806e7a6f68fa015545c51fcd613b9eaadfda2 100644 (file)
@@ -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 *
index 5af88f805a782828a05d7aacbca34548f0bf65fb..f74cee4ccd8b0e16cc54f453fb903f9aa8f2ae54 100644 (file)
@@ -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 *
index 435243e9eed96949b4b9c68dfbc59b62e4c6cdeb..954e4c200f09fa5abc13f324d1e6327f77735a64 100644 (file)
@@ -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
 };
 
 \f
index a982e1977d2a5998fe67796967eaf9f5bfaea464..3e0bc9d0d462f1b223eee4a2496a389b584dc17a 100644 (file)
@@ -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.
index 1a72aba73c97093c32b2d03c60249d81d1919a9d..b4eb2628571e4ea69b320167602f3a764590c231 100644 (file)
@@ -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 *
index be1a27f0d78bed5a255c3847c8738e67871c01d6..1853a69e7542eb4c87c0cfdcdad1f943c0dad355 100644 (file)
@@ -408,8 +408,7 @@ extern const struct language_defn objc_language_defn = {
   default_search_name_hash,
   &default_varobj_ops,
   NULL,
-  NULL,
-  LANG_MAGIC
+  NULL
 };
 
 /*
index 03699b1425166f9a2c74a771d7f837c28c69e4c3..c1ea66eea3924a9c71d38ae9fea36e1da0e75c91 100644 (file)
@@ -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 *
index b61273f356b705fd34ac4443a6e8ef8a1a515025..9340861761b36bd14610c28bc96ff1e61a064c83 100644 (file)
@@ -459,6 +459,5 @@ extern const struct language_defn pascal_language_defn =
   default_search_name_hash,
   &default_varobj_ops,
   NULL,
-  NULL,
-  LANG_MAGIC
+  NULL
 };
index c3857eed2a2e140166f11b20c494949644541c5f..9a123c338ef5c1a6e4a22ad3a5d5c84fd88394bc 100644 (file)
@@ -2141,6 +2141,5 @@ extern const struct language_defn rust_language_defn =
   default_search_name_hash,
   &default_varobj_ops,
   NULL,
-  NULL,
-  LANG_MAGIC
+  NULL
 };