From 95a728eca923cabd584fcb833a88e36e7e687fc1 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Sun, 21 Jan 2024 00:02:59 +0000 Subject: [PATCH] Restore 'no input files' error This change partially reverts #20905. Fixes: #21116 --- test/test_other.py | 3 +++ tools/link.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test/test_other.py b/test/test_other.py index 9e6960aaf100c..5c2546d2035ec 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -14432,6 +14432,9 @@ def test_no_input_files(self): err = self.expect_fail([EMCC, '-c']) self.assertContained('clang: error: no input files', err) + err = self.expect_fail([EMCC]) + self.assertContained('emcc: error: no input files', err) + def test_embind_negative_enum_values(self): # Test if negative enum values are printed correctly and not overflown to # large values when CAN_ADDRESS_2GB is true. diff --git a/tools/link.py b/tools/link.py index 9e58b95e8fc28..3d22861f82771 100644 --- a/tools/link.py +++ b/tools/link.py @@ -2958,6 +2958,9 @@ def run(linker_inputs, options, state, newargs): # We have now passed the compile phase, allow reading/writing of all settings. settings.limit_settings(None) + if not linker_inputs and not state.link_flags: + exit_with_error('no input files') + if options.output_file and options.output_file.startswith('-'): exit_with_error(f'invalid output filename: `{options.output_file}`')