cleanup: Run clang-tidy on headers, as well.

This commit is contained in:
iphydf 2023-12-27 01:43:03 +00:00
parent bd930cc80a
commit 6a90ddfe4e
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
12 changed files with 31 additions and 31 deletions

View File

@ -1,4 +1,5 @@
# vim:ft=yaml # vim:ft=yaml
HeaderFilterRegex: "/c-toxcore/[^/]+/[^.].+"
CheckOptions: CheckOptions:
- key: readability-identifier-naming.ClassCase - key: readability-identifier-naming.ClassCase
value: Camel_Snake_Case value: Camel_Snake_Case
@ -35,7 +36,7 @@ CheckOptions:
value: lower_case value: lower_case
- key: llvmlibc-restrict-system-libc-headers.Includes - key: llvmlibc-restrict-system-libc-headers.Includes
value: "arpa/inet.h,assert.h,ctype.h,errno.h,fcntl.h,getopt.h,libconfig.h,limits.h,linux/if.h,math.h,netdb.h,netinet/in.h,opus.h,pthread.h,signal.h,sodium/crypto_scalarmult_curve25519.h,sodium.h,sodium/randombytes.h,stdarg.h,stdbool.h,stdint.h,stdio.h,stdlib.h,string.h,sys/ioctl.h,syslog.h,sys/resource.h,sys/socket.h,sys/stat.h,sys/time.h,sys/types.h,time.h,unistd.h,vpx/vp8cx.h,vpx/vp8dx.h,vpx/vpx_decoder.h,vpx/vpx_encoder.h,vpx/vpx_image.h" value: "arpa/inet.h,assert.h,ctype.h,errno.h,fcntl.h,getopt.h,libconfig.h,limits.h,linux/if.h,math.h,netdb.h,netinet/in.h,opus.h,pthread.h,signal.h,sodium/crypto_scalarmult_curve25519.h,sodium.h,sodium/randombytes.h,stdarg.h,stdbool.h,stddef.h,stdint.h,stdio.h,stdlib.h,string.h,sys/ioctl.h,syslog.h,sys/resource.h,sys/socket.h,sys/stat.h,sys/time.h,sys/types.h,time.h,unistd.h,vpx/vp8cx.h,vpx/vp8dx.h,vpx/vpx_decoder.h,vpx/vpx_encoder.h,vpx/vpx_image.h"
- key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals - key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals
value: true value: true
- key: concurrency-mt-unsafe.FunctionSet - key: concurrency-mt-unsafe.FunctionSet

View File

@ -14,7 +14,6 @@ branches:
contexts: contexts:
- "bazel-dbg" - "bazel-dbg"
- "bazel-opt" - "bazel-opt"
- "build-alpine-s390x"
- "build-android" - "build-android"
- "build-autotools" - "build-autotools"
- "build-compcert" - "build-compcert"

View File

@ -168,7 +168,7 @@ run() {
if ! find "${DIRS[@]}" \ if ! find "${DIRS[@]}" \
-maxdepth 1 -name "*.c" -print0 \ -maxdepth 1 -name "*.c" -print0 \
| xargs -0 -n15 -P"$(nproc)" clang-tidy \ | xargs -0 -n15 -P"$(nproc)" clang-tidy \
-p=_build \ -p="$PWD/_build" \
--extra-arg=-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_TRACE \ --extra-arg=-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_TRACE \
"${EXTRA_ARGS[@]}" \ "${EXTRA_ARGS[@]}" \
--fix \ --fix \

View File

@ -16,6 +16,6 @@ RUN ["apk", "add", "--no-cache", \
ENV CC=clang CXX=clang++ ENV CC=clang CXX=clang++
COPY . /src/workspace/c-toxcore/ COPY . /c-toxcore/
WORKDIR /src/workspace/c-toxcore WORKDIR /c-toxcore
RUN other/analysis/run-clang-tidy RUN other/analysis/run-clang-tidy

View File

@ -232,7 +232,7 @@ int unpack_ip_port(IP_Port *ip_port, const uint8_t *data, uint16_t length, bool
non_null() non_null()
int dht_create_packet(const Memory *mem, const Random *rng, int dht_create_packet(const Memory *mem, const Random *rng,
const uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE], const uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE],
const uint8_t *shared_key, const uint8_t type, const uint8_t *shared_key, uint8_t type,
const uint8_t *plain, size_t plain_length, const uint8_t *plain, size_t plain_length,
uint8_t *packet, size_t length); uint8_t *packet, size_t length);

View File

@ -2,8 +2,8 @@
* Copyright © 2022 The TokTok team. * Copyright © 2022 The TokTok team.
*/ */
#ifndef C_TOXCORE_TOXCORE_TOX_EVENTS_INTERNAL_H #ifndef C_TOXCORE_TOXCORE_EVENTS_EVENTS_ALLOC_H
#define C_TOXCORE_TOXCORE_TOX_EVENTS_INTERNAL_H #define C_TOXCORE_TOXCORE_EVENTS_EVENTS_ALLOC_H
#include "../attributes.h" #include "../attributes.h"
#include "../bin_pack.h" #include "../bin_pack.h"
@ -213,4 +213,4 @@ Tox_Events_State *tox_events_alloc(void *user_data);
} }
#endif #endif
#endif // C_TOXCORE_TOXCORE_TOX_EVENTS_INTERNAL_H #endif // C_TOXCORE_TOXCORE_EVENTS_EVENTS_ALLOC_H

View File

