Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Mark LOG(FATAL) with [[noreturn]] #28

@orian

Description

@orian

Example:

int Find(const std::vector<int>& x) {
  // proper code with return statement for all correct input values
  LOG(FATAL) << "x is bad";
}

The above code during compilation shows a warning:

warning: control may reach end of non-void function [-Wreturn-type]

The warning in general is useful, what about marking a subclass responsible for fatal messages with [[noreturn]]?

Sources:
[1] http://stackoverflow.com/questions/12146772/can-i-tell-the-compiler-to-consider-a-control-path-closed-with-regards-to-return
[2] http://en.cppreference.com/w/cpp/language/attributes

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