| ... | ... | @@ -1791,6 +1791,7 @@ fn buildOutputType( |
| 1791 | 1791 | var c_out_mode: ?COutMode = null; |
| 1792 | 1792 | var out_path: ?[]const u8 = null; |
| 1793 | 1793 | var is_shared_lib = false; |
| 1794 | var preprocessor_args = std.ArrayList([]const u8).init(arena); |
| 1794 | 1795 | var linker_args = std.ArrayList([]const u8).init(arena); |
| 1795 | 1796 | var it = ClangArgIterator.init(arena, all_args); |
| 1796 | 1797 | var emit_llvm = false; |
| ... | ... | @@ -1946,6 +1947,24 @@ fn buildOutputType( |
| 1946 | 1947 | is_shared_lib = true; |
| 1947 | 1948 | }, |
| 1948 | 1949 | .rdynamic => create_module.opts.rdynamic = true, |
| 1950 | .wp => { |
| 1951 | var split_it = mem.splitScalar(u8, it.only_arg, ','); |
| 1952 | while (split_it.next()) |preprocessor_arg| { |
| 1953 | if (preprocessor_arg.len >= 3 and |
| 1954 | preprocessor_arg[0] == '-' and |
| 1955 | preprocessor_arg[2] != '-') |
| 1956 | { |
| 1957 | if (mem.indexOfScalar(u8, preprocessor_arg, '=')) |equals_pos| { |
| 1958 | const key = preprocessor_arg[0..equals_pos]; |
| 1959 | const value = preprocessor_arg[equals_pos + 1 ..]; |
| 1960 | try preprocessor_args.append(key); |
| 1961 | try preprocessor_args.append(value); |
| 1962 | continue; |
| 1963 | } |
| 1964 | } |
| 1965 | try preprocessor_args.append(preprocessor_arg); |
| 1966 | } |
| 1967 | }, |
| 1949 | 1968 | .wl => { |
| 1950 | 1969 | var split_it = mem.splitScalar(u8, it.only_arg, ','); |
| 1951 | 1970 | while (split_it.next()) |linker_arg| { |
| ... | ... | @@ -2554,6 +2573,20 @@ fn buildOutputType( |
| 2554 | 2573 | } |
| 2555 | 2574 | } |
| 2556 | 2575 | |
| 2576 | // Parse preprocessor args. |
| 2577 | var preprocessor_args_it = ArgsIterator{ |
| 2578 | .args = preprocessor_args.items, |
| 2579 | }; |
| 2580 | while (preprocessor_args_it.next()) |arg| { |
| 2581 | if (mem.eql(u8, arg, "-MD") or mem.eql(u8, arg, "-MMD") or mem.eql(u8, arg, "-MT")) { |
| 2582 | disable_c_depfile = true; |
| 2583 | const cc_arg = try std.fmt.allocPrint(arena, "-Wp,{s},{s}", .{ arg, preprocessor_args_it.nextOrFatal() }); |
| 2584 | try cc_argv.append(arena, cc_arg); |
| 2585 | } else { |
| 2586 | fatal("unsupported preprocessor arg: {s}", .{arg}); |
| 2587 | } |
| 2588 | } |
| 2589 | |
| 2557 | 2590 | if (mod_opts.sanitize_c) |wsc| { |
| 2558 | 2591 | if (wsc and mod_opts.optimize_mode == .ReleaseFast) { |
| 2559 | 2592 | mod_opts.optimize_mode = .ReleaseSafe; |
| ... | ... | @@ -5771,6 +5804,7 @@ pub const ClangArgIterator = struct { |
| 5771 | 5804 | shared, |
| 5772 | 5805 | rdynamic, |
| 5773 | 5806 | wl, |
| 5807 | wp, |
| 5774 | 5808 | preprocess_only, |
| 5775 | 5809 | asm_only, |
| 5776 | 5810 | optimize, |