@@ -70,11 +70,11 @@ int main(int argc, char* argv[]) {
7070 auto srcs = result[" source" ].as <std::vector<std::string>>();
7171 if (srcs.size () > 1 ) {
7272 std::cerr << " Module can be compiled from only one source file.\n " ;
73- exit (1 );
73+ exit (func::error_codes::E_PARAMS );
7474 }
7575 if (drv.parse (srcs[0 ]) != 0 ) {
7676 std::cerr << " Failed to parse - exiting.\n " ;
77- exit (1 );
77+ exit (func::error_codes::E_SYTNTAX );
7878 }
7979 } else {
8080 exit (0 ); // No input files were given.
@@ -87,12 +87,12 @@ int main(int argc, char* argv[]) {
8787 target_arch = Arch::X64;
8888 } else {
8989 std::cerr << " Unknown architecture: " << arch_str << " \n " ;
90- exit (1 );
90+ exit (func::error_codes::E_PARAMS );
9191 }
9292
9393 } catch (const cxxopts::exceptions::exception& e) {
9494 std::cerr << " Error parsing options: " << e.what () << ' \n ' ;
95- exit (1 );
95+ exit (func::error_codes::E_PARAMS );
9696 }
9797
9898 func::print_visitor print_visitor{ std::cout };
@@ -132,21 +132,24 @@ int main(int argc, char* argv[]) {
132132 }
133133 default : {
134134 std::cerr << " Unsupported architecture\n " ;
135- exit (1 );
135+ exit (func::error_codes::E_PARAMS );
136136 }
137137 }
138138
139139 } catch (func::unexpected_type_exception& e) {
140140 std::cerr << " Syntax error: unexpected type " << e << " \n " ;
141- exit (1 );
141+ exit (func::error_codes::E_TYPE );
142142 } catch (func::symbol_not_found_exception& e) {
143143 std::cerr << " Syntax error: symbol not found " << e << " \n " ;
144- exit (1 );
144+ exit (func::error_codes::E_SYMBOL);
145+ } catch (func::symbol_redeclaration_exception& e) {
146+ std::cerr << " Syntax error: symbol redeclaration " << e << " \n " ;
147+ exit (func::error_codes::E_SYMBOL);
145148 } catch (func::syntax_exception& e) {
146149 std::cerr << " Syntax error: " << e << " \n " ;
147- exit (1 );
150+ exit (func::error_codes::E_SYTNTAX );
148151 } catch (func::global_syntax_exception& e) {
149152 std::cerr << " Syntax error: " << e << " \n " ;
150- exit (1 );
153+ exit (func::error_codes::E_SYTNTAX );
151154 }
152155}
0 commit comments