|
10 | 10 |
|
11 | 11 | #include <util/c_types.h>
|
12 | 12 | #include <util/config.h>
|
| 13 | +#include <util/run.h> |
13 | 14 | #include <util/suffix.h>
|
14 | 15 | #include <util/tempfile.h>
|
15 | 16 | #include <util/unicode.h>
|
@@ -383,8 +384,9 @@ bool c_preprocess_visual_studio(
|
383 | 384 | command += " 2> \"" + stderr_file() + "\"";
|
384 | 385 |
|
385 | 386 | // _popen isn't very reliable on WIN32
|
386 |
| - // that's why we use system() |
387 |
| - int result=system(command.c_str()); |
| 387 | + // that's why we use run() |
| 388 | + int result = |
| 389 | + run("cl", {"cl", "@" + command_file_name()}, "", tmpi(), stderr_file()); |
388 | 390 |
|
389 | 391 | std::ifstream instream(tmpi());
|
390 | 392 |
|
@@ -463,30 +465,30 @@ bool c_preprocess_codewarrior(
|
463 | 465 |
|
464 | 466 | temporary_filet stderr_file("tmp.stderr", "");
|
465 | 467 |
|
466 |
| - std::string command; |
467 |
| - |
468 |
| - command="mwcceppc -E -P -D__CPROVER__ -ppopt line -ppopt full"; |
| 468 | + std::vector<std::string> command = |
| 469 | + { "mwcceppc", "-E", "-P", "-D__CPROVER__", "-ppopt", "line", "-ppopt full" }; |
469 | 470 |
|
470 | 471 | for(const auto &define : config.ansi_c.defines)
|
471 |
| - command+=" -D"+shell_quote(define); |
| 472 | + command.push_back(" -D"+define); |
472 | 473 |
|
473 | 474 | for(const auto &include_path : config.ansi_c.include_paths)
|
474 |
| - command+=" -I"+shell_quote(include_path); |
| 475 | + command.push_back(" -I"+include_path); |
475 | 476 |
|
476 | 477 | for(const auto &include_file : config.ansi_c.include_files)
|
477 |
| - command+=" -include "+shell_quote(include_file); |
| 478 | + { |
| 479 | + command.push_back(" -include"); |
| 480 | + command.push_back(include_file); |
| 481 | + } |
478 | 482 |
|
479 | 483 | for(const auto &opt : config.ansi_c.preprocessor_options)
|
480 |
| - command+=" "+opt; |
481 |
| - |
482 |
| - int result; |
| 484 | + command.push_back(opt); |
483 | 485 |
|
484 | 486 | temporary_filet tmpi("tmp.cl", "");
|
485 |
| - command+=" \""+file+"\""; |
486 |
| - command += " -o \"" + tmpi() + "\""; |
487 |
| - command += " 2> \"" + stderr_file() + "\""; |
| 487 | + command.push_back(file); |
| 488 | + command.push_back("-o"); |
| 489 | + command.push_back(tmpi()); |
488 | 490 |
|
489 |
| - result=system(command.c_str()); |
| 491 | + int result = run(command[0], command, "", "", stderr_file()); |
490 | 492 |
|
491 | 493 | std::ifstream stream_i(tmpi());
|
492 | 494 |
|
@@ -667,7 +669,7 @@ bool c_preprocess_gcc_clang(
|
667 | 669 | command += " 2> \"" + stderr_file() + "\"";
|
668 | 670 |
|
669 | 671 | // _popen isn't very reliable on WIN32
|
670 |
| - // that's why we use system() and a temporary file |
| 672 | + // that's why we use run() and a temporary file |
671 | 673 | result=system(command.c_str());
|
672 | 674 |
|
673 | 675 | std::ifstream instream(tmpi());
|
|
0 commit comments