facebookarchive / pfff

Tools for code analysis, visualizations, or style-preserving source transformation.
http://github.com/facebook/pfff/wiki/Main
Other
2.44k stars 204 forks source link

zlibstubs.c:171:33: error: use of undeclared identifier 'uint32' #142

Closed akras-apixio closed 8 years ago

akras-apixio commented 8 years ago

I've followed all instructions from https://github.com/facebook/pfff/blob/master/install_macos.txt on OS X El Capitan Version 10.11.5. Getting the following error when running make.

$: make
/Applications/Xcode.app/Contents/Developer/usr/bin/make rec
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C commons
make[2]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make all -C external/ocamlgraph && /Applications/Xcode.app/Contents/Developer/usr/bin/make -C commons/graph
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make all -C external/ocamlgtk && /Applications/Xcode.app/Contents/Developer/usr/bin/make gui -C commons
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src all
make[3]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make INCLUDESEXTRA="-I ../external/ocamlgtk/src" commons_gui.cma
make[3]: `commons_gui.cma' is up to date.
/Applications/Xcode.app/Contents/Developer/usr/bin/make features -C commons
make[2]: Nothing to be done for `features'.
set -e; for i in commons commons/graph external/jsonwheel external/ocamlgraph external/ocamlgtk external/ocamlcairo external/ocamlzip external/extlib external/ptrees external/javalib/src globals h_version-control h_visualization h_files-format h_program-lang graph_code h_program-visual matcher lang_ml/parsing lang_ml/analyze  lang_nw/parsing lang_nw/analyze lang_lisp/parsing lang_lisp/analyze lang_haskell/parsing lang_haskell/analyze lang_php/parsing lang_php/matcher lang_php/pretty lang_sql/parsing lang_js/parsing lang_js/analyze lang_cpp/parsing lang_cpp/analyze lang_c/parsing lang_c/analyze lang_clang/parsing lang_clang/analyze lang_java/parsing lang_java/analyze lang_bytecode/parsing lang_bytecode/analyze lang_python/parsing lang_python/analyze lang_csharp/parsing lang_csharp/analyze lang_rust/parsing lang_rust/analyze lang_opa/parsing lang_opa/analyze lang_erlang/parsing lang_erlang/analyze lang_php/analyze lang_php/analyze/foundation lang_php/analyze/checker lang_php/analyze/tools lang_php/analyze/qa_test lang_html/parsing lang_html/analyze lang_css/parsing lang_web/parsing lang_text mini code_map code_graph demos; do /Applications/Xcode.app/Contents/Developer/usr/bin/make -C $i all || exit 1; done
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src all
make[3]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src all
make[3]: Nothing to be done for `all'.
ocamlc -g -c -ccopt -g -ccopt -I/usr/local/include -ccopt -I/usr/local/lib/ocaml zlibstubs.c
zlibstubs.c:171:33: error: use of undeclared identifier 'uint32'
  return caml_copy_int32(crc32((uint32) Int32_val(crc),
                                ^
1 error generated.
make[2]: *** [zlibstubs.o] Error 2
make[1]: *** [rec] Error 1
make: *** [all] Error 2
tychota commented 8 years ago

I can confirm that this error occurs.

tychota commented 8 years ago

I had to patch a bunch to make it compile:

diff --git a/code_map/Visual.tex.nw b/code_map/Visual.tex.nw
index 804c787..ae90ba3 100644
--- a/code_map/Visual.tex.nw
+++ b/code_map/Visual.tex.nw
@@ -1105,7 +1105,7 @@ let mk_gui ~screen_size ~legend test_mode w =
                 | None -> []
                 | Some re ->
                     rects +> List.filter (fun r -> 
-                      let label = r.T.tr_label +> String.lowercase in
+                      let label = r.T.tr_label +> String.lowercase_ascii in
                       label ==~ re
                     )
               in
@@ -5351,7 +5351,7 @@ let find_def_entity_at_line_opt line tr dw model =
     ) +> List.map (fun (s, kind) -> ((s, kind), rank_entity_kind kind))
       +> Common.sort_by_val_highfirst
       +> List.hd +> fst +> (fun x -> Some x)
-  with Not_found | Failure "hd" -> None
+  with Not_found | Not_found -> None

 let find_use_entity_at_line_and_glyph_opt line glyph tr dw model =
   model.g >>= (fun g ->
diff --git a/code_map/draw_microlevel.ml b/code_map/draw_microlevel.ml
index a6f01a0..e4b1d6d 100644
--- a/code_map/draw_microlevel.ml
+++ b/code_map/draw_microlevel.ml
@@ -223,7 +223,7 @@ let glyphs_of_file ~font_size ~font_size_real model_async file
     if !acc <> []
     then arr.(!line) <- List.rev !acc;
     Some arr
-   with Invalid_argument("index out of bounds") ->
+   with Not_found ->
       failwith (spf "try on %s, nblines = %d, line = %d" file nblines !line)
     )

diff --git a/code_map/model2.ml b/code_map/model2.ml
index 07624c8..c47c5bc 100644
--- a/code_map/model2.ml
+++ b/code_map/model2.ml
@@ -381,7 +381,7 @@ let find_def_entity_at_line_opt line tr dw model =
     ) +> List.map (fun (s, kind) -> ((s, kind), rank_entity_kind kind))
       +> Common.sort_by_val_highfirst
       +> List.hd +> fst +> (fun x -> Some x)
-  with Not_found | Failure "hd" -> None
+  with Not_found -> None

 let find_use_entity_at_line_and_glyph_opt line glyph tr dw model =
   model.g >>= (fun g ->
diff --git a/code_map/view2.ml b/code_map/view2.ml
index f0edd1c..30d9c60 100644
--- a/code_map/view2.ml
+++ b/code_map/view2.ml
@@ -423,7 +423,7 @@ let mk_gui ~screen_size ~legend test_mode w =
                 | None -> []
                 | Some re ->
                     rects +> List.filter (fun r -> 
-                      let label = r.T.tr_label +> String.lowercase in
+                      let label = r.T.tr_label +> String.lowercase_ascii in
                       label ==~ re
                     )
               in
diff --git a/commons/macro.ml4 b/commons/macro.ml4
index de14969..c4a5a04 100644
--- a/commons/macro.ml4
+++ b/commons/macro.ml4
@@ -216,7 +216,7 @@ EXTEND
         ExAcc(l, ExUid (l,file), ExLid(l, "string_of_" ^ s)) 
        but dont work that much cos builtin lib or modules have not those function
          *)
-       ExLid(l, String.lowercase file ^ "_" ^ "string_of_" ^ s)
+       ExLid(l, String.lowercase_ascii file ^ "_" ^ "string_of_" ^ s)
        | _ -> failwith "pb"
      in
      (* TODOSTYLE? function fmatch id patt expr who put the None, ... *)
diff --git a/commons/ocamlextra/xML2.ml b/commons/ocamlextra/xML2.ml
index 1bb712f..9b6fb9a 100644
--- a/commons/ocamlextra/xML2.ml
+++ b/commons/ocamlextra/xML2.ml
@@ -215,7 +215,7 @@ module Elt_Set =

 let elt_set_of_list names =
   List.fold_right
-    (fun n set -> Elt_Set.add (String.lowercase n) set) names Elt_Set.empty
+    (fun n set -> Elt_Set.add (String.lowercase_ascii n) set) names Elt_Set.empty

 type io_state =
     { preformatted : bool;
@@ -233,8 +233,8 @@ let initial_io_state ?(preformatted = []) ?(no_break = []) () =

 let update_io_state name attribs ios =
   { ios with
-    allow_break = not (Elt_Set.mem (String.lowercase name) ios.no_break_elts);
-    preformatted = Elt_Set.mem (String.lowercase name) ios.preformatted_elts }
+    allow_break = not (Elt_Set.mem (String.lowercase_ascii name) ios.no_break_elts);
+    preformatted = Elt_Set.mem (String.lowercase_ascii name) ios.preformatted_elts }

 (** {2 No Pretty Printing} *)

diff --git a/external/javalib/src/jManifest.mll b/external/javalib/src/jManifest.mll
index ac570fa..9bf7de7 100644
--- a/external/javalib/src/jManifest.mll
+++ b/external/javalib/src/jManifest.mll
@@ -71,7 +71,7 @@ and section = parse
   (* TODO : accept missing manifest version (for midlets) *)
   let sections2manifest = function
       | ((mv, v) :: main) :: sections
-     when String.lowercase mv = "manifest-version" ->
+     when String.lowercase_ascii mv = "manifest-version" ->
      {main_section =
          {manifest_version = List.map int_of_string (String.nsplit v ".");
           main_attributes = main};
@@ -79,7 +79,7 @@ and section = parse
          List.map
        (function
           | (name, v) :: attributes
-              when String.lowercase name = "name" ->
+              when String.lowercase_ascii name = "name" ->
               {name = v ; attributes = attributes}
           | _ -> failwith "incorrect manifest")
        sections}
diff --git a/external/ocamlgraph/src/dot_lexer.mll b/external/ocamlgraph/src/dot_lexer.mll
index cb1c492..7c46b06 100644
--- a/external/ocamlgraph/src/dot_lexer.mll
+++ b/external/ocamlgraph/src/dot_lexer.mll
@@ -36,7 +36,7 @@
    "node", NODE;
    "edge", EDGE;
       ];
-    fun s -> let s = String.lowercase s in Hashtbl.find h s
+    fun s -> let s = String.lowercase_ascii s in Hashtbl.find h s

 }

diff --git a/external/ocamlzip/zip.ml b/external/ocamlzip/zip.ml
index f49b91a..7bd68f6 100644
--- a/external/ocamlzip/zip.ml
+++ b/external/ocamlzip/zip.ml
@@ -73,7 +73,7 @@ type out_file =
     mutable of_entries: entry list;
     of_comment: string }

-exception Error of string * string * string
+(* exception Error of string * string * string *)

 (* Return the position of the last occurrence of s1 in s2, or -1 if not
    found. *)
diff --git a/external/ocamlzip/zlibstubs.c b/external/ocamlzip/zlibstubs.c
index a627df9..b4564c2 100644
--- a/external/ocamlzip/zlibstubs.c
+++ b/external/ocamlzip/zlibstubs.c
@@ -16,6 +16,7 @@
 /* Stub code to interface with Zlib */

 #include <zlib.h>
+#include <stdint.h>

 #include <caml/mlvalues.h>
 #include <caml/alloc.h>
@@ -168,8 +169,7 @@ value camlzip_inflateEnd(value vzs)

 value camlzip_update_crc32(value crc, value buf, value pos, value len)
 {
-  return caml_copy_int32(crc32((uint32) Int32_val(crc), 
+  return caml_copy_int32(crc32((uint32_t) Int32_val(crc),
                           &Byte_u(buf, Long_val(pos)),
                           Long_val(len)));
 }
-
diff --git a/external/stdlib/extract_crc.ml b/external/stdlib/extract_crc.ml
index 1e1fc76..d4ed4be 100644
--- a/external/stdlib/extract_crc.ml
+++ b/external/stdlib/extract_crc.ml
@@ -22,7 +22,7 @@ let print_crc unit =
   try
     let crc = Dynlink.digest_interface unit (!load_path @ ["."]) in
     if !first then first := false else print_string ";\n";
-    print_string "  \""; print_string (String.capitalize unit);
+    print_string "  \""; print_string (String.capitalize_ascii unit);
     print_string "\",\n    \"";
     for i = 0 to String.length crc - 1 do
       Printf.printf "\\%03d" (Char.code crc.[i])
diff --git a/external/stdlib/filename.ml b/external/stdlib/filename.ml
index 156ceac..8bb5915 100644
--- a/external/stdlib/filename.ml
+++ b/external/stdlib/filename.ml
@@ -109,7 +109,7 @@ module Win32 = struct
    String.length name >= String.length suff &&
    (let s = String.sub name (String.length name - String.length suff)
                             (String.length suff) in
-    String.lowercase s = String.lowercase suff)
+    String.lowercase_ascii s = String.lowercase_ascii suff)
   let temp_dir_name =
     try Sys.getenv "TEMP" with Not_found -> "."
   let quote s =
diff --git a/external/stdlib/str.ml b/external/stdlib/str.ml
index 5fb0607..35eecd1 100644
--- a/external/stdlib/str.ml
+++ b/external/stdlib/str.ml
@@ -286,7 +286,7 @@ let compile fold_case re =
           emit_code (String (string_after s (i+1)))
         with Not_found ->
           if fold_case then
-            emit_instr op_STRINGNORM (cpool_index (String.lowercase s))
+            emit_instr op_STRINGNORM (cpool_index (String.lowercase_ascii s))
           else
             emit_instr op_STRING (cpool_index s)
       end
diff --git a/h_visualization/graph_guess.ml b/h_visualization/graph_guess.ml
index 5401998..ad809d0 100644
--- a/h_visualization/graph_guess.ml
+++ b/h_visualization/graph_guess.ml
@@ -46,7 +46,7 @@ let to_gdf g ~str_of_node ~output =

       match e with
       | "ml" -> 
-          let str = String.capitalize b in
+          let str = String.capitalize_ascii b in
           if str = "Math" then "Math_xxx"
           else str
       | "mli" -> b ^ "." ^ e
diff --git a/lang_html/parsing/parse_html.ml b/lang_html/parsing/parse_html.ml
index cfee9a5..48ae321 100644
--- a/lang_html/parsing/parse_html.ml
+++ b/lang_html/parsing/parse_html.ml
@@ -129,12 +129,12 @@ let parse_atts call_scan =
             | T.Name (tok2, v) ->
                 let toks, is_empty =
                   parse_atts_lookahead (skip_space false call_scan) in
-                ((Attr (String.lowercase n, tok1), Val (v, tok2)) :: toks, 
+                ((Attr (String.lowercase_ascii n, tok1), Val (v, tok2)) :: toks, 
                 is_empty)
             | T.Literal (tok2, v) ->
                 let toks, is_empty =
                   parse_atts_lookahead (skip_space false call_scan) in
-                ((Attr (String.lowercase n, tok1), Val (v, tok2))::toks, 
+                ((Attr (String.lowercase_ascii n, tok1), Val (v, tok2))::toks, 
                 is_empty)
             | T.EOF _ ->
                 raise End_of_scan
@@ -161,18 +161,18 @@ let parse_atts call_scan =
             raise End_of_scan
         | T.Relement _ ->
             (* <tag name> <==> <tag name="name"> *)
-            ([Attr (String.lowercase n, tok1), 
-              Val (String.lowercase n, Ast.fakeInfo())], false)
+            ([Attr (String.lowercase_ascii n, tok1), 
+              Val (String.lowercase_ascii n, Ast.fakeInfo())], false)
         | T.Relement_empty _ ->
             (* <tag name> <==> <tag name="name"> *)
-            ([Attr (String.lowercase n, tok1), 
-              Val (String.lowercase n, Ast.fakeInfo())], true)
+            ([Attr (String.lowercase_ascii n, tok1), 
+              Val (String.lowercase_ascii n, Ast.fakeInfo())], true)
         | next' ->
             (* assume <tag name ... > <==> <tag name="name" ...> *)
             let toks, is_empty = 
               parse_atts_lookahead next' in
-            ((Attr (String.lowercase n, tok1), 
-              Val (String.lowercase n, Ast.fakeInfo())) :: toks,
+            ((Attr (String.lowercase_ascii n, tok1), 
+              Val (String.lowercase_ascii n, Ast.fakeInfo())) :: toks,
             is_empty)
         )
     | T.EOF _ ->
@@ -201,7 +201,7 @@ let parse_special tag call_scan =
   let rec aux () = 
     match call_scan Lexer_html.scan_special with
     | T.Lelementend (_tok, n) ->
-        if String.lowercase n =$= name 
+        if String.lowercase_ascii n =$= name 
         then ""
         else "</" ^ n ^ aux ()
     | T.EOF _ -> raise End_of_scan
@@ -413,7 +413,7 @@ let parse2 file =
         parse_next()

     | T.Lelement (tok, name) ->
-        let name = Tag (String.lowercase name, tok) in
+        let name = Tag (String.lowercase_ascii name, tok) in
         let (_, model) = model_of ~dtd_hash name in
         (match model with
         | Dtd.Empty ->
@@ -474,7 +474,7 @@ let parse2 file =
         };
         parse_next()
     | T.Lelementend (tok, name) ->
-        let name = Tag (String.lowercase name, tok) in
+        let name = Tag (String.lowercase_ascii name, tok) in
         (* Read until ">" *)
         skip_element call_scan;
         (* Search the element to close on the stack: *)
diff --git a/lang_js/analyze/module_js.ml b/lang_js/analyze/module_js.ml
index 1433bf0..7d800e5 100644
--- a/lang_js/analyze/module_js.ml
+++ b/lang_js/analyze/module_js.ml
@@ -48,50 +48,38 @@ type shape =
    | LiteralShape
    | ArrayShape

-   (** _((id,container,maps) ref) **)
-   (* this is a ref to allow extensible representations *)
-   (* id is unique, and is used to prune infinite recursion *)
+
    (* maps is an ObjectShape list *)
    | ObjectShape of (int * shape smap * shape list) ref

-   (** _(block,constructor) **)
-   (* block is an ObjectShape *)
+
    (* constructor is a ClassShape *)
     | FunctionShape of shape Common.smap ref * shape

-   (** _(module) **)
    | RequireShape of module_

-   (** _(reason) **)
    | UnknownShape of string

-   (** _(instance, static) **)
-   (* instance is a ObjectShape *)
+
    (* static is a ObjectShape where static.prototype is a ObjectShape *)
    | ClassShape of shape * shape

-   (** _(class) **)
-   (* class is a ClassShape *)
+
    (* returns an ObjectShape *)
    | NewShape of shape

-   (** _(maps) **)
-   (* maps is an ObjectShape *)
+
    (* returns a ClassShape *)
    | MixinShape of shape

-   (** _(class,mixin) **)
-   (* class is a ClassShape, mixin is a ClassShape *)
+
    (* returns a ClassShape *)
    | ClassWithMixinShape of shape * shape

-   (** _(object,prop) **)
    | PropertyShape of shape * string

-   (** _(function) **)
    | ApplyShape of shape

-   (** _(array) **)
    | ElementShape of shape

 let fresh_id =
@@ -210,5 +198,3 @@ type moduleinfo = {
 }

 type moduleinfo_map = moduleinfo smap
-
-
diff --git a/lang_js/analyze/utils_js.mli b/lang_js/analyze/utils_js.mli
index 637b832..d7a2b89 100644
--- a/lang_js/analyze/utils_js.mli
+++ b/lang_js/analyze/utils_js.mli
@@ -2,7 +2,5 @@
 (** print utils **)
 val string_of_any : Ast_js.any -> string

-(** Example: load file task **)
-(** if file exists, unmarshal data in the file and return it **)
 (** otherwise, run task to generate data, store it in the file, and return it **)
 val load : Common.filename -> (unit -> 'a) -> 'a
diff --git a/lang_js/parsing/lexer_js.mll b/lang_js/parsing/lexer_js.mll
index 0d35877..e2fd615 100644
--- a/lang_js/parsing/lexer_js.mll
+++ b/lang_js/parsing/lexer_js.mll
@@ -161,7 +161,7 @@ let reset () =
 let rec current_mode () =
   try
     Common2.top !_mode_stack
-  with Failure("hd") ->
+  with Not_found ->
     error("mode_stack is empty, defaulting to INITIAL");
     reset();
     current_mode ()
diff --git a/lang_ml/analyze/database_light_ml.ml b/lang_ml/analyze/database_light_ml.ml
index fa2783a..3757fc3 100644
--- a/lang_ml/analyze/database_light_ml.ml
+++ b/lang_ml/analyze/database_light_ml.ml
@@ -326,7 +326,7 @@ let compute_database ?(verbose=false) files_or_dirs =
               in
               let module_entity = 
                 let (_d,b,_e) = Common2.dbe_of_filename file_entity in
-                String.capitalize b
+                String.capitalize_ascii b
               in

               if file_entity <> file && final_module_name = module_entity
diff --git a/lang_ml/analyze/module_ml.ml b/lang_ml/analyze/module_ml.ml
index f13edc9..d94440b 100644
--- a/lang_ml/analyze/module_ml.ml
+++ b/lang_ml/analyze/module_ml.ml
@@ -17,5 +17,5 @@

 let module_name_of_filename file =
   let (_d,b,_e) = Common2.dbe_of_filename file in
-  let module_name = String.capitalize b in
+  let module_name = String.capitalize_ascii b in
   module_name
diff --git a/lang_ml/analyze/tags_ml.ml b/lang_ml/analyze/tags_ml.ml
index a1f89cb..69e2998 100644
--- a/lang_ml/analyze/tags_ml.ml
+++ b/lang_ml/analyze/tags_ml.ml
@@ -95,7 +95,7 @@ let defs_of_files_or_dirs ?(verbose=false) xs =
               Common.push (Tags.tag_of_info filelines info kind) defs;

               let (d,b,e) = Common2.dbe_of_filename file in
-              let module_name = String.capitalize b in
+              let module_name = String.capitalize_ascii b in

               let info' = Parse_info.rewrap_str (module_name ^ "." ^ s) info in

diff --git a/lang_nw/parsing/lexer_nw.mll b/lang_nw/parsing/lexer_nw.mll
index 84dcd88..a10b5ad 100644
--- a/lang_nw/parsing/lexer_nw.mll
+++ b/lang_nw/parsing/lexer_nw.mll
@@ -78,7 +78,7 @@ let reset () =
 let rec current_mode () =
   try
     Common2.top !_mode_stack
-  with Failure("hd") -> 
+  with Not_found -> 
     pr2("LEXER: mode_stack is empty, defaulting to INITIAL");
     reset();
     current_mode ()
diff --git a/lang_opa/parsing/lexer_opa.mll b/lang_opa/parsing/lexer_opa.mll
index 460d407..2e81c17 100644
--- a/lang_opa/parsing/lexer_opa.mll
+++ b/lang_opa/parsing/lexer_opa.mll
@@ -174,7 +174,7 @@ let pop_mode () = ignore(Common2.pop2 _mode_stack)
 let rec current_mode () =
   try
     Common2.top !_mode_stack
-  with Failure("hd") -> 
+  with Not_found -> 
     error("LEXER: mode_stack is empty, defaulting to INITIAL");
     reset();
     current_mode ()
diff --git a/lang_php/analyze/checker/check_misc_php.ml b/lang_php/analyze/checker/check_misc_php.ml
index 391c08d..33fb8cd 100644
--- a/lang_php/analyze/checker/check_misc_php.ml
+++ b/lang_php/analyze/checker/check_misc_php.ml
@@ -111,7 +111,7 @@ let rec unargs args =
 let expr_is_T_or_F (expr : Ast.expr) =
   match expr with
   | Id(XName([QI(Name((str, _)))])) ->
-    let str_l = String.lowercase str in
+    let str_l = String.lowercase_ascii str in
     (str_l = "true") || (str_l = "false")
   | _ -> false

diff --git a/lang_php/analyze/checker/error_php.ml b/lang_php/analyze/checker/error_php.ml
index abbc464..e867b9e 100644
--- a/lang_php/analyze/checker/error_php.ml
+++ b/lang_php/analyze/checker/error_php.ml
@@ -374,8 +374,8 @@ let rank_of_error_kind err_kind =
       | Some (s2, i) ->
           (match i with
           | 1 -> 
-              let s1 = String.lowercase s1 in
-              let s2 = String.lowercase s2 in
+              let s1 = String.lowercase_ascii s1 in
+              let s2 = String.lowercase_ascii s2 in
               if (s1 ^ "s" =$= s2) || (s1 =$= s2 ^ "s")
               then Less
               else ReallyImportant
diff --git a/lang_php/analyze/foundation/class_php.ml b/lang_php/analyze/foundation/class_php.ml
index e3906c8..4c1a147 100644
--- a/lang_php/analyze/foundation/class_php.ml
+++ b/lang_php/analyze/foundation/class_php.ml
@@ -46,7 +46,7 @@ let constructor_name = "__construct"

 let equal ~case_insensitive a b =
   if case_insensitive
-  then String.lowercase a =$= String.lowercase b
+  then String.lowercase_ascii a =$= String.lowercase_ascii b
   else a =$= b

 (* This is ugly. Some of the code requires to have a 'name' type
diff --git a/lang_php/analyze/foundation/graph_code_php.ml b/lang_php/analyze/foundation/graph_code_php.ml
index f6180c2..ffe125e 100644
--- a/lang_php/analyze/foundation/graph_code_php.ml
+++ b/lang_php/analyze/foundation/graph_code_php.ml
@@ -222,7 +222,7 @@ let property_of_modifiers modifiers =

 let normalize str =
   str
-  +> String.lowercase                         (* php is case insensitive *)
+  +> String.lowercase_ascii                         (* php is case insensitive *)
   +> Str.global_replace (Str.regexp "-") "_"  (* xhp is "dash" insensitive *)

 (*****************************************************************************)
diff --git a/lang_php/matcher/php_vs_php.ml b/lang_php/matcher/php_vs_php.ml
index ff91e92..f800444 100644
--- a/lang_php/matcher/php_vs_php.ml
+++ b/lang_php/matcher/php_vs_php.ml
@@ -278,7 +278,7 @@ let m_string a b =
 let m_string_case a b =
   if !case_sensitive
   then m_string a b
-  else m_string (String.lowercase a) (String.lowercase b)
+  else m_string (String.lowercase_ascii a) (String.lowercase_ascii b)

 (* iso on different indentation *)
 let m_string_xhp_text (sa, ta) (sb, tb) =
diff --git a/lang_php/parsing/lexer_php.mll b/lang_php/parsing/lexer_php.mll
index ae849ca..f8e69ed 100644
--- a/lang_php/parsing/lexer_php.mll
+++ b/lang_php/parsing/lexer_php.mll
@@ -65,7 +65,7 @@ let tok_add_s s ii  =
 let case_str s =
   if !Flag.case_sensitive
   then s
-  else String.lowercase s
+  else String.lowercase_ascii s

 let xhp_or_t_ident ii fii =
@@ -222,7 +222,7 @@ let keyword_table = Common.hash_of_list [
 ]

 let _ = assert ((Common2.hkeys keyword_table) +>
-                 List.for_all (fun s -> s = String.lowercase s))
+                 List.for_all (fun s -> s = String.lowercase_ascii s))

 (* ---------------------------------------------------------------------- *)
 (* Lexer State *)
@@ -311,7 +311,7 @@ let reset () =
 let rec current_mode () =
   try
     Common2.top !_mode_stack
-  with Failure("hd") ->
+  with Not_found ->
     error("mode_stack is empty, defaulting to INITIAL");
     reset();
     current_mode ()
@@ -728,7 +728,7 @@ rule st_in_scripting = parse
           let s = tok lexbuf in
           match Common2.optionise (fun () ->
             (* PHP is case insensitive ... it's ok to write IF(...) { ... } *)
-            Hashtbl.find keyword_table (String.lowercase s))
+            Hashtbl.find keyword_table (String.lowercase_ascii s))
           with
           | Some f -> f info
           (* was called T_STRING in original grammar *)
diff --git a/lang_php/parsing/lexer_php.mll.nw b/lang_php/parsing/lexer_php.mll.nw
index 71266c0..088226c 100644
--- a/lang_php/parsing/lexer_php.mll.nw
+++ b/lang_php/parsing/lexer_php.mll.nw
@@ -354,7 +354,7 @@ let reset () =
 let rec current_mode () = 
   try 
     Common.top !_mode_stack
-  with Failure("hd") -> 
+  with Not_found -> 
     pr2("LEXER: mode_stack is empty, defaulting to INITIAL");
     reset();
     current_mode ()
@@ -1065,7 +1065,7 @@ and st_one_line_comment = parse
         let s = tok lexbuf in
         match Common.optionise (fun () -> 
           (* PHP is case insensitive ... it's ok to write IF(...) { ... } *)
-          Hashtbl.find keyword_table (String.lowercase s))
+          Hashtbl.find keyword_table (String.lowercase_ascii s))
         with
         | Some f -> f info
         (* was called T_STRING in original grammar *)
diff --git a/lang_sql/parsing/lexer_sql.mll b/lang_sql/parsing/lexer_sql.mll
index f47e988..a14897f 100644
--- a/lang_sql/parsing/lexer_sql.mll
+++ b/lang_sql/parsing/lexer_sql.mll
@@ -150,7 +150,7 @@ rule lexer = parse
         let s = tok lexbuf in

           match Common2.optionise (fun () -> 
-            Hashtbl.find keyword_table (String.lowercase s))
+            Hashtbl.find keyword_table (String.lowercase_ascii s))
           with
           | Some f -> f info
           | None -> T_NAME (info)
``
tychota commented 8 years ago

It was complaining about:

aryx commented 8 years ago

The error seems to have nothing to do with the ocaml code in pfff. It's in zlibstub.c, a library used by pfff. It would be great if someone has a patch I can merge that just fixes the uint32 issue.

Also, for the other patches, if you could disable your editor feature that replaces or removes some whitespace that would be great. The diff visualizer of github shows lots of noises otherwise (maybe there is an option in github to disable the visualization of those hunks).

tychota commented 8 years ago

I will submit a patch for uint32.

I edited the diff (first one was without --ignore-whitespace changes so your mail should have the big useless diff). Then I'm an ocaml nob but it seems that some depracted warning just stopped the build. Hence the diff.

aryx commented 8 years ago

Great!

sgabler commented 8 years ago

@tychota - Any news on this? Do you need assistance?

tychota commented 8 years ago

@sgabler : completly forgo this.Doing right now.