let flush_globals () =
  let (before,after)=List.fold_left
    (fun (b,a) elem ->
        match elem with
          | GFun(f,loc) as func ->
              (* [VP] if address of function is taken, it might be
                 used in a global initializer: keep a declaration at this point
                 to ensure ending up with a compilable C file in the end...
               *)

              let b =
                if f.svar.vaddrof then
                  GVarDecl(Cil.empty_funspec(),f.svar,loc)::b
                else b
              in
              (b,func::a)
          | other -> (other::b,a)
    )
    ([],[])
    !file.globals in

  !file.globals <- (List.rev before)@(List.rev !globals_queue)@(List.rev after);
  Kernel_function.clear_sid_info ();
  globals_queue:=[]