aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-05-26 10:33:28 -0600
committerTom Tromey <tom@tromey.com>2016-06-23 21:11:47 -0600
commit56618e20bc50e55b49ed224df2a2a7e0840056fe (patch)
tree2d6ce4327fa617f2524ac99e77eac4cb4a62f71b /gdb/c-lang.c
parent3fcf0b0d5a8cf04da4b4210121e7276ca1f20101 (diff)
downloadgdb-56618e20bc50e55b49ed224df2a2a7e0840056fe.zip
gdb-56618e20bc50e55b49ed224df2a2a7e0840056fe.tar.gz
gdb-56618e20bc50e55b49ed224df2a2a7e0840056fe.tar.bz2
Move filename extensions into language_defn
This moves filename extensions from a function in symfile.c out to each language_defn. I think this is an improvement because it means less digging around when writing a new language port. 2016-06-23 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_extensions): New array. (ada_language_defn): Use it. * c-lang.c (c_extensions): New array. (c_language_defn): Use it. (cplus_extensions): New array. (cplus_language_defn): Use it. (asm_extensions): New array. (asm_language_defn): Use it. (minimal_language_defn): Update. * d-lang.c (d_extensions): New array. (d_language_defn): Use it. * f-lang.c (f_extensions): New array. (f_language_defn): Use it. * go-lang.c (go_language_defn): Update. * jv-lang.c (java_extensions): New array. (java_language_defn): Use it. * language.c (add_language): Call add_filename_language. (unknown_language_defn, auto_language_defn, local_language_defn): Update. * language.h (struct language_defn) <la_filename_extensions>: New field. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_extensions): New array. (objc_language_defn): Use it. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (p_extensions): New array. (pascal_language_defn): Use it. * rust-lang.c (rust_extensions): New array. (rust_language_defn): Use it. * symfile.c (add_filename_language): No longer static. Make "ext" const. (init_filename_language_table): Remove. (_initialize_symfile): Update. * symfile.h (add_filename_language): Declare.
Diffstat (limited to 'gdb/c-lang.c')
-rw-r--r--gdb/c-lang.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 8192e97..9ccb87f 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -824,6 +824,11 @@ const struct exp_descriptor exp_descriptor_c =
evaluate_subexp_c
};
+static const char *c_extensions[] =
+{
+ ".c", NULL
+};
+
const struct language_defn c_language_defn =
{
"c", /* Language name */
@@ -833,6 +838,7 @@ const struct language_defn c_language_defn =
case_sensitive_on,
array_row_major,
macro_expansion_c,
+ c_extensions,
&exp_descriptor_c,
c_parse,
c_yyerror,
@@ -951,6 +957,11 @@ cplus_language_arch_info (struct gdbarch *gdbarch,
lai->bool_type_default = builtin->builtin_bool;
}
+static const char *cplus_extensions[] =
+{
+ ".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", NULL
+};
+
const struct language_defn cplus_language_defn =
{
"c++", /* Language name */
@@ -960,6 +971,7 @@ const struct language_defn cplus_language_defn =
case_sensitive_on,
array_row_major,
macro_expansion_c,
+ cplus_extensions,
&exp_descriptor_c,
c_parse,
c_yyerror,
@@ -996,6 +1008,11 @@ const struct language_defn cplus_language_defn =
LANG_MAGIC
};
+static const char *asm_extensions[] =
+{
+ ".s", ".sx", ".S", NULL
+};
+
const struct language_defn asm_language_defn =
{
"asm", /* Language name */
@@ -1005,6 +1022,7 @@ const struct language_defn asm_language_defn =
case_sensitive_on,
array_row_major,
macro_expansion_c,
+ asm_extensions,
&exp_descriptor_c,
c_parse,
c_yyerror,
@@ -1055,6 +1073,7 @@ const struct language_defn minimal_language_defn =
case_sensitive_on,
array_row_major,
macro_expansion_c,
+ NULL,
&exp_descriptor_c,
c_parse,
c_yyerror,