Improved error message for options after front-end filename arguments
authorClifford Wolf <clifford@clifford.at>
Wed, 4 Jun 2014 07:10:50 +0000 (09:10 +0200)
committerClifford Wolf <clifford@clifford.at>
Wed, 4 Jun 2014 07:10:50 +0000 (09:10 +0200)
frontends/verilog/verilog_frontend.cc
kernel/register.cc

index 8e9efa173defdd1165e9b8b753c407c8dad7cc6d..108214586f2d5e6342b9d2953322d1912f97c1cd 100644 (file)
@@ -48,7 +48,7 @@ struct VerilogFrontend : public Frontend {
        {
                //   |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
                log("\n");
-               log("    read_verilog [filename]\n");
+               log("    read_verilog [options] [filename]\n");
                log("\n");
                log("Load modules from a verilog file to the current design. A large subset of\n");
                log("Verilog-2005 is supported.\n");
index 5d882ab43d9ab171b30f59cbdd6a2046159fe7c9..8da5a725fe7caae5a2d3851c4346ed5f1f8292a7 100644 (file)
@@ -270,6 +270,10 @@ void Frontend::extra_args(FILE *&f, std::string &filename, std::vector<std::stri
                if (f == NULL)
                        log_cmd_error("Can't open input file `%s' for reading: %s\n", filename.c_str(), strerror(errno));
 
+               for (size_t i = argidx+1; i < args.size(); i++)
+                       if (args[i].substr(0, 1) == "-")
+                               cmd_error(args, i, "Found option, expected arguments.");
+
                if (argidx+1 < args.size()) {
                        next_args.insert(next_args.begin(), args.begin(), args.begin()+argidx);
                        next_args.insert(next_args.begin()+argidx, args.begin()+argidx+1, args.end());