Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ CheckOptions:
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.EnumPrefix, value: SolidSyslog }

# Tier 1 — public enum constants on named (tagged) enums: SolidSyslogClass_Constant.
# Anonymous enums (Tier 1 public macro-equivalents and Tier 2 file-scope
# named-constant idiom) use SCREAMING_SNAKE — that is the project's macro
# shape and is accepted via the IgnoredRegexp below. Decided in S10.12; see
# docs/NAMING.md "Anonymous-enum named-constant idiom".
- { key: readability-identifier-naming.EnumConstantCase, value: aNy_CasE }
- { key: readability-identifier-naming.EnumConstantPrefix, value: SolidSyslog }
- { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: '^[A-Z][A-Z0-9_]*$' }
# Enum constants — SCREAMING_SNAKE tree-wide, no exceptions.
# Tagged public enums: SOLIDSYSLOG_CLASS_MEMBER
# Anonymous public enums: SOLIDSYSLOG_NAME (e.g. SOLIDSYSLOG_STREAM_SENDER_SIZE)
# Anonymous TU-local: NAME (e.g. IPV4_HEADER_BYTES)
# Single rule, mechanically enforced. SOLIDSYSLOG_ prefix on public sites
# is enforced by review + cppcheck-misra 5.4 distinctness (clang-tidy
# cannot distinguish public from TU-local enum constants syntactically).
# Decided in S10.22; see docs/NAMING.md "Enum constants".
- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }

# Tier 1 — public typedefs (enum / function-pointer only per NAMING.md):
# SolidSyslogClass or SolidSyslogClass_Fn
Expand Down
12 changes: 6 additions & 6 deletions Bdd/Targets/FreeRtos/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ static uint16_t port = (uint16_t) BDD_TARGET_UDP_PORT;
static uint32_t endpointVersion = 0U;

static struct SolidSyslogMessage testMessage = {
.Facility = SolidSyslogFacility_Local0,
.Severity = SolidSyslogSeverity_Informational,
.Facility = SOLIDSYSLOG_FACILITY_LOCAL0,
.Severity = SOLIDSYSLOG_SEVERITY_INFORMATIONAL,
.MessageId = messageId,
.Msg = msg,
};
Expand All @@ -170,7 +170,7 @@ enum
};

static SolidSyslogCircularBufferStorage
bufferStorage[SOLIDSYSLOG_CIRCULARBUFFER_STORAGE_SIZE(BDD_TARGET_BUFFER_MESSAGES)];
bufferStorage[SOLIDSYSLOG_CIRCULAR_BUFFER_STORAGE_SIZE(BDD_TARGET_BUFFER_MESSAGES)];
static SolidSyslogFreeRtosMutexStorage mutexStorage;

