~ubuntu-branches/ubuntu/trusty/coccinelle/trusty-proposed

« back to all changes in this revision

Viewing changes to parsing_c/parse_c.ml

  • Committer: Package Import Robot
  • Author(s): Євгеній Мещеряков
  • Date: 2011-12-06 23:17:50 UTC
  • mfrom: (7.2.4 experimental) (7.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20111206231750-m6n4b9jh0d48dlxo
Tags: 1.0.0~rc7.deb-5
Merge Build-Depends-Indep into Build-Depends, the package does not build
on autobuilders otherwise

Show diffs side-by-side

added added

removed removed

Lines of Context:
834
834
  (* -------------------------------------------------- *)
835
835
  (* call lexer and get all the tokens *)
836
836
  (* -------------------------------------------------- *)
 
837
 
837
838
  LP.lexer_reset_typedef saved_typedefs;
838
839
  Parsing_hacks.ifdef_paren_cnt := 0;
839
840
 
1061
1062
  if not !Flag_parsing_c.use_cache
1062
1063
  then parse_print_error_heuristic None None file
1063
1064
  else
1064
 
  let _ = pr2 "TOFIX" in
 
1065
  let _ = pr2 "TOFIX: use_cache is not sensitive to changes in the considered macros, include files, etc" in
1065
1066
  let need_no_changed_files =
1066
1067
    (* should use Sys.argv.(0), would be safer. *)
1067
1068
 
1074
1075
      *)
1075
1076
      !Config.std_h;
1076
1077
      *)
1077
 
    ]
1078
 
  in
 
1078
    ] in
1079
1079
  let need_no_changed_variables =
1080
1080
    (* could add some of the flags of flag_parsing_c.ml *)
1081
 
    []
1082
 
  in
1083
 
  Common.cache_computation_robust
1084
 
    file ".ast_raw"
 
1081
    [] in
 
1082
  Common.cache_computation_robust_in_dir
 
1083
    !Flag_parsing_c.cache_prefix file ".ast_raw"
1085
1084
    (need_no_changed_files, need_no_changed_variables) ".depend_raw"
1086
 
    (fun () -> parse_print_error_heuristic None None file)
 
1085
    (fun () ->
 
1086
      (* check whether to clear the cache *)
 
1087
      (match (!Flag_parsing_c.cache_limit,!Flag_parsing_c.cache_prefix) with
 
1088
        (None,_) | (_,None) -> ()
 
1089
      | (Some limit,Some prefix) ->
 
1090
          let count =
 
1091
            Common.cmd_to_list
 
1092
              (Printf.sprintf
 
1093
                 "test -e %s && ls %s/*.ast_raw %s/*.depend_raw | wc -l"
 
1094
                 prefix prefix prefix) in
 
1095
          match count with
 
1096
            [c] ->
 
1097
              if int_of_string c >= limit
 
1098
              then
 
1099
                let _ =
 
1100
                  Sys.command
 
1101
                    (Printf.sprintf "/bin/rm -r %s/*.ast_raw %s/*.depend_raw"
 
1102
                       prefix prefix) in
 
1103
                ()
 
1104
          | _ -> ());
 
1105
      (* recompute *)
 
1106
      parse_print_error_heuristic None None file)
1087
1107
 
1088
1108
 
1089
1109