From 234f73e7bf057ed8519382fda6dfeb371d8a6d48 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Wed, 4 Jun 2008 21:03:36 +0100 Subject: [PATCH] Don't generate any output if there were errors --- tgt-vhdl/vhdl.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tgt-vhdl/vhdl.cc b/tgt-vhdl/vhdl.cc index d060f979d..fb4009e49 100644 --- a/tgt-vhdl/vhdl.cc +++ b/tgt-vhdl/vhdl.cc @@ -85,16 +85,19 @@ extern "C" int target_design(ivl_design_t des) ivl_design_process(des, draw_process, NULL); // Write the generated elements to the output file - const char *ofname = ivl_design_flag(des, "-o"); - std::ofstream outfile(ofname); - - for (entity_list_t::iterator it = g_entities.begin(); - it != g_entities.end(); - ++it) - (*it)->emit(outfile); + // only if there are no errors + if (0 == g_errors) { + const char *ofname = ivl_design_flag(des, "-o"); + std::ofstream outfile(ofname); + + for (entity_list_t::iterator it = g_entities.begin(); + it != g_entities.end(); + ++it) + (*it)->emit(outfile); + + outfile.close(); + } - outfile.close(); - // Clean up for (entity_list_t::iterator it = g_entities.begin(); it != g_entities.end();