@ -6,8 +6,8 @@
/** /**
* Similar to ping.h, but designed for group chat purposes * Similar to ping.h, but designed for group chat purposes
*/ */
#ifndef GROUP_ANNOUNCE_H #ifndef C_TOXCORE_TOXCORE_GROUP_ANNOUNCE_H
#define GROUP_ANNOUNCE_H #define C_TOXCORE_TOXCORE_GROUP_ANNOUNCE_H
#include <stdbool.h> #include <stdbool.h>
@ -215,4 +215,4 @@ bool gca_is_valid_announce(const GC_Announce *announce);
} // extern "C" } // extern "C"
#endif #endif
#endif // GROUP_ANNOUNCE_H #endif // C_TOXCORE_TOXCORE_GROUP_ANNOUNCE_H

View File

@ -7,8 +7,8 @@
* An implementation of massive text only group chats. * An implementation of massive text only group chats.
*/ */
#ifndef GROUP_CHATS_H #ifndef C_TOXCORE_TOXCORE_GROUP_CHATS_H
#define GROUP_CHATS_H #define C_TOXCORE_TOXCORE_GROUP_CHATS_H
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
@ -805,4 +805,4 @@ GC_Chat *gc_get_group_by_public_key(const GC_Session *c, const uint8_t *public_k
non_null() non_null()
int gc_add_peers_from_announces(GC_Chat *chat, const GC_Announce *announces, uint8_t gc_announces_count); int gc_add_peers_from_announces(GC_Chat *chat, const GC_Announce *announces, uint8_t gc_announces_count);
#endif // GROUP_CHATS_H #endif // C_TOXCORE_TOXCORE_GROUP_CHATS_H

View File

@ -6,8 +6,8 @@
* Common groupchat data structures. * Common groupchat data structures.
*/ */
#ifndef GROUP_COMMON_H #ifndef C_TOXCORE_TOXCORE_GROUP_COMMON_H
#define GROUP_COMMON_H #define C_TOXCORE_TOXCORE_GROUP_COMMON_H
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
@ -410,4 +410,4 @@ int unpack_gc_saved_peers(GC_Chat *chat, const uint8_t *data, uint16_t length);
non_null(1, 2) nullable(4) non_null(1, 2) nullable(4)
int pack_gc_saved_peers(const GC_Chat *chat, uint8_t *data, uint16_t length, uint16_t *processed); int pack_gc_saved_peers(const GC_Chat *chat, uint8_t *data, uint16_t length, uint16_t *processed);
#endif // GROUP_COMMON_H #endif // C_TOXCORE_TOXCORE_GROUP_COMMON_H

View File

@ -7,8 +7,8 @@
* An implementation of massive text only group chats. * An implementation of massive text only group chats.
*/ */
#ifndef GROUP_CONNECTION_H #ifndef C_TOXCORE_TOXCORE_GROUP_CONNECTION_H
#define GROUP_CONNECTION_H #define C_TOXCORE_TOXCORE_GROUP_CONNECTION_H
#include "group_common.h" #include "group_common.h"
@ -186,4 +186,4 @@ void gcc_peer_cleanup(GC_Connection *gconn);
non_null() non_null()
void gcc_cleanup(const GC_Chat *chat); void gcc_cleanup(const GC_Chat *chat);
#endif // GROUP_CONNECTION_H #endif // C_TOXCORE_TOXCORE_GROUP_CONNECTION_H

View File

@ -7,8 +7,8 @@
* Packer and unpacker functions for saving and loading groups. * Packer and unpacker functions for saving and loading groups.
*/ */
#ifndef GROUP_PACK_H #ifndef C_TOXCORE_TOXCORE_GROUP_PACK_H
#define GROUP_PACK_H #define C_TOXCORE_TOXCORE_GROUP_PACK_H
#include <stdbool.h> #include <stdbool.h>
@ -37,4 +37,4 @@ bool group_privacy_state_from_int(uint8_t value, Group_Privacy_State *out);
non_null() non_null()
bool group_voice_state_from_int(uint8_t value, Group_Voice_State *out); bool group_voice_state_from_int(uint8_t value, Group_Voice_State *out);
#endif // GROUP_PACK_H #endif // C_TOXCORE_TOXCORE_GROUP_PACK_H

View File

@ -228,13 +228,13 @@ Onion_Connection_Status onion_connection_status(const Onion_Client *onion_c);
typedef struct Onion_Friend Onion_Friend; typedef struct Onion_Friend Onion_Friend;
non_null() uint16_t onion_get_friend_count(const Onion_Client *const onion_c); non_null() uint16_t onion_get_friend_count(const Onion_Client *onion_c);
non_null() Onion_Friend *onion_get_friend(const Onion_Client *const onion_c, uint16_t friend_num); non_null() Onion_Friend *onion_get_friend(const Onion_Client *onion_c, uint16_t friend_num);
non_null() const uint8_t *onion_friend_get_gc_public_key(const Onion_Friend *const onion_friend); non_null() const uint8_t *onion_friend_get_gc_public_key(const Onion_Friend *onion_friend);
non_null() const uint8_t *onion_friend_get_gc_public_key_num(const Onion_Client *const onion_c, uint32_t num); non_null() const uint8_t *onion_friend_get_gc_public_key_num(const Onion_Client *onion_c, uint32_t num);
non_null() void onion_friend_set_gc_public_key(Onion_Friend *const onion_friend, const uint8_t *public_key); non_null() void onion_friend_set_gc_public_key(Onion_Friend *onion_friend, const uint8_t *public_key);
non_null(1) nullable(2) non_null(1) nullable(2)
void onion_friend_set_gc_data(Onion_Friend *const onion_friend, const uint8_t *gc_data, uint16_t gc_data_length); void onion_friend_set_gc_data(Onion_Friend *onion_friend, const uint8_t *gc_data, uint16_t gc_data_length);
non_null() bool onion_friend_is_groupchat(const Onion_Friend *const onion_friend); non_null() bool onion_friend_is_groupchat(const Onion_Friend *onion_friend);
#endif #endif