affeldt-aist / coq2html

An HTML documentation generator for Coq source files
GNU General Public License v2.0
1 stars 3 forks source link

refactor: :bug: :recycle: eliminate the occurrence of warnings issue #44 #46

Closed yoshihiro503 closed 1 month ago

yoshihiro503 commented 2 months ago

Eliminate the occurrence of warnings when compiling.

Before

ocamlopt -c generate_index.mli
(for i in header footer css js redirect; do \
         echo "let $i = {xxx|"; \
         cat coq2html.$i; \
         echo '|xxx}'; \
         done) > resources.ml
ocamllex coq2html.mll
ocamlopt -c resources.ml
260 states, 6890 transitions, table size 29120 bytes
14060 additional bytes used for bindings
ocamlopt -c generate_index.ml
ocamlopt -c coq2html.ml
File "coq2html.mll", line 172, characters 6-39:
Warning 5 [ignored-partial-application]: this function application is partial,
maybe some arguments are missing.
File "generate_index.ml", lines 221-233, characters 17-38:
221 | .................function
222 |     | [] -> []
223 |     | [single_name] :: rest ->
224 |        File single_name :: iter rest
225 |     | (dir_name :: path) :: rest ->
...
230 |          (path :: List.map List.tl brothers)
231 |          |> iter
232 |        in
233 |        Dir (dir_name, fs) :: iter rest
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
[]::_
File "coq2html.mll", line 445, characters 39-40:
Warning 26 [unused-var]: unused variable s.
File "coq2html.mll", line 452, characters 63-64:
Warning 26 [unused-var]: unused variable s.
File "coq2html.mll", line 458, characters 64-65:
Warning 26 [unused-var]: unused variable s.
File "coq2html.mll", line 591, characters 34-35:
Warning 26 [unused-var]: unused variable s.

After

ocamlopt -c generate_index.mli
(for i in header footer css js redirect; do \
         echo "let $i = {xxx|"; \
         cat coq2html.$i; \
         echo '|xxx}'; \
         done) > resources.ml
ocamlopt -c resources.ml
ocamlopt -c generate_index.ml
ocamllex coq2html.mll
260 states, 6890 transitions, table size 29120 bytes
14157 additional bytes used for bindings
ocamlopt -c coq2html.ml
ocamlopt -o coq2html str.cmxa resources.cmx generate_index.cmx coq2html.cmx
rm coq2html.ml

Issue