|
101 | 101 |
|
102 | 102 | @unique |
103 | 103 | class Mode(Enum): |
104 | | - PREPROCESS_ONLY = auto() |
105 | | - PCH = auto() |
| 104 | + # Used any time we are not linking, including PCH, pre-processing, etc |
106 | 105 | COMPILE_ONLY = auto() |
| 106 | + # Only when --post-link is specified |
107 | 107 | POST_LINK_ONLY = auto() |
| 108 | + # This is the default mode, in the absence of any flags such as -c, -E, etc |
108 | 109 | COMPILE_AND_LINK = auto() |
109 | 110 |
|
110 | 111 |
|
@@ -826,14 +827,10 @@ def phase_setup(options, state, newargs): |
826 | 827 |
|
827 | 828 | if options.post_link: |
828 | 829 | state.mode = Mode.POST_LINK_ONLY |
829 | | - elif options.dash_E or options.dash_M: |
830 | | - state.mode = Mode.PREPROCESS_ONLY |
831 | | - elif has_header_inputs: |
832 | | - state.mode = Mode.PCH |
833 | | - elif options.dash_c or options.dash_S or options.syntax_only: |
| 830 | + elif has_header_inputs or options.dash_c or options.dash_S or options.syntax_only or options.dash_E or options.dash_M: |
834 | 831 | state.mode = Mode.COMPILE_ONLY |
835 | 832 |
|
836 | | - if state.mode in (Mode.COMPILE_ONLY, Mode.PREPROCESS_ONLY): |
| 833 | + if state.mode == Mode.COMPILE_ONLY: |
837 | 834 | for key in user_settings: |
838 | 835 | if key not in COMPILE_TIME_SETTINGS: |
839 | 836 | diagnostics.warning( |
@@ -983,23 +980,6 @@ def get_clang_command_preprocessed(): |
983 | 980 | def get_clang_command_asm(): |
984 | 981 | return compiler + get_target_flags() |
985 | 982 |
|
986 | | - # preprocessor-only (-E/-M) support |
987 | | - if state.mode == Mode.PREPROCESS_ONLY: |
988 | | - cmd = get_clang_command() + newargs |
989 | | - # Do not compile, but just output the result from preprocessing stage or |
990 | | - # output the dependency rule. Warning: clang and gcc behave differently |
991 | | - # with -MF! (clang seems to not recognize it) |
992 | | - logger.debug(('just preprocessor: ' if options.dash_E else 'just dependencies: ') + ' '.join(cmd)) |
993 | | - shared.exec_process(cmd) |
994 | | - assert False, 'exec_process does not return' |
995 | | - |
996 | | - # Precompiled headers support |
997 | | - if state.mode == Mode.PCH: |
998 | | - cmd = get_clang_command() + newargs |
999 | | - logger.debug(f"running (for precompiled headers): {cmd[0]} {' '.join(cmd[1:])}") |
1000 | | - shared.exec_process(cmd) |
1001 | | - assert False, 'exec_process does not return' |
1002 | | - |
1003 | 983 | if state.mode == Mode.COMPILE_ONLY: |
1004 | 984 | if options.output_file and get_file_suffix(options.output_file) == '.bc' and not settings.LTO and '-emit-llvm' not in state.orig_args: |
1005 | 985 | diagnostics.warning('emcc', '.bc output file suffix used without -flto or -emit-llvm. Consider using .o extension since emcc will output an object file, not a bitcode file') |
|
0 commit comments