/* Lifecycle mutex serialises SolidSyslog_Service against the rebuild path
Expand Down Expand Up @@ -537,13 +537,13 @@ static enum SolidSyslogDiscardPolicy MapDiscardPolicy(const char* policy)
{
if (strcmp(policy, "newest") == 0)
{
return SolidSyslogDiscardPolicy_Newest;
return SOLIDSYSLOG_DISCARD_POLICY_NEWEST;
}
if (strcmp(policy, "halt") == 0)
{
return SolidSyslogDiscardPolicy_Halt;
return SOLIDSYSLOG_DISCARD_POLICY_HALT;
}
return SolidSyslogDiscardPolicy_Oldest;
return SOLIDSYSLOG_DISCARD_POLICY_OLDEST;
}

static void OnStoreFull(void* context)
Expand Down
4 changes: 2 additions & 2 deletions Bdd/Targets/Linux/BddTargetCommandLine.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ static bool IsValidDiscardPolicy(const char* policy)

int BddTargetCommandLine_Parse(int argc, char* argv[], struct BddTargetOptions* options)
{
options->Facility = SolidSyslogFacility_Local0;
options->Severity = SolidSyslogSeverity_Informational;
options->Facility = SOLIDSYSLOG_FACILITY_LOCAL0;
options->Severity = SOLIDSYSLOG_SEVERITY_INFORMATIONAL;
options->MessageId = NULL;
options->Msg = NULL;
options->AppName = NULL;
Expand Down
6 changes: 3 additions & 3 deletions Bdd/Targets/Linux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ static enum SolidSyslogDiscardPolicy MapDiscardPolicy(const char* policy)
{
if (strcmp(policy, "newest") == 0)
{
return SolidSyslogDiscardPolicy_Newest;
return SOLIDSYSLOG_DISCARD_POLICY_NEWEST;
}
if (strcmp(policy, "halt") == 0)
{
return SolidSyslogDiscardPolicy_Halt;
return SOLIDSYSLOG_DISCARD_POLICY_HALT;
}
return SolidSyslogDiscardPolicy_Oldest;
return SOLIDSYSLOG_DISCARD_POLICY_OLDEST;
}

static volatile bool haltExit;
Expand Down
8 changes: 4 additions & 4 deletions Bdd/Targets/Windows/BddTargetWindows.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static const char* const THRESHOLD_MARKER_PATH = "Bdd/output/solidsyslog_thresho
static SolidSyslogWinsockTcpStreamStorage tcpStreamStorage;
static SolidSyslogStreamSenderStorage tcpSenderStorage;
static SolidSyslogCircularBufferStorage
bufferStorage[SOLIDSYSLOG_CIRCULARBUFFER_STORAGE_SIZE(BDD_TARGET_BUFFER_MESSAGES)];
bufferStorage[SOLIDSYSLOG_CIRCULAR_BUFFER_STORAGE_SIZE(BDD_TARGET_BUFFER_MESSAGES)];
static SolidSyslogWindowsMutexStorage mutexStorage;
static SolidSyslogWindowsAtomicCounterStorage counterStorage;
static volatile bool shutdownFlag;
Expand Down Expand Up @@ -136,13 +136,13 @@ static enum SolidSyslogDiscardPolicy MapDiscardPolicy(const char* policy)
{
if (strcmp(policy, "newest") == 0)
{
return SolidSyslogDiscardPolicy_Newest;
return SOLIDSYSLOG_DISCARD_POLICY_NEWEST;
}
if (strcmp(policy, "halt") == 0)
{
return SolidSyslogDiscardPolicy_Halt;
return SOLIDSYSLOG_DISCARD_POLICY_HALT;
}
return SolidSyslogDiscardPolicy_Oldest;
return SOLIDSYSLOG_DISCARD_POLICY_OLDEST;
}

static volatile bool haltExit;
Expand Down
4 changes: 2 additions & 2 deletions Bdd/Targets/Windows/BddTargetWindowsCommandLine.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ static bool ParsePositiveSize(const char* text, size_t* out)

void BddTargetWindowsCommandLine_Parse(int argc, char* argv[], struct BddTargetWindowsOptions* options)
{
options->Facility = SolidSyslogFacility_Local0;
options->Severity = SolidSyslogSeverity_Informational;
options->Facility = SOLIDSYSLOG_FACILITY_LOCAL0;
options->Severity = SOLIDSYSLOG_SEVERITY_INFORMATIONAL;
options->Transport = "udp";
options->MessageId = NULL;
options->Msg = NULL;
Expand Down
10 changes: 5 additions & 5 deletions Core/Interface/SolidSyslogBlockStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ EXTERN_C_BEGIN

enum SolidSyslogDiscardPolicy
{
SolidSyslogDiscardPolicy_Oldest,
SolidSyslogDiscardPolicy_Newest,
SolidSyslogDiscardPolicy_Halt
SOLIDSYSLOG_DISCARD_POLICY_OLDEST,
SOLIDSYSLOG_DISCARD_POLICY_NEWEST,
SOLIDSYSLOG_DISCARD_POLICY_HALT
};

typedef void (*SolidSyslogStoreFullCallback)(void* context);
Expand Down Expand Up @@ -50,13 +50,13 @@ EXTERN_C_BEGIN

enum
{
SOLIDSYSLOG_BLOCKSTORE_STORAGE_SIZE =
SOLIDSYSLOG_BLOCK_STORE_STORAGE_SIZE =
(sizeof(intptr_t) * 32U) + SOLIDSYSLOG_MAX_MESSAGE_SIZE + SOLIDSYSLOG_MAX_INTEGRITY_SIZE + 16U
};

typedef struct
{
intptr_t slots[(SOLIDSYSLOG_BLOCKSTORE_STORAGE_SIZE + sizeof(intptr_t) - 1U) / sizeof(intptr_t)];
intptr_t slots[(SOLIDSYSLOG_BLOCK_STORE_STORAGE_SIZE + sizeof(intptr_t) - 1U) / sizeof(intptr_t)];
} SolidSyslogBlockStoreStorage;

struct SolidSyslogStore* SolidSyslogBlockStore_Create(
Expand Down
14 changes: 7 additions & 7 deletions Core/Interface/SolidSyslogCircularBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ EXTERN_C_BEGIN

enum
{
SOLIDSYSLOG_CIRCULARBUFFER_OVERHEAD = 7,
SOLIDSYSLOG_CIRCULARBUFFER_HEADER_BYTES = sizeof(uint16_t)
SOLIDSYSLOG_CIRCULAR_BUFFER_OVERHEAD = 7,
SOLIDSYSLOG_CIRCULAR_BUFFER_HEADER_BYTES = sizeof(uint16_t)
};

/* NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -- cannot compute array size as a constexpr in C */
#define SOLIDSYSLOG_CIRCULARBUFFER_STORAGE_SIZE_BYTES(ringBytes) \
(SOLIDSYSLOG_CIRCULARBUFFER_OVERHEAD + \
#define SOLIDSYSLOG_CIRCULAR_BUFFER_STORAGE_SIZE_BYTES(ringBytes) \
(SOLIDSYSLOG_CIRCULAR_BUFFER_OVERHEAD + \
(((ringBytes) + sizeof(SolidSyslogCircularBufferStorage) - 1U) / sizeof(SolidSyslogCircularBufferStorage)))

/* NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -- cannot compute array size as a constexpr in C */
#define SOLIDSYSLOG_CIRCULARBUFFER_STORAGE_SIZE(maxMessages) \
SOLIDSYSLOG_CIRCULARBUFFER_STORAGE_SIZE_BYTES( \
(size_t) (maxMessages) * (SOLIDSYSLOG_MAX_MESSAGE_SIZE + SOLIDSYSLOG_CIRCULARBUFFER_HEADER_BYTES) \
#define SOLIDSYSLOG_CIRCULAR_BUFFER_STORAGE_SIZE(maxMessages) \
SOLIDSYSLOG_CIRCULAR_BUFFER_STORAGE_SIZE_BYTES( \
(size_t) (maxMessages) * (SOLIDSYSLOG_MAX_MESSAGE_SIZE + SOLIDSYSLOG_CIRCULAR_BUFFER_HEADER_BYTES) \
)

struct SolidSyslogBuffer* SolidSyslogCircularBuffer_Create(
Expand Down
6 changes: 3 additions & 3 deletions Core/Interface/SolidSyslogDatagram.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ EXTERN_C_BEGIN
* collapse it into Failed. */
enum SolidSyslogDatagramSendResult
{
SolidSyslogDatagramSendResult_Sent,
SolidSyslogDatagramSendResult_Oversize,
SolidSyslogDatagramSendResult_Failed
SOLIDSYSLOG_DATAGRAM_SEND_RESULT_SENT,
SOLIDSYSLOG_DATAGRAM_SEND_RESULT_OVERSIZE,
SOLIDSYSLOG_DATAGRAM_SEND_RESULT_FAILED
};

bool SolidSyslogDatagram_Open(struct SolidSyslogDatagram * datagram);
Expand Down
4 changes: 2 additions & 2 deletions Core/Interface/SolidSyslogFileBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ EXTERN_C_BEGIN

enum
{
SOLIDSYSLOG_FILEBLOCKDEVICE_STORAGE_SIZE = sizeof(intptr_t) * 16U
SOLIDSYSLOG_FILE_BLOCK_DEVICE_STORAGE_SIZE = sizeof(intptr_t) * 16U
};

typedef struct
{
intptr_t slots[(SOLIDSYSLOG_FILEBLOCKDEVICE_STORAGE_SIZE + sizeof(intptr_t) - 1U) / sizeof(intptr_t)];
intptr_t slots[(SOLIDSYSLOG_FILE_BLOCK_DEVICE_STORAGE_SIZE + sizeof(intptr_t) - 1U) / sizeof(intptr_t)];
} SolidSyslogFileBlockDeviceStorage;

/* The driver caches at most one open SolidSyslogFile handle, re-pointed only when the
Expand Down
64 changes: 32 additions & 32 deletions Core/Interface/SolidSyslogPrival.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ EXTERN_C_BEGIN

enum SolidSyslogFacility
{
SolidSyslogFacility_Kern = 0,
SolidSyslogFacility_User = 1,
SolidSyslogFacility_Mail = 2,
SolidSyslogFacility_Daemon = 3,
SolidSyslogFacility_Auth = 4,
SolidSyslogFacility_Syslog = 5,
SolidSyslogFacility_Lpr = 6,
SolidSyslogFacility_News = 7,
SolidSyslogFacility_Uucp = 8,
SolidSyslogFacility_Cron = 9,
SolidSyslogFacility_AuthPriv = 10,
SolidSyslogFacility_Ftp = 11,
SolidSyslogFacility_Ntp = 12,
SolidSyslogFacility_Audit = 13,
SolidSyslogFacility_Alert = 14,
SolidSyslogFacility_Clock = 15,
SolidSyslogFacility_Local0 = 16,
SolidSyslogFacility_Local1 = 17,
SolidSyslogFacility_Local2 = 18,
SolidSyslogFacility_Local3 = 19,
SolidSyslogFacility_Local4 = 20,
SolidSyslogFacility_Local5 = 21,
SolidSyslogFacility_Local6 = 22,
SolidSyslogFacility_Local7 = 23
SOLIDSYSLOG_FACILITY_KERN = 0,
SOLIDSYSLOG_FACILITY_USER = 1,
SOLIDSYSLOG_FACILITY_MAIL = 2,
SOLIDSYSLOG_FACILITY_DAEMON = 3,
SOLIDSYSLOG_FACILITY_AUTH = 4,
SOLIDSYSLOG_FACILITY_SYSLOG = 5,
SOLIDSYSLOG_FACILITY_LPR = 6,
SOLIDSYSLOG_FACILITY_NEWS = 7,
SOLIDSYSLOG_FACILITY_UUCP = 8,
SOLIDSYSLOG_FACILITY_CRON = 9,
SOLIDSYSLOG_FACILITY_AUTH_PRIV = 10,
SOLIDSYSLOG_FACILITY_FTP = 11,
SOLIDSYSLOG_FACILITY_NTP = 12,
SOLIDSYSLOG_FACILITY_AUDIT = 13,
SOLIDSYSLOG_FACILITY_ALERT = 14,
SOLIDSYSLOG_FACILITY_CLOCK = 15,
SOLIDSYSLOG_FACILITY_LOCAL0 = 16,
SOLIDSYSLOG_FACILITY_LOCAL1 = 17,
SOLIDSYSLOG_FACILITY_LOCAL2 = 18,
SOLIDSYSLOG_FACILITY_LOCAL3 = 19,
SOLIDSYSLOG_FACILITY_LOCAL4 = 20,
SOLIDSYSLOG_FACILITY_LOCAL5 = 21,
SOLIDSYSLOG_FACILITY_LOCAL6 = 22,
SOLIDSYSLOG_FACILITY_LOCAL7 = 23
};

enum SolidSyslogSeverity
{
SolidSyslogSeverity_Emergency = 0,
SolidSyslogSeverity_Alert = 1,
SolidSyslogSeverity_Critical = 2,
SolidSyslogSeverity_Error = 3,
SolidSyslogSeverity_Warning = 4,
SolidSyslogSeverity_Notice = 5,
SolidSyslogSeverity_Informational = 6,
SolidSyslogSeverity_Debug = 7
SOLIDSYSLOG_SEVERITY_EMERGENCY = 0,
SOLIDSYSLOG_SEVERITY_ALERT = 1,
SOLIDSYSLOG_SEVERITY_CRITICAL = 2,
SOLIDSYSLOG_SEVERITY_ERROR = 3,
SOLIDSYSLOG_SEVERITY_WARNING = 4,
SOLIDSYSLOG_SEVERITY_NOTICE = 5,
SOLIDSYSLOG_SEVERITY_INFORMATIONAL = 6,
SOLIDSYSLOG_SEVERITY_DEBUG = 7
};

EXTERN_C_END
Expand Down
4 changes: 2 additions & 2 deletions Core/Interface/SolidSyslogTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ enum

enum SolidSyslogTransport
{
SolidSyslogTransport_Udp,
SolidSyslogTransport_Tcp
SOLIDSYSLOG_TRANSPORT_UDP,
SOLIDSYSLOG_TRANSPORT_TCP
};

#endif /* SOLIDSYSLOGTRANSPORT_H */
4 changes: 2 additions & 2 deletions Core/Source/BlockSequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ static inline bool BlockSequence_BlockIsFull(const struct BlockSequence* blockSe
static inline bool BlockSequence_StoreIsFull(const struct BlockSequence* blockSequence)
{
return (BlockSequence_BlockCount(blockSequence) >= blockSequence->MaxBlocks) &&
(blockSequence->DiscardPolicy != SolidSyslogDiscardPolicy_Oldest);
(blockSequence->DiscardPolicy != SOLIDSYSLOG_DISCARD_POLICY_OLDEST);
}

static inline void BlockSequence_NotifyStoreFull(struct BlockSequence* blockSequence)
{
if ((blockSequence->DiscardPolicy == SolidSyslogDiscardPolicy_Halt) && !blockSequence->Halted)
if ((blockSequence->DiscardPolicy == SOLIDSYSLOG_DISCARD_POLICY_HALT) && !blockSequence->Halted)
{
blockSequence->Halted = true;

Expand Down
Loading
Loading