Skip to content

[CLI] Report errors for command line options that have no effect #11629

@cameel

Description

@cameel

Abstract

The compiler is pretty lax about command-line options whose values it does not use and just ignores many of them. It should report errors instead.

Over time we've started adding checks against this (e.g. #9075, #9364) they they're still very incomplete.

Motivation

Not getting an error when an option is invalid makes it harder for the user to realize that. It's especially problematic with options that seem to make sense together:

Specification

  • There are several input modes (compiler, linker, assembler, standard JSON) and many options are not valid in one of these modes. The invalid ones should produce an error.
  • Options that have equivalents and Standard JSON should be errors when --standard-json is used. For example:
  • Please also check options whose values are not ignored by CommandLineParser but are still not used by CommandLineInterface.

Backwards Compatibility

This does not introduce any backwards-incompatible changes to the language itself but any command-line tools relying on the current behavior of options being ignored will be affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    easy difficultygood first issue candidateCould be a "good first issue" but something is blocking it or it has open questions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions