summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/vital2000/memory_b.vhdl6
-rw-r--r--ortho/gcc/Makefile.inc3
-rw-r--r--ortho/gcc/ortho-lang.c102
-rw-r--r--ortho/gcc/ortho_gcc-main.adb2
-rw-r--r--ortho/gcc/ortho_gcc.ads4
-rw-r--r--ortho/gcc/ortho_ident.adb2
-rw-r--r--translate/gcc/Make-lang.in51
-rw-r--r--translate/ghdldrv/ghdlmain.adb2
-rw-r--r--translate/translation.adb2
-rw-r--r--version.ads4
10 files changed, 92 insertions, 86 deletions
diff --git a/libraries/vital2000/memory_b.vhdl b/libraries/vital2000/memory_b.vhdl
index 0376ee4..39bb38a 100644
--- a/libraries/vital2000/memory_b.vhdl
+++ b/libraries/vital2000/memory_b.vhdl
@@ -4540,7 +4540,7 @@ TYPE VitalMemoryErrorType IS (
ErrCrDatSubOut,-- 'E' Corrupting data out sub-word with 'X' based on data in
ErrImplOut, -- 'M' Implicit read from memory to data out
ErrReadOut, -- 'm' Reading data from memory to data out
- ErrAssgOut, -- 't' Transfering from data in to data out
+ ErrAssgOut, -- 't' Transferring from data in to data out
ErrAsgXOut, -- 'X' Assigning unknown level to data out
ErrAsg0Out, -- '0' Assigning low level to data out
ErrAsg1Out, -- '1' Assigning high level to data out
@@ -4672,7 +4672,7 @@ CONSTANT MsgImplOut : STRING
CONSTANT MsgReadOut : STRING
:= "Reading data from memory to data out";
CONSTANT MsgAssgOut : STRING
- := "Transfering from data in to data out";
+ := "Transferring from data in to data out";
CONSTANT MsgAsgXOut : STRING
:= "Assigning unknown level to data out";
CONSTANT MsgAsg0Out : STRING
@@ -6207,7 +6207,7 @@ BEGIN
PortFlag.DataCurrent := READ;
WHEN 't' =>
- -- Transfering from data in to data out
+ -- Transferring from data in to data out
IF (MsgOn) THEN
PrintMemoryMessage(CallerName,ErrAssgOut,HeaderMsg,PortName);
END IF;
diff --git a/ortho/gcc/Makefile.inc b/ortho/gcc/Makefile.inc
index 8b7289a..3416cf9 100644
--- a/ortho/gcc/Makefile.inc
+++ b/ortho/gcc/Makefile.inc
@@ -32,6 +32,7 @@ AGCC_LOCAL_OBJS=ortho-lang.o
AGCC_DEPS := $(AGCC_LOCAL_OBJS)
AGCC_OBJS := $(AGCC_LOCAL_OBJS) \
$(AGCC_GCCOBJ_DIR)gcc/toplev.o \
+ $(AGCC_GCCOBJ_DIR)gcc/vec.o \
$(AGCC_GCCOBJ_DIR)gcc/attribs.o \
$(AGCC_GCCOBJ_DIR)gcc/libbackend.a \
$(AGCC_GCCOBJ_DIR)libcpp/libcpp.a \
@@ -40,7 +41,7 @@ AGCC_OBJS := $(AGCC_LOCAL_OBJS) \
ortho-lang.o: $(agcc_srcdir)/ortho-lang.c \
$(AGCC_GCCOBJ_DIR)gcc/gtype-vhdl.h \
$(AGCC_GCCOBJ_DIR)gcc/gt-vhdl-ortho-lang.h
- $(CC) -c -o $@ $< $(AGCC_CFLAGS)
+ $(COMPILER) -c -o $@ $< $(AGCC_CFLAGS) $(INCLUDES)
agcc-clean: force
$(RM) -f $(agcc_objdir)/*.o
diff --git a/ortho/gcc/ortho-lang.c b/ortho/gcc/ortho-lang.c
index e8387fd..3c0dbe9 100644
--- a/ortho/gcc/ortho-lang.c
+++ b/ortho/gcc/ortho-lang.c
@@ -187,19 +187,26 @@ pop_binding (void)
}
/* This is a stack of current statement_lists */
-static GTY(()) VEC_tree_gc * stmt_list_stack;
+//static GTY(()) VEC_tree_gc * stmt_list_stack;
+
+// naive conversion to new vec API following the wiki at
+// http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec
+// see also push_stmts, pop_stmts
+static vec <tree> stmt_list_stack = vec<tree>();
static void
push_stmts (tree stmts)
{
- VEC_safe_push (tree, gc, stmt_list_stack, cur_stmts);
+// VEC_safe_push (tree, gc, stmt_list_stack, cur_stmts);
+ stmt_list_stack.safe_push(cur_stmts);
cur_stmts = stmts;
}
static void
pop_stmts (void)
{
- cur_stmts = VEC_pop (tree, stmt_list_stack);
+// cur_stmts = VEC_pop (tree, stmt_list_stack);
+cur_stmts = stmt_list_stack.pop();
}
static void
@@ -214,7 +221,7 @@ append_stmt (tree stmt)
static GTY(()) tree top;
static GTY(()) tree stack_alloc_function_ptr;
-extern void ortho_fe_init (void);
+extern "C" void ortho_fe_init (void);
static bool
global_bindings_p (void)
@@ -232,7 +239,7 @@ static tree
builtin_function (const char *name,
tree type,
int function_code,
- enum built_in_class class,
+ enum built_in_class decl_class,
const char *library_name,
tree attrs ATTRIBUTE_UNUSED);
@@ -341,7 +348,7 @@ ortho_post_options (const char **pfilename)
return false;
}
-extern bool lang_handle_option (const char *opt, const char *arg);
+extern "C" bool lang_handle_option (const char *opt, const char *arg);
static bool
ortho_handle_option (size_t code, const char *arg, int value, int kind,
@@ -370,7 +377,7 @@ ortho_handle_option (size_t code, const char *arg, int value, int kind,
len1 = strlen (opt);
len2 = strlen (arg);
- nopt = alloca (len1 + len2 + 1);
+ nopt = (char *) alloca (len1 + len2 + 1);
memcpy (nopt, opt, len1);
memcpy (nopt + len1, arg, len2);
nopt[len1 + len2] = 0;
@@ -380,7 +387,7 @@ ortho_handle_option (size_t code, const char *arg, int value, int kind,
}
}
-extern int lang_parse_file (const char *filename);
+extern "C" int lang_parse_file (const char *filename);
static void
ortho_parse_file (void)
@@ -584,7 +591,7 @@ static tree
builtin_function (const char *name,
tree type,
int function_code,
- enum built_in_class class,
+ enum built_in_class decl_class,
const char *library_name,
tree attrs ATTRIBUTE_UNUSED)
{
@@ -595,8 +602,8 @@ builtin_function (const char *name,
if (library_name)
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
make_decl_rtl (decl);
- DECL_BUILT_IN_CLASS (decl) = class;
- DECL_FUNCTION_CODE (decl) = function_code;
+ DECL_BUILT_IN_CLASS (decl) = decl_class;
+ DECL_FUNCTION_CODE (decl) = (built_in_function) function_code;
DECL_SOURCE_LOCATION (decl) = input_location;
return decl;
}
@@ -709,6 +716,10 @@ struct GTY(()) language_function
char dummy;
};
+
+extern "C" {
+
+
struct GTY(()) chain_constr_type
{
tree first;
@@ -1202,6 +1213,8 @@ void
start_enum_type (struct o_enum_list *list, int size)
{
list->res = make_node (ENUMERAL_TYPE);
+ // as of gcc4.8, TYPE_PRECISION of 0 is rigorously enforced!
+ TYPE_PRECISION(list->res) = size;
chain_init (&list->chain);
list->num = 0;
list->size = size;
@@ -1210,7 +1223,7 @@ start_enum_type (struct o_enum_list *list, int size)
void
new_enum_literal (struct o_enum_list *list, tree ident, tree *res)
{
- *res = build_int_cstu (list->res, list->num);
+ *res = build_int_cstu (list->res, HOST_WIDE_INT(list->num));
chain_append (&list->chain, tree_cons (ident, *res, NULL_TREE));
list->num++;
}
@@ -1233,7 +1246,8 @@ struct GTY(()) o_record_aggr_list
/* Type of the next field to be added. */
tree field;
/* Vector of elements. */
- VEC(constructor_elt,gc) *elts;
+ // VEC(constructor_elt,gc) *elts;
+ vec<constructor_elt,va_gc> *elts;
};
void
@@ -1241,8 +1255,8 @@ start_record_aggr (struct o_record_aggr_list *list, tree atype)
{
list->atype = atype;
list->field = TYPE_FIELDS (atype);
- list->elts = VEC_alloc (constructor_elt, gc, fields_length (atype));
-
+ //list->elts = VEC_alloc (constructor_elt, gc, fields_length (atype));
+ vec_alloc(list->elts, fields_length (atype));
}
void
@@ -1263,7 +1277,8 @@ struct GTY(()) o_array_aggr_list
{
tree atype;
/* Vector of elements. */
- VEC(constructor_elt,gc) *elts;
+ //VEC(constructor_elt,gc) *elts;
+ vec<constructor_elt,va_gc> *elts;
};
void
@@ -1279,7 +1294,8 @@ start_array_aggr (struct o_array_aggr_list *list, tree atype)
gcc_assert (nelts != NULL_TREE && host_integerp (nelts, 1));
n = tree_low_cst (nelts, 1) + 1;
- list->elts = VEC_alloc (constructor_elt, gc, n);
+ //list->elts = VEC_alloc (constructor_elt, gc, n);
+ vec_alloc(list->elts, n);
}
void
@@ -1847,20 +1863,22 @@ finish_declare_stmt (void)
struct GTY(()) o_assoc_list
{
tree subprg;
- VEC(tree,gc) *vec;
+// VEC(tree,gc) *vec;
+ vec<tree, va_gc> *vecptr;
};
void
start_association (struct o_assoc_list *assocs, tree subprg)
{
assocs->subprg = subprg;
- assocs->vec = NULL;
+ assocs->vecptr = NULL;
}
void
new_association (struct o_assoc_list *assocs, tree val)
{
- VEC_safe_push (tree, gc, assocs->vec, val);
+// VEC_safe_push (tree, gc, assocs->vec, val);
+ vec_safe_push(assocs->vecptr, val);
}
tree
@@ -1868,7 +1886,7 @@ new_function_call (struct o_assoc_list *assocs)
{
return build_call_vec (TREE_TYPE (TREE_TYPE (assocs->subprg)),
build_function_ptr (assocs->subprg),
- assocs->vec);
+ assocs->vecptr);
}
void
@@ -1878,7 +1896,7 @@ new_procedure_call (struct o_assoc_list *assocs)
res = build_call_vec (TREE_TYPE (TREE_TYPE (assocs->subprg)),
build_function_ptr (assocs->subprg),
- assocs->vec);
+ assocs->vecptr);
TREE_SIDE_EFFECTS (res) = 1;
append_stmt (res);
}
@@ -2043,16 +2061,24 @@ struct GTY(()) o_case_block
int add_break;
};
+
+static GTY(()) tree t_condtype;
+
void
start_case_stmt (struct o_case_block *block, tree value)
{
tree stmt;
tree stmts;
+// following https://bitbucket.org/goshawk/gdc/issue/344/compilation-with-latest-trunk-fails
+// gimplify_switch_expr now checks type of index expr is (some discrete type) but at least not void
+// Saved in static variable for start_choice to use
+ t_condtype = TREE_TYPE(value);
+
block->end_label = build_label ();
block->add_break = 0;
stmts = alloc_stmt_list ();
- stmt = build3 (SWITCH_EXPR, void_type_node, value, stmts, NULL_TREE);
+ stmt = build3 (SWITCH_EXPR, t_condtype, value, stmts, NULL_TREE);
append_stmt (stmt);
push_stmts (stmts);
}
@@ -2061,10 +2087,11 @@ void
start_choice (struct o_case_block *block)
{
tree stmt;
-
if (block->add_break)
{
- stmt = build1 (GOTO_EXPR, void_type_node, block->end_label);
+// following https://bitbucket.org/goshawk/gdc/issue/344/compilation-with-latest-trunk-fails
+// gimplify_switch_expr now checks type of index expr is (saved) t_condtype
+ stmt = build1 (GOTO_EXPR, t_condtype, block->end_label);
append_stmt (stmt);
block->add_break = 0;
@@ -2075,7 +2102,7 @@ void
new_expr_choice (struct o_case_block *block, tree expr)
{
tree stmt;
-
+
stmt = build_case_label
(expr, NULL_TREE, create_artificial_label (input_location));
append_stmt (stmt);
@@ -2115,6 +2142,8 @@ finish_case_stmt (struct o_case_block *block)
pop_stmts ();
stmt = build1 (LABEL_EXPR, void_type_node, block->end_label);
append_stmt (stmt);
+
+ t_condtype = NULL_TREE;
}
bool
@@ -2135,6 +2164,27 @@ get_identifier_string (tree id, const char **str, int *len)
*str = IDENTIFIER_POINTER (id);
}
+// C linkage wrappers for two (now C++) functions so that
+// Ada code can call them without name mangling
+tree get_identifier_with_length_c (const char *c, size_t s)
+{
+ return get_identifier_with_length(c, s);
+}
+
+int toplev_main_c (int argc, char **argv)
+{
+ return toplev_main(argc, argv);
+}
+
+void
+debug_tree_c ( tree expr)
+{
+ warning(OPT_Wall,"Debug tree");
+ debug_tree(expr);
+}
+
+} // end extern "C"
+
#include "debug.h"
#include "gt-vhdl-ortho-lang.h"
#include "gtype-vhdl.h"
diff --git a/ortho/gcc/ortho_gcc-main.adb b/ortho/gcc/ortho_gcc-main.adb
index 96b89e6..92eaf6c 100644
--- a/ortho/gcc/ortho_gcc-main.adb
+++ b/ortho/gcc/ortho_gcc-main.adb
@@ -12,7 +12,7 @@ is
function Toplev_Main (Argc : Integer; Argv : System.Address)
return Integer;
- pragma Import (C, Toplev_Main);
+ pragma Import (C, Toplev_Main, "toplev_main_c");
Status : Exit_Status;
begin
diff --git a/ortho/gcc/ortho_gcc.ads b/ortho/gcc/ortho_gcc.ads
index 9b53568..9ec38cd 100644
--- a/ortho/gcc/ortho_gcc.ads
+++ b/ortho/gcc/ortho_gcc.ads
@@ -422,6 +422,7 @@ package Ortho_Gcc is
procedure New_Default_Choice (Block : in out O_Case_Block);
procedure Finish_Choice (Block : in out O_Case_Block);
procedure Finish_Case_Stmt (Block : in out O_Case_Block);
+ procedure Debug_Tree_C(Expr : O_Cnode);
private
subtype Tree is System.Address;
@@ -657,4 +658,7 @@ private
pragma Import (C, New_Default_Choice);
pragma Import (C, Finish_Choice);
pragma Import (C, Finish_Case_Stmt);
+
+ pragma Import (C, Debug_Tree_C);
+
end Ortho_Gcc;
diff --git a/ortho/gcc/ortho_ident.adb b/ortho/gcc/ortho_ident.adb
index 1fac9ab..5ff0939 100644
--- a/ortho/gcc/ortho_ident.adb
+++ b/ortho/gcc/ortho_ident.adb
@@ -1,7 +1,7 @@
package body Ortho_Ident is
function Get_Identifier_With_Length (Str : Address; Size : Integer)
return O_Ident;
- pragma Import (C, Get_Identifier_With_Length);
+ pragma Import (C, Get_Identifier_With_Length, "get_identifier_with_length_c");
function Compare_Identifier_String
(Id : O_Ident; Str : Address; Size : Integer)
diff --git a/translate/gcc/Make-lang.in b/translate/gcc/Make-lang.in
index 9c74b4e..5a0b2a5 100644
--- a/translate/gcc/Make-lang.in
+++ b/translate/gcc/Make-lang.in
@@ -69,55 +69,6 @@ AGCC_GCCSRC_DIR=$(srcdir)/..
AGCC_GCCOBJ_DIR=../
####gcc Makefile.inc
-# -*- Makefile -*- for the gcc implemantation of ortho.
-# Copyright (C) 2005 Tristan Gingold
-#
-# GHDL is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 2, or (at your option) any later
-# version.
-#
-# GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING. If not, write to the Free
-# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# Variable used:
-# AGCC_GCCSRC_DIR: the gcc source base directory (ie gcc-X.Y.Z-objs/)
-# AGCC_GCCOBJ_DIR: the gcc objects base directory
-# agcc_srcdir: the agcc source directory
-# agcc_objdir: the agcc object directory
-
-AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \
- -I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \
- -I$(AGCC_GCCSRC_DIR)/libcpp/include
-AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS)
-
-AGCC_LOCAL_OBJS=ortho-lang.o
-
-AGCC_DEPS := $(AGCC_LOCAL_OBJS)
-AGCC_OBJS := $(AGCC_LOCAL_OBJS) $(AGCC_GCCOBJ_DIR)gcc/attribs.o
-# $(AGCC_GCCOBJ_DIR)gcc/toplev.o
-
-ortho-lang.o: $(agcc_srcdir)/ortho-lang.c \
- $(AGCC_GCCOBJ_DIR)gcc/gtype-vhdl.h \
- $(AGCC_GCCOBJ_DIR)gcc/gt-vhdl-ortho-lang.h
- $(CC) -c -o $@ $< $(AGCC_CFLAGS)
-
-agcc-clean: force
- $(RM) -f $(agcc_objdir)/*.o
- $(RM) -f $(agcc_srcdir)/*~
-
-agcc-maintainer-clean: force
- $(RM) -f $(AGCC_DEPS)
-
-
-.PHONY: agcc-clean agcc-maintainer-clean
# The compiler proper.
# It is compiled into the vhdl/ subdirectory to avoid file name clashes but
@@ -129,7 +80,7 @@ ghdl1$(exeext): $(AGCC_OBJS) $(AGCC_DEPS) force $(BACKEND) $(LIBDEPS)
$(GNATMAKE) -o $@ -aI$(srcdir)/vhdl -aOvhdl ortho_gcc-main \
-bargs -E -cargs $(CFLAGS) $(GHDL_ADAFLAGS) \
-largs $(AGCC_OBJS) $(filter-out main.o,$(BACKEND)) \
- $(LIBS) $(BACKENDLIBS)
+ $(LIBS) $(BACKENDLIBS) -lstdc++
# The driver for ghdl.
ghdl$(exeext): force
diff --git a/translate/ghdldrv/ghdlmain.adb b/translate/ghdldrv/ghdlmain.adb
index b34c07f..a9bc00b 100644
--- a/translate/ghdldrv/ghdlmain.adb
+++ b/translate/ghdldrv/ghdlmain.adb
@@ -132,7 +132,7 @@ package body Ghdlmain is
end loop;
New_Line;
Put_Line ("To display the options of a GHDL program,");
- Put_Line (" run your programm with the --help option.");
+ Put_Line (" run your program with the --help option.");
Put_Line ("Also see --options-help for analyzer options.");
New_Line;
Put_Line ("Please, refer to the GHDL manual for more information.");
diff --git a/translate/translation.adb b/translate/translation.adb
index d529076..88ac566 100644
--- a/translate/translation.adb
+++ b/translate/translation.adb
@@ -13876,7 +13876,7 @@ package body Translation is
* Iir_Fp64 (Get_Value (Get_Physical_Unit_Value
(Get_Unit_Name (Expr))))));
when others =>
- Error_Kind ("tranlate_numeric_literal", Expr);
+ Error_Kind ("translate_numeric_literal", Expr);
end case;
exception
when Constraint_Error =>
diff --git a/version.ads b/version.ads
index 2bf3d76..ca5a10a 100644
--- a/version.ads
+++ b/version.ads
@@ -1,5 +1,5 @@
package Version is
Ghdl_Release : constant String :=
- "GHDL 0.30dev (20100112) [Sokcho edition]";
- Ghdl_Ver : constant String := "0.30dev";
+ "GHDL 0.31dev (20132311) [Dunoon edition]";
+ Ghdl_Ver : constant String := "0.31dev";
end Version;