clang-tidy recently gained support to allow dropping compiler args from the entries parsed from the compilation database. Let's make use of this to drop the two compiler args we use with gcc that clang doesn't support so we can run clang-tidy on meson build trees configured to use gcc without getting tons of false positives.
81 lines
2.7 KiB
YAML
81 lines
2.7 KiB
YAML
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
---
|
|
Checks: '
|
|
-*,
|
|
bugprone-argument-comment,
|
|
bugprone-chained-comparison,
|
|
bugprone-integer-division,
|
|
bugprone-misplaced-operator-in-strlen-in-alloc,
|
|
bugprone-misplaced-pointer-arithmetic-in-alloc,
|
|
bugprone-posix-return,
|
|
bugprone-redundant-branch-condition,
|
|
bugprone-sizeof-expression,
|
|
bugprone-suspicious-enum-usage,
|
|
bugprone-suspicious-semicolon,
|
|
bugprone-suspicious-string-compare,
|
|
bugprone-swapped-arguments,
|
|
bugprone-tautological-type-limits,
|
|
bugprone-unsafe-functions,
|
|
bugprone-unused-return-value,
|
|
misc-header-include-cycle,
|
|
misc-include-cleaner,
|
|
misc-misplaced-const,
|
|
misc-use-internal-linkage,
|
|
readability-avoid-const-params-in-decls,
|
|
readability-const-return-type,
|
|
readability-duplicate-include,
|
|
readability-inconsistent-declaration-parameter-name,
|
|
readability-misleading-indentation,
|
|
readability-named-parameter,
|
|
readability-redundant-casting,
|
|
readability-redundant-declaration,
|
|
readability-redundant-function-ptr-dereference
|
|
'
|
|
CheckOptions:
|
|
misc-include-cleaner.MissingIncludes: 'false'
|
|
# These all lead to common false positives by clang-tidy where it tries to
|
|
# remove these includes even though they're required in some situations (many
|
|
# of them related to musl).
|
|
misc-include-cleaner.IgnoreHeaders: '
|
|
endian\.h;
|
|
getopt\.h;
|
|
sys/stat\.h;
|
|
sys/statvfs\.h;
|
|
sys/syscall\.h;
|
|
sys/timex\.h;
|
|
sys/uio\.h;
|
|
netinet/in\.h;
|
|
net/if\.h;
|
|
net/if_arp\.h;
|
|
runtime-scope\.h;
|
|
varlink-io\.systemd\..*;
|
|
varlink-idl-common\.h;
|
|
unistd\.h
|
|
'
|
|
bugprone-unsafe-functions.ReportDefaultFunctions: false
|
|
bugprone-unsafe-functions.CustomFunctions: '
|
|
^fgets$,read_line(),is potentially dangerous;
|
|
^strtok$,extract_first_word(),is potentially dangerous;
|
|
^strsep$,extract_first_word(),is potentially dangerous;
|
|
^dup$,fcntl() with F_DUPFD_CLOEXEC,is potentially dangerous;
|
|
^htonl$,htobe32(),is confusing;
|
|
^htons$,htobe16(),is confusing;
|
|
^ntohl$,be32toh(),is confusing;
|
|
^ntohs$,be16toh(),is confusing;
|
|
^strerror$,STRERROR() or printf %m,is not thread-safe;
|
|
^accept$,accept4(),is not O_CLOEXEC-safe;
|
|
^dirname$,path_extract_directory(),is icky;
|
|
^basename$,path_extract_filename(),is icky;
|
|
^setmntent$,libmount_parse_fstab(),libmount parser should be used instead;
|
|
^getmntent$,mnt_table_next_fs(),libmount parser should be used instead
|
|
'
|
|
misc-header-include-cycle.IgnoredFilesList: 'glib-2.0'
|
|
RemovedArgs: ['-fwide-exec-charset=UCS2', '-maccumulate-outgoing-args']
|
|
WarningsAsErrors: '*'
|
|
ExcludeHeaderFilterRegex: 'blkid\.h|gmessages\.h|gstring\.h'
|
|
HeaderFileExtensions:
|
|
- h
|
|
ImplementationFileExtensions:
|
|
- c
|
|
...
|