`DCL51-CPP`: Only reserve function names when used within the global namespace
@lcartey ci sta già lavorando.
Dal 14/1/2024.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Affected rules
DCL51-CPP
Description
The rule currently enforces that function names defined in standard library headers are not reused in any namespace. However, a careful re-reading of the C++ standard suggests that's overly specific. [reserved.names] specifically states that the only kinds of name that are reserved are macros, "global names" and "names with external linkage". In [extern.names], the standard says:
Each global function signature declared with external linkage in a header is reserved to the implementation to designate that function signature with external linkage.
So only global function signatures are reserved, and only where they have external linkage. I think we need to do the following:
- Apply only to the global namespace
- Filter list of reserved function names by those that appear in the global namespace and have external linkage (this may already be the case).
- Match function signatures (I believe it is valid to reuse the name as long as the signature is different).
We may also need to review the rules for objects and _ prefixes.
Example
namespace MyNamespace {
void all_of(); // 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Apertafalse positive/false negative
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
github/codeql-coding-standards#1175 ·