Skip to content

Make C++17 required for ANTLR C++ runtime #3330

Closed

Description

@jcking

Making C++17 required for the ANTLR C++ runtime would allow usage of std::string_view, std::any, and many other additions. Using std::any would allow for potentially removing antlrcpp::Any and std::string_view would enable removing needless copying of strings at various locations of the runtime including the generated parsers/lexers.

Activity

  1. mike-lischke commented on Oct 31, 2021

    @mike-lischke
    Member

    I actually expect a PR for switching to std::any, but I lost track of who wanted to do that and post a PR. But I'm all for that switch.

  2. jcking commented on Nov 1, 2021

    @jcking
    CollaboratorAuthor

    I took a stab at getting rid of antlrcpp::Any, but I quickly found out that it is not compatible with std::any. std::any only supports casting to the same type that it was constructed with. antlrcpp::Any allows dynamic_cast. The only way out is to ultimately break source compatibility. IMO we should deprecate all the non-std::any compatible features, wait a bit, then remove it. Up to you though, not sure what ANTLR's policy is on that.

  3. mike-lischke commented on Nov 3, 2021

    @mike-lischke
    Member

    The thing is: there's only a single release per year, usually. Waiting would mean to delay the change by at least a year. Instead, we should just go ahead and switch. The older versions are still available for some time, if someone needs the old functionality.

  4. jcking commented on Nov 4, 2021

    @jcking
    CollaboratorAuthor

    That certainly makes things easier. I will then just switch antlrcpp::Any to std::any after #3335. Then proceed to replace std::string with std::string_view where applicable, especially in generated code to avoid making copies of strings literals that already have static storage duration.

  5. jcking commented on Dec 13, 2021

    @jcking
    CollaboratorAuthor

    Fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions