`A15-4-4`: Query incorrectly alerts functions that raise/can raise exceptions

Đang mở
#824 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@rak3-sh đang làm issue này rồi.

Từ ngày 22/12/2024.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Difficulty-Medium false positive/false negative Impact-Low
Affected rules

A15-4-4

Description
  1. Query doesn’t consider ReThrowExpr. E.g. the query says to mark rethrow() below as noexcept
Example
template <bool DoRethrow>
void rethrow() {
  throw;
}

int main()
{
  rethrow<true>();
  return 0;
}
  1. The query doesn’t check for throw expressions that occur inside lambdas defined in a function. E.g.
Example
void func()  {
    std::call_once(init_flag_, [this] {
      if (sem_init(&sem_, 0, 0) != 0) {
        throw std::system_error(errno, std::system_category()); // Throw in a lambda.
      }
      initialized_ = true;
    });
  }
  1. In some cases the noexcept specification is a complex condition involving several logical operations or template instantiations. In such a case, CodeQL’s check for whether its noexcept(true) or noexcept explicitly false doesn’t work and it alerts that it can be marked as noexcept. For practical reasons, maybe we can consider a noexcept(expr) as being marked by the user as correct.
Ngôn ngữ chính
CodeQL
Star
227
Fork
82
Merge trung bình
6 ngày 7 giờ
Pull request đã merge (30 ngày)
9

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/codeql-coding-standards

Tất cả issue của github/codeql-coding-standards

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.