aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/igen/ChangeLog9
-rw-r--r--sim/igen/gen-idecode.c2
-rw-r--r--sim/igen/lf.c7
-rw-r--r--sim/igen/lf.h2
4 files changed, 20 insertions, 0 deletions
diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog
index beda37b..f3f50f4 100644
--- a/sim/igen/ChangeLog
+++ b/sim/igen/ChangeLog
@@ -1,3 +1,12 @@
+2020-07-03 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ PR sim/26194
+ * lf.h (lf_get_file_type): Declare.
+ * lf.c (lf_get_file_type): Define.
+ * gen-idecode.c (print_idecode_issue_function_header): Use
+ lf_get_file_type() to issue an extern variable declaration in
+ case of header files.
+
2019-12-19 Tom Tromey <tromey@adacore.com>
PR build/24572:
diff --git a/sim/igen/gen-idecode.c b/sim/igen/gen-idecode.c
index b8f8ca1..741498a 100644
--- a/sim/igen/gen-idecode.c
+++ b/sim/igen/gen-idecode.c
@@ -930,6 +930,8 @@ print_idecode_issue_function_header (lf *file,
"INLINE_IDECODE", "\n");
break;
case is_function_variable:
+ if (lf_get_file_type (file) == lf_is_h)
+ lf_printf (file, "extern ");
print_semantic_function_type (file);
lf_printf (file, " (*");
break;
diff --git a/sim/igen/lf.c b/sim/igen/lf.c
index 0f377d4..937e3d9 100644
--- a/sim/igen/lf.c
+++ b/sim/igen/lf.c
@@ -86,6 +86,13 @@ lf_open (char *name,
}
+lf_file_type
+lf_get_file_type (const lf *file)
+{
+ return file->type;
+}
+
+
void
lf_close (lf *file)
{
diff --git a/sim/igen/lf.h b/sim/igen/lf.h
index 54b4dcd..6d86fac 100644
--- a/sim/igen/lf.h
+++ b/sim/igen/lf.h
@@ -54,6 +54,8 @@ extern lf *lf_open
lf_file_references file_references,
lf_file_type type, const char *program);
+extern lf_file_type lf_get_file_type (const lf *file);
+
extern void lf_close (lf *file);