permit multiline comments and strings in macros
[bpt/coccinelle.git] / parsing_c / test_parsing_c.ml
CommitLineData
34e49164
C
1open Common
2
91eba41f
C
3open Ast_c
4
34e49164
C
5let score_path = "/home/pad/c-yacfe/tmp"
6
ae4735db 7let tmpfile = "/tmp/output.c"
34e49164 8
708f4980 9module Ast_to_flow = Control_flow_c_build
91eba41f 10
34e49164
C
11(*****************************************************************************)
12(* Subsystem testing *)
13(*****************************************************************************)
14
ae4735db
C
15let test_tokens_c file =
16 if not (file =~ ".*\\.c")
34e49164
C
17 then pr2 "warning: seems not a .c file";
18
ae4735db 19 Flag_parsing_c.debug_lexer := true;
34e49164
C
20 Flag_parsing_c.verbose_lexing := true;
21 Flag_parsing_c.verbose_parsing := true;
22
23 Parse_c.tokens file +> List.iter (fun x -> pr2_gen x);
24 ()
ae4735db 25
34e49164 26
1b9ae606
C
27(* ---------------------------------------------------------------------- *)
28
29(* Was in main, but using it in test_parsing_c *)
30let get_files path =
31 let ch =
32 cmd_to_list (* same as "true, "", _" case *)
33 (if !Flag.include_headers
34 (* FIXME : Could we remove xs ?
35 -use_glimpse requires a singleton.
36 This is checked some lines before.
37 then ("find "^(join " " (x::xs))^" -name \"*.[ch]\"")
38 else ("find "^(join " " (x::xs))^" -name \"*.c\"")
39 *)
40 then ("find "^ path ^" -name \"*.[ch]\"")
41 else ("find "^ path ^" -name \"*.c\"")) in
42 let cpp =
43 if !Flag.c_plus_plus
44 then cmd_to_list ("find "^ path ^" -name \"*.cpp\"")
45 else [] in
46 cpp @ ch
47
48let new_test_parse_gen xs =
49
50 Flag_parsing_c.debug_typedef := true;
51 Flag_parsing_c.debug_cpp := true;
52 Flag_parsing_c.debug_etdt := false;
53 Flag_parsing_c.filter_msg := true;
54
55 (*let dirname_opt =
56 match xs with
57 | [x] when is_directory x -> Some x
58 | _ -> None
59 in*)
60
61 (* old:
62 let xs = if !Flag.dir then
63 process_output_to_list ("find " ^ x ^" -name \"*.c\"") else x::xs in
64 *)
65 let fullxs = xs +> List.map get_files +> List.concat in
66
67 let stat_list = ref [] in
68 let newscore = Common.empty_score () in
69
70 Common.check_stack_nbfiles (List.length fullxs);
71
72 fullxs +> List.iter (fun file ->
73
74 pr2 "";
75 pr2 ("PARSING: " ^ file);
76
77 let (xs, stat) = Parse_c.parse_c_and_cpp file in
78 xs +> List.iter (fun (ast, (s, toks)) ->
79 Parse_c.print_commentized toks
80 );
81
82 Common.push2 stat stat_list;
83 let s =
84 sprintf "bad = %d, timeout = %B"
85 stat.Parsing_stat.bad stat.Parsing_stat.have_timeout
86 in
87 if stat.Parsing_stat.bad =|= 0 && not stat.Parsing_stat.have_timeout
88 then Hashtbl.add newscore file (Common.Ok)
89 else Hashtbl.add newscore file (Common.Pb s)
90 );
91
92(* uses an explicit path; to fix
93 dirname_opt +> Common.do_option (fun dirname ->
94 pr2_xxxxxxxxxxxxxxxxx();
95 pr2 "regression testing information";
96 pr2_xxxxxxxxxxxxxxxxx();
97 let str = Str.global_replace (Str.regexp "/") "__" dirname in
98 let def = if !Flag_parsing_c.filter_define_error then "_def_" else "" in
99 let ext = if ext =$= "c" then "" else ext in
100 let filename = "score_parsing__" ^str ^ def ^ ext ^ ".marshalled" in
101 if Sys.file_exists filename
102 then
103 Common.regression_testing newscore
104 (Filename.concat score_path
105 ("score_parsing__" ^str ^ def ^ ext ^ ".marshalled"))
106 );
107*)
108
109 if not (null !stat_list)
110 then begin
111 Parsing_stat.print_recurring_problematic_tokens !stat_list;
112 Parsing_stat.print_parsing_stat_list !stat_list;
113 end;
114 ()
34e49164
C
115
116(* ---------------------------------------------------------------------- *)
ae4735db
C
117let test_parse_gen xs ext =
118
34e49164
C
119 Flag_parsing_c.debug_typedef := true;
120 Flag_parsing_c.debug_cpp := true;
121 Flag_parsing_c.debug_etdt := false;
122 Flag_parsing_c.filter_msg := true;
123
413ffc02 124 (*let dirname_opt =
34e49164
C
125 match xs with
126 | [x] when is_directory x -> Some x
127 | _ -> None
413ffc02 128 in*)
34e49164
C
129
130 (* old:
ae4735db 131 let xs = if !Flag.dir then
34e49164
C
132 process_output_to_list ("find " ^ x ^" -name \"*.c\"") else x::xs in
133 *)
485bce71 134 let fullxs = Common.files_of_dir_or_files_no_vcs ext xs in
34e49164
C
135
136 let stat_list = ref [] in
137 let newscore = Common.empty_score () in
138
485bce71 139 Common.check_stack_nbfiles (List.length fullxs);
34e49164 140
ae4735db 141 fullxs +> List.iter (fun file ->
34e49164
C
142 if not (file =~ (".*\\."^ext))
143 then pr2 ("warning: seems not a ."^ext^" file");
144
145
146 pr2 "";
147 pr2 ("PARSING: " ^ file);
148
978fd7e5 149 let (xs, stat) = Parse_c.parse_c_and_cpp file in
ae4735db 150 xs +> List.iter (fun (ast, (s, toks)) ->
34e49164
C
151 Parse_c.print_commentized toks
152 );
153
154 Common.push2 stat stat_list;
ae4735db
C
155 let s =
156 sprintf "bad = %d, timeout = %B"
485bce71 157 stat.Parsing_stat.bad stat.Parsing_stat.have_timeout
34e49164 158 in
b1b2de81 159 if stat.Parsing_stat.bad =|= 0 && not stat.Parsing_stat.have_timeout
34e49164
C
160 then Hashtbl.add newscore file (Common.Ok)
161 else Hashtbl.add newscore file (Common.Pb s)
162 );
951c7801
C
163
164(* uses an explicit path; to fix
ae4735db 165 dirname_opt +> Common.do_option (fun dirname ->
91eba41f 166 pr2_xxxxxxxxxxxxxxxxx();
34e49164 167 pr2 "regression testing information";
91eba41f 168 pr2_xxxxxxxxxxxxxxxxx();
34e49164
C
169 let str = Str.global_replace (Str.regexp "/") "__" dirname in
170 let def = if !Flag_parsing_c.filter_define_error then "_def_" else "" in
b1b2de81 171 let ext = if ext =$= "c" then "" else ext in
951c7801
C
172 let filename = "score_parsing__" ^str ^ def ^ ext ^ ".marshalled" in
173 if Sys.file_exists filename
174 then
ae4735db 175 Common.regression_testing newscore
951c7801
C
176 (Filename.concat score_path
177 ("score_parsing__" ^str ^ def ^ ext ^ ".marshalled"))
708f4980 178 );
951c7801 179*)
708f4980 180
ae4735db
C
181 if not (null !stat_list)
182 then begin
708f4980
C
183 Parsing_stat.print_recurring_problematic_tokens !stat_list;
184 Parsing_stat.print_parsing_stat_list !stat_list;
185 end;
186 ()
34e49164
C
187
188
fc1ad971 189let test_parse_c xs =
34e49164 190 test_parse_gen xs "c"
ae4735db 191let test_parse_h xs =
34e49164 192 test_parse_gen xs "h"
ae4735db 193let test_parse_ch xs =
34e49164
C
194 test_parse_gen xs "[ch]"
195
ae4735db 196(* could use a simpler parser than heavy parse_c_and_cpp here as there
978fd7e5
C
197 * is no more cpp stuff in the .i files
198 *)
ae4735db 199let test_parse_i xs =
978fd7e5 200 test_parse_gen xs "i"
34e49164
C
201
202
203
204
205
206
207
208(* ---------------------------------------------------------------------- *)
209(* file can be "foo.c" or "foo.c:main" *)
c491d8ee
C
210(* local function that is parameterized by whether to launch gv *)
211let local_test_cfg launchgv file =
ae4735db 212 let (file, specific_func) =
34e49164 213 if file =~ "\\(.*\\.c\\):\\(.*\\)"
ae4735db
C
214 then
215 let (a,b) = matched2 file in
34e49164 216 a, Some b
ae4735db 217 else
34e49164
C
218 file, None
219 in
220
ae4735db 221 if not (file =~ ".*\\.c")
34e49164
C
222 then pr2 "warning: seems not a .c file";
223
978fd7e5 224 let (program, _stat) = Parse_c.parse_c_and_cpp file in
34e49164 225
ae4735db
C
226 program +> List.iter (fun (e,_) ->
227 let toprocess =
34e49164 228 match specific_func, e with
4dfbc1c2
C
229 | None, Ast_c.Definition (defbis,_) ->
230 Some (Ast_c.str_of_name (defbis.Ast_c.f_name))
ae4735db 231 | Some s, Ast_c.Definition (defbis,_) ->
4dfbc1c2
C
232 let nm = Ast_c.str_of_name (defbis.Ast_c.f_name) in
233 if s =$= nm then Some nm else None
234 | _, _ -> None
34e49164 235 in
ae4735db 236
4dfbc1c2
C
237 match toprocess with
238 None -> ()
239 | Some fn -> (* old: Flow_to_ast.test !Flag.show_flow def *)
240 try
34e49164 241 let flow = Ast_to_flow.ast_to_control_flow e in
ae4735db 242 flow +> do_option (fun flow ->
34e49164
C
243 Ast_to_flow.deadcode_detection flow;
244 let flow = Ast_to_flow.annotate_loop_nodes flow in
245
ae4735db 246 let flow' =
34e49164 247(*
ae4735db 248 if !Flag_cocci.show_before_fixed_flow
34e49164
C
249 then flow
250 else Ctlcocci_integration.fix_flow_ctl flow
251*)
252 flow
253 in
4dfbc1c2
C
254 let filename =
255 if launchgv
256 then Filename.temp_file "output" ".dot"
257 else
258 let fl = Filename.chop_extension (Filename.basename file) in
259 fl^":"^fn^".dot" in
c491d8ee 260 Ograph_extended.print_ograph_mutable flow' (filename) launchgv
34e49164
C
261 )
262 with Ast_to_flow.Error (x) -> Ast_to_flow.report_error x
263 )
34e49164 264
c491d8ee
C
265let test_cfg = local_test_cfg true
266
34e49164
C
267
268
ae4735db 269let test_cfg_ifdef file =
978fd7e5 270 let (ast2, _stat) = Parse_c.parse_c_and_cpp file in
91eba41f
C
271 let ast = Parse_c.program_of_program2 ast2 in
272
273 let ast = Cpp_ast_c.cpp_ifdef_statementize ast in
274
ae4735db
C
275 ast +> List.iter (fun e ->
276 (try
91eba41f 277 let flow = Ast_to_flow.ast_to_control_flow e in
ae4735db 278 flow +> do_option (fun flow ->
91eba41f
C
279 Ast_to_flow.deadcode_detection flow;
280 let flow = Ast_to_flow.annotate_loop_nodes flow in
281 Ograph_extended.print_ograph_mutable flow ("/tmp/output.dot") true
282 )
283 with Ast_to_flow.Error (x) -> Ast_to_flow.report_error x
284 )
285 )
286
34e49164 287(* ---------------------------------------------------------------------- *)
ae4735db
C
288let test_parse_unparse infile =
289 if not (infile =~ ".*\\.c")
34e49164
C
290 then pr2 "warning: seems not a .c file";
291
978fd7e5 292 let (program2, _stat) = Parse_c.parse_c_and_cpp infile in
ae4735db 293 let program2_with_ppmethod =
485bce71 294 program2 +> List.map (fun x -> x, Unparse_c.PPnormal)
34e49164 295 in
485bce71 296 Unparse_c.pp_program program2_with_ppmethod tmpfile;
34e49164
C
297 Common.command2 ("cat " ^ tmpfile);
298 (* if want see diff of space => no -b -B *)
299 Common.command2 (spf "diff -u -p %s %s" infile tmpfile);
300 (* +> Transformation.test_simple_trans1;*)
34e49164
C
301 ()
302
303
1eddfd50 304(*
ae4735db 305let parse_and_print_sexp file =
978fd7e5
C
306 let (ast2,_stat) = Parse_c.parse_c_and_cpp file in
307 let ast = Parse_c.program_of_program2 ast2 in
ae4735db 308 let _ast =
978fd7e5
C
309 Type_annoter_c.annotate_program !Type_annoter_c.initial_env ast
310 in
311
312 (*
313 let sexp = Sexp_ast_c.sexp_of_program ast in
314 let s = Sexp.to_string_hum sexp in
315 *)
316 Sexp_ast_c.show_info := false;
317 let s = Sexp_ast_c.string_of_program ast in
318 pr2 s;
319 ()
1eddfd50 320*)
34e49164
C
321
322
ae4735db
C
323let test_type_c infile =
324 if not (infile =~ ".*\\.c")
34e49164
C
325 then pr2 "warning: seems not a .c file";
326
327 Flag_parsing_c.pretty_print_type_info := true;
328
978fd7e5 329 let (program2, _stat) = Parse_c.parse_c_and_cpp infile in
34e49164 330 let _program2 =
ae4735db
C
331 program2
332 +> Common.unzip
333 +> (fun (program, infos) ->
334 Type_annoter_c.annotate_program !Type_annoter_c.initial_env
34e49164
C
335 program +> List.map fst,
336 infos
337 )
338 +> Common.uncurry Common.zip
339 in
ae4735db 340 let program2_with_ppmethod =
485bce71 341 program2 +> List.map (fun x -> x, Unparse_c.PPnormal)
34e49164 342 in
485bce71 343 Unparse_c.pp_program program2_with_ppmethod tmpfile;
34e49164
C
344 Common.command2 ("cat " ^ tmpfile);
345 ();;
346
347
0708f913
C
348(* ---------------------------------------------------------------------- *)
349(* ex: demos/platform_ifdef.c *)
ae4735db 350let test_comment_annotater infile =
978fd7e5 351 let (program2, _stat) = Parse_c.parse_c_and_cpp infile in
0708f913 352 let asts = program2 +> List.map (fun (ast,_) -> ast) in
ae4735db 353 let toks = program2 +> List.map (fun (ast, (s, toks)) -> toks) +>
0708f913
C
354 List.flatten in
355
356 Flag_parsing_c.pretty_print_comment_info := true;
357
358 pr2 "pretty print, before comment annotation: --->";
ae4735db
C
359 Common.adjust_pp_with_indent (fun () ->
360 asts +> List.iter (fun ast ->
0708f913
C
361 Pretty_print_c.pp_toplevel_simple ast;
362 );
363 );
364
365 let _ = Comment_annotater_c.annotate_program toks asts in
366
ae4735db 367 Common.adjust_pp_with_indent (fun () ->
0708f913 368 pr2 "pretty print, after comment annotation: --->";
ae4735db 369 asts +> List.iter (fun ast ->
0708f913
C
370 Pretty_print_c.pp_toplevel_simple ast;
371 );
372 );
373
374
375 ()
ae4735db
C
376
377
34e49164
C
378(* ---------------------------------------------------------------------- *)
379(* used by generic_makefile now *)
ae4735db 380let test_compare_c file1 file2 =
34e49164
C
381 let (correct, diffxs) = Compare_c.compare_default file1 file2 in
382 let res = Compare_c.compare_result_to_bool correct in
ae4735db 383 if res
34e49164
C
384 then raise (Common.UnixExit 0)
385 else raise (Common.UnixExit (-1))
386
387
388let test_compare_c_hardcoded () =
ae4735db
C
389 Compare_c.compare_default
390 "tests/compare1.c"
391 "tests/compare2.c"
34e49164 392 (*
ae4735db
C
393 "tests/equal_modulo1.c"
394 "tests/equal_modulo2.c"
34e49164 395 *)
ae4735db 396 +> Compare_c.compare_result_to_string
34e49164
C
397 +> pr2
398
399
400
91eba41f 401(* ---------------------------------------------------------------------- *)
ae4735db 402let test_attributes file =
91eba41f
C
403 let (ast2, _stat) = Parse_c.parse_c_and_cpp file in
404 let ast = Parse_c.program_of_program2 ast2 in
405
406 Visitor_c.vk_program { Visitor_c.default_visitor_c with
ae4735db 407 Visitor_c.kdef = (fun (k, bigf) (defbis, ii) ->
91eba41f 408 let sattr = Ast_c.s_of_attr defbis.f_attr in
b1b2de81 409 pr2 (spf "%-30s: %s" (Ast_c.str_of_name (defbis.f_name)) sattr);
91eba41f 410 );
ae4735db 411 Visitor_c.kdecl = (fun (k, bigf) decl ->
91eba41f 412 match decl with
ae4735db
C
413 | DeclList (xs, ii) ->
414 xs +> List.iter (fun (onedecl, iicomma) ->
415
91eba41f 416 let sattr = Ast_c.s_of_attr onedecl.v_attr in
ae4735db 417 let idname =
91eba41f 418 match onedecl.v_namei with
b1b2de81 419 | Some (name, ini) -> Ast_c.str_of_name name
91eba41f
C
420 | None -> "novar"
421 in
422 pr2 (spf "%-30s: %s" idname sattr);
423 );
424 | _ -> ()
ae4735db 425
91eba41f
C
426 );
427 } ast;
428 ()
429
430
431let cpp_options () = [
432 Cpp_ast_c.I "/home/yyzhou/pad/linux/include";
ae4735db
C
433] ++
434 Cpp_ast_c.cpp_option_of_cmdline
91eba41f
C
435 (!Flag_parsing_c.cpp_i_opts,!Flag_parsing_c.cpp_d_opts)
436
ae4735db 437let test_cpp file =
91eba41f
C
438 let (ast2, _stat) = Parse_c.parse_c_and_cpp file in
439 let dirname = Filename.dirname file in
440 let ast = Parse_c.program_of_program2 ast2 in
978fd7e5
C
441 let ast = Cpp_ast_c.cpp_expand_include (cpp_options()) dirname ast in
442 let _ast = Cpp_ast_c.cpp_ifdef_statementize ast in
ae4735db
C
443
444
91eba41f
C
445 ()
446
447
448
ae4735db 449(* CONFIG [ch] ? also do for .c ? maybe less needed now that I
978fd7e5
C
450 * add local_macros.
451 *)
ae4735db
C
452let extract_macros ~selection dir =
453 let ext = "h" in
978fd7e5 454 let fullxs = Common.files_of_dir_or_files_no_vcs ext [dir] in
ae4735db
C
455 let macros_and_filename =
456 fullxs +> List.map (fun file ->
978fd7e5
C
457 pr2 (spf "processing: %s" file);
458 let xs = Parse_c.extract_macros file in
459 file, xs
460 )
461 in
462
ae4735db 463 let macros =
978fd7e5 464 if selection
ae4735db 465 then Cpp_analysis_c.extract_dangerous_macros macros_and_filename
978fd7e5
C
466 else macros_and_filename
467 in
ae4735db 468 macros +> List.iter (fun (file, defs) ->
708f4980 469 pr ("/* PARSING: " ^ file ^ " */");
ae4735db 470 defs +> List.iter (fun (s, def) ->
978fd7e5
C
471 let str = Cpp_token_c.string_of_define_def def in
472 pr str;
473 )
474 );
475 ()
476
477
ae4735db 478let test_parse xs =
978fd7e5
C
479
480 Flag_parsing_c.filter_msg_define_error := true;
481 Flag_parsing_c.filter_define_error := true;
482 Flag_parsing_c.verbose_lexing := false;
483 Flag_parsing_c.verbose_parsing := false;
484
ae4735db 485 let dirname_opt =
978fd7e5
C
486 match xs with
487 | [x] when is_directory x -> Some x
488 | _ -> None
489 in
ae4735db 490 dirname_opt +> Common.do_option (fun dir ->
978fd7e5 491
ae4735db 492 let ext = "h" in
978fd7e5
C
493 let fullxs = Common.files_of_dir_or_files_no_vcs ext [dir] in
494
ae4735db
C
495 let macros_and_filename =
496 fullxs +> List.map (fun file ->
978fd7e5
C
497 pr2 (spf "processing: %s" file);
498 let xs = Parse_c.extract_macros file in
499 file, xs
500 )
501 in
ae4735db
C
502 let macros =
503 Cpp_analysis_c.extract_dangerous_macros macros_and_filename
978fd7e5 504 in
ae4735db
C
505 macros +> List.iter (fun (file, xs) ->
506 xs +> List.iter (fun (x, def) ->
507 let (s, params, body) = def in
978fd7e5
C
508 let str = Cpp_token_c.string_of_define_def def in
509 pr str;
510 (* builtins ? *)
511 Hashtbl.replace !Parse_c._defs_builtins s (s, params, body);
708f4980
C
512 );
513 );
514 );
978fd7e5
C
515
516 let ext = "[ch]" in
517
518 let fullxs = Common.files_of_dir_or_files_no_vcs ext xs in
519
520 let stat_list = ref [] in
521 Common.check_stack_nbfiles (List.length fullxs);
522
ae4735db 523 fullxs +> List.iter (fun file ->
978fd7e5
C
524 if not (file =~ (".*\\."^ext))
525 then pr2 ("warning: seems not a ."^ext^" file");
526
527 pr2 "";
528 pr2 ("PARSING: " ^ file);
529
530 let (xs, stat) = Parse_c.parse_c_and_cpp file in
ae4735db 531 xs +> List.iter (fun (ast, (s, toks)) ->
978fd7e5
C
532 Parse_c.print_commentized toks
533 );
534
535 Common.push2 stat stat_list;
536 );
ae4735db
C
537
538 if not (null !stat_list)
539 then begin
978fd7e5
C
540 Parsing_stat.print_recurring_problematic_tokens !stat_list;
541 Parsing_stat.print_parsing_stat_list !stat_list;
542 end;
708f4980
C
543 ()
544
545
91eba41f 546
978fd7e5
C
547
548
549
550
551
34e49164 552(* ---------------------------------------------------------------------- *)
ae4735db 553let test_xxx a =
34e49164
C
554 ()
555
556(*
557 ignore(Parse_c.parse_cpp_define_file "standard.h")
558 pr2 "pr2";
559 pr "pr"
560
561 Format.print_newline();
562 Format.printf "@[<v 5>--@,--@,@[<v 5>--@,--@,@]--@,--@,@]";
563 Format.print_newline();
564 Format.printf "@[<v>(---@[<v>(---@[<v>(---@,)@]@,)@]@,)@]"
565*)
566
567
568
569(*****************************************************************************)
570(* Main entry for Arg *)
571(*****************************************************************************)
572
573let actions () = [
17ba0788 574 "--tokens-c", " <file>",
34e49164 575 Common.mk_action_1_arg test_tokens_c;
17ba0788 576 "--parse-c", " <file or dir>",
34e49164 577 Common.mk_action_n_arg test_parse_c;
17ba0788 578 "--parse-h", " <file or dir>",
34e49164 579 Common.mk_action_n_arg test_parse_h;
17ba0788 580 "--parse-ch", " <file or dir>",
34e49164 581 Common.mk_action_n_arg test_parse_ch;
17ba0788 582 "--parse-i", " <file or dir>",
978fd7e5 583 Common.mk_action_n_arg test_parse_i;
1b9ae606
C
584 "--parse-c++", " <file or dir>",
585 Common.mk_action_n_arg new_test_parse_gen;
34e49164 586
17ba0788 587 "--parse", " <file or dir>",
708f4980
C
588 Common.mk_action_n_arg test_parse;
589
17ba0788 590 "--show-flow", " <file or file:function>",
c491d8ee 591 Common.mk_action_1_arg (local_test_cfg true);
17ba0788 592 "--control-flow", " <file or file:function>",
c491d8ee 593 Common.mk_action_1_arg (local_test_cfg true);
17ba0788 594 "--control-flow-to-file", " <file or file:function>",
c491d8ee 595 Common.mk_action_1_arg (local_test_cfg false);
17ba0788 596 "--test-cfg-ifdef", " <file>",
91eba41f 597 Common.mk_action_1_arg test_cfg_ifdef;
17ba0788 598 "--parse-unparse", " <file>",
34e49164 599 Common.mk_action_1_arg test_parse_unparse;
17ba0788 600(* "--parse-and-print-sexp", " <file>",
1eddfd50 601 Common.mk_action_1_arg parse_and_print_sexp;*)
17ba0788 602 "--type-c", " <file>",
34e49164 603 Common.mk_action_1_arg test_type_c;
17ba0788 604 "--compare-c", " <file1> <file2>",
34e49164 605 Common.mk_action_2_arg test_compare_c (* result is in unix code *);
17ba0788 606 "--comment-annotater-c", " <file>",
0708f913 607 Common.mk_action_1_arg test_comment_annotater;
34e49164 608
17ba0788 609 "--compare-c-hardcoded", " ",
34e49164
C
610 Common.mk_action_0_arg test_compare_c_hardcoded;
611
17ba0788 612 "--test-attributes", " <file>",
91eba41f 613 Common.mk_action_1_arg test_attributes;
17ba0788 614 "--test-cpp", " <file>",
91eba41f
C
615 Common.mk_action_1_arg test_cpp;
616
17ba0788 617 "--extract-macros", " <file or dir>",
708f4980
C
618 Common.mk_action_1_arg (extract_macros ~selection:false) ;
619
17ba0788 620 "--extract-macros-select", " <file or dir>",
708f4980 621 Common.mk_action_1_arg (extract_macros ~selection:true);
91eba41f
C
622
623
17ba0788 624 "--xxx", " <file1> <>",
34e49164
C
625 Common.mk_action_n_arg test_xxx;
626]
627