`RULE-11-9`: Consider more types of assignment

Aperta
#671 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
devtools

Direzione di ricerca

Non sono indicati file di implementazione o test. Inizia individuando la query RULE-11-9 e tracciando come viene rappresentata l’assegnazione, quindi confrontala con le quattro operazioni di assegnazione elencate nell’issue. Il lavoro è completato quando la copertura di tali operazioni da parte della regola è definita e convalidata, incluse eventuali regole interessate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Difficulty-Low false positive/false negative Impact-Medium Standard-MISRA-C
Affected rules
  • RULE-11-9
Description

Rule 11.9 prohibits the use of 0 as a null pointer constant when assigning to a pointer. However, we do not capture all the types of assignments. The Glossary (Appendix J) states:

Assigned

An expression is assigned if it is the subject of an assignment.

Assignment

It is sometimes convenient to use the term assignment to denote any operation which takes place as if it were by assignment. The operations covered by this term are:
• Assignment by means of one of the assignment operators;
• Passing an argument to a function, in which case the argument is copied as if by assignment to the corresponding parameter;
• Returning an expression from a function, in which case the result is copied as if by assignment to an object with the function’s return type;
• Using an expression to initialize all or part of an object, including a compound literal in C99, in which case the expression is copied as if by assignment to the destination.

This may also impact other MISRA rules that refer to the term assignment or assigned.

Example
void* myfunc() {
  return 0; // NON_COMPLIANT
}
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

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.