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

Aperta
#824 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@rak3-sh ci sta già lavorando.

Dal 22/12/2024.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.
Lingua principale
CodeQL
Stelle
227
Fork
82
Merge medio
6g 7h
PR unite (30g)
9

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/codeql-coding-standards

Tutte le issue di github/codeql-coding-standards

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.