ocamlbuild does not warn for bad input #5212
Original bug ID: 5212
I saw a parser example in the Genlex module. It took me HOURS to compile a similar example in ocamlbuild! This tool is fantastic for meany reasons, but is a bit weak for useability. Hopefully that can be improved, with better messaging :
(1) "ocamlbuild -tags camlp4 example.byte" does not work, but it does not tell that the camlp4 tag is not recognised or not usefull
(2) "ocamlbuild -tags pp example.byte" explains that pp waits for an argument, which is good, but :
(3) "ocamlbuild -tags pp(camlp4o) example.byte" gives the error "bash: syntax error near unexpected token `('" which is not clear that it comes from ocamlbuild. a line such as "ocamlbuild tag : bash : syntax error near unexpected token '('" would be better
(4) "echo "example.ml:pp(camlp4o)" > _tags ; ocamlbuild example.byte" gives the error "Failure: lexing: empty token." where it is not clear that it comes from the _tags file, ant that it is due to ocamlbuild. One could think it comes from camlp4. A better localisation of the error would be appreciated. Example : "File _tags, line 1, character 0-10 : bad syntax"
(5) "echo "<example.ml>:pp(camlp4o)" > _tags ; ocamlbuild example.byte" enventually works. But why the "-tags pp(camlp4o)" option refuses it? It is not clear at all what to put on the tags option and what to put in the _tags file. At least, every line such as "true : pp(camlp4o)" should be equivalent to "-tags pp(camlp4o)" ?
file example.ml :
The text was updated successfully, but these errors were encountered:
Comment author: @ygrek
This error is reported by your shell, not ocamlbuild, see
Comment author: @ygrek
One can see the list of available tags with 'ocamlbuild -documentation', but warning about not-used tags makes sense indeed.
With the attached patch (one for 3.11 and another for 3.12 branch) it becomes :
File "_tags", line 1, column 0:
Comment author: @gasche
Let me (try to) summarize the state of this bug report:
(1) is a ambitious demand that tags that were detected to be "useless"
(3) is a bash error that cannot be solved
The error message for (2) should probably mention the problem with
(4) was solved by ygrek
(5) is equivalent to (3): one should use -tags "pp(camlp4o)", with quotes
(1) is definitely delayed to 4.02+dev. If there is a volunteer to