Skip to content

Commit 671f18f

Browse files
committed
Use cmdline.options consistently. NFC
We had some parts of the codebase that were using the ambient/global `cmdline.options` and other that were passing the options object around as as a param. For a tool like a compiler it think use the global options options object if pretty reasonable and keeps the code simple.
1 parent 6e20fdc commit 671f18f

5 files changed

Lines changed: 62 additions & 58 deletions

File tree

emcc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,17 +344,17 @@ def main(args):
344344
linker_args = [f.value for f in linker_args]
345345
# Delay import of link.py to avoid processing this file when only compiling
346346
from tools import link
347-
link.run_post_link(options.input_files[0], options, linker_args)
347+
link.run_post_link(options.input_files[0], linker_args)
348348
return 0
349349

350350
# Compile source code to object files
351351
# When only compiling this function never returns.
352-
linker_args = phase_compile_inputs(options, state, newargs)
352+
linker_args = phase_compile_inputs(state, newargs)
353353

354354
if state.mode == Mode.COMPILE_AND_LINK:
355355
# Delay import of link.py to avoid processing this file when only compiling
356356
from tools import link
357-
return link.run(options, linker_args)
357+
return link.run(linker_args)
358358
else:
359359
logger.debug('stopping after compile phase')
360360
return 0
@@ -502,7 +502,7 @@ def phase_setup(state):
502502

503503

504504
@ToolchainProfiler.profile_block('compile inputs')
505-
def phase_compile_inputs(options, state, newargs):
505+
def phase_compile_inputs(state, newargs):
506506
if shared.run_via_emxx:
507507
compiler = [shared.CLANG_CXX]
508508
else:

tools/cmdline.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
config,
1919
diagnostics,
2020
feature_matrix,
21-
ports,
2221
shared,
2322
utils,
2423
)
@@ -204,6 +203,9 @@ def parse_args(newargs): # ruff: ignore[complex-structure, too-many-branches, t
204203
205204
To revalidate these numbers, run `ruff check --select=C901,PLR091`.
206205
"""
206+
# TODO(sbc): Remove this import, or move it to the top, once we resolve the
207+
# circular dependency issue with ports/__init__.py -> system_libs.py -> cmdline.py
208+
from tools import ports
207209
should_exit = False
208210
skip = False
209211
builtin_settings = set(settings.keys())

0 commit comments

Comments
 (0)