diff --git a/include/protocols/timed.h b/include/protocols/timed.h index 18747be7a111..d26b4a23980d 100644 --- a/include/protocols/timed.h +++ b/include/protocols/timed.h @@ -90,11 +90,13 @@ struct tsp { #define TSPTYPENUMBER 25 #ifdef TSPTYPES -const char *tsptype[TSPTYPENUMBER] = +static char const * const tsptype[] = { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP", "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT", "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ", "TEST", "SETDATE", "SETDATEREQ", "LOOP" }; +_Static_assert(sizeof(tsptype) / sizeof(const char *) == TSPTYPENUMBER, + "Size of tsptype does not match TSPTYPENUMBER"); #endif #endif /* !_TIMED_H_ */ diff --git a/sys/sys/syslog.h b/sys/sys/syslog.h index 6f12831434bd..61bad21ccb2f 100644 --- a/sys/sys/syslog.h +++ b/sys/sys/syslog.h @@ -69,7 +69,7 @@ typedef struct _code { int c_val; } CODE; -CODE prioritynames[] = { +static const CODE prioritynames[] = { { "alert", LOG_ALERT, }, { "crit", LOG_CRIT, }, { "debug", LOG_DEBUG, }, @@ -122,7 +122,7 @@ CODE prioritynames[] = { #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) #ifdef SYSLOG_NAMES -CODE facilitynames[] = { +static const CODE facilitynames[] = { { "auth", LOG_AUTH, }, { "authpriv", LOG_AUTHPRIV, }, { "console", LOG_CONSOLE, }, diff --git a/sys/sys/ttydefaults.h b/sys/sys/ttydefaults.h index 409ebc7da4e1..82929f945d2e 100644 --- a/sys/sys/ttydefaults.h +++ b/sys/sys/ttydefaults.h @@ -95,10 +95,17 @@ * #define TTYDEFCHARS to include an array of default control characters. */ #ifdef TTYDEFCHARS -static cc_t ttydefchars[NCCS] = { - CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, - CERASE2, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, - CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE + +#include +#include + +static const cc_t ttydefchars[] = { + CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, CERASE2, CINTR, + CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, CDISCARD, CMIN, CTIME, + CSTATUS, _POSIX_VDISABLE }; +_Static_assert(sizeof(ttydefchars) / sizeof(cc_t) == NCCS, + "Size of ttydefchars does not match NCCS"); + #undef TTYDEFCHARS -#endif +#endif /* TTYDEFCHARS */