@@ -241,6 +241,9 @@ static const struct config_enum_entry bytea_output_options[] = {
241241 {NULL , 0 , false}
242242};
243243
244+ StaticAssertDecl (lengthof (bytea_output_options ) == (BYTEA_OUTPUT_HEX + 2 ),
245+ "array length mismatch" );
246+
244247/*
245248 * We have different sets for client and server message level options because
246249 * they sort slightly different (see "log" level), and because "fatal"/"panic"
@@ -286,13 +289,19 @@ static const struct config_enum_entry intervalstyle_options[] = {
286289 {NULL , 0 , false}
287290};
288291
292+ StaticAssertDecl (lengthof (intervalstyle_options ) == (INTSTYLE_ISO_8601 + 2 ),
293+ "array length mismatch" );
294+
289295static const struct config_enum_entry log_error_verbosity_options [] = {
290296 {"terse" , PGERROR_TERSE , false},
291297 {"default" , PGERROR_DEFAULT , false},
292298 {"verbose" , PGERROR_VERBOSE , false},
293299 {NULL , 0 , false}
294300};
295301
302+ StaticAssertDecl (lengthof (log_error_verbosity_options ) == (PGERROR_VERBOSE + 2 ),
303+ "array length mismatch" );
304+
296305static const struct config_enum_entry log_statement_options [] = {
297306 {"none" , LOGSTMT_NONE , false},
298307 {"ddl" , LOGSTMT_DDL , false},
@@ -301,6 +310,9 @@ static const struct config_enum_entry log_statement_options[] = {
301310 {NULL , 0 , false}
302311};
303312
313+ StaticAssertDecl (lengthof (log_statement_options ) == (LOGSTMT_ALL + 2 ),
314+ "array length mismatch" );
315+
304316static const struct config_enum_entry isolation_level_options [] = {
305317 {"serializable" , XACT_SERIALIZABLE , false},
306318 {"repeatable read" , XACT_REPEATABLE_READ , false},
@@ -316,6 +328,9 @@ static const struct config_enum_entry session_replication_role_options[] = {
316328 {NULL , 0 , false}
317329};
318330
331+ StaticAssertDecl (lengthof (session_replication_role_options ) == (SESSION_REPLICATION_ROLE_LOCAL + 2 ),
332+ "array length mismatch" );
333+
319334static const struct config_enum_entry syslog_facility_options [] = {
320335#ifdef HAVE_SYSLOG
321336 {"local0" , LOG_LOCAL0 , false},
@@ -339,18 +354,27 @@ static const struct config_enum_entry track_function_options[] = {
339354 {NULL , 0 , false}
340355};
341356
357+ StaticAssertDecl (lengthof (track_function_options ) == (TRACK_FUNC_ALL + 2 ),
358+ "array length mismatch" );
359+
342360static const struct config_enum_entry xmlbinary_options [] = {
343361 {"base64" , XMLBINARY_BASE64 , false},
344362 {"hex" , XMLBINARY_HEX , false},
345363 {NULL , 0 , false}
346364};
347365
366+ StaticAssertDecl (lengthof (xmlbinary_options ) == (XMLBINARY_HEX + 2 ),
367+ "array length mismatch" );
368+
348369static const struct config_enum_entry xmloption_options [] = {
349370 {"content" , XMLOPTION_CONTENT , false},
350371 {"document" , XMLOPTION_DOCUMENT , false},
351372 {NULL , 0 , false}
352373};
353374
375+ StaticAssertDecl (lengthof (xmloption_options ) == (XMLOPTION_CONTENT + 2 ),
376+ "array length mismatch" );
377+
354378/*
355379 * Although only "on", "off", and "safe_encoding" are documented, we
356380 * accept all the likely variants of "on" and "off".
@@ -465,6 +489,9 @@ const struct config_enum_entry ssl_protocol_versions_info[] = {
465489 {NULL , 0 , false}
466490};
467491
492+ StaticAssertDecl (lengthof (ssl_protocol_versions_info ) == (PG_TLS1_3_VERSION + 2 ),
493+ "array length mismatch" );
494+
468495static struct config_enum_entry shared_memory_options [] = {
469496#ifndef WIN32
470497 {"sysv" , SHMEM_TYPE_SYSV , false},
@@ -615,6 +642,9 @@ const char *const GucContext_Names[] =
615642 /* PGC_USERSET */ "user"
616643};
617644
645+ StaticAssertDecl (lengthof (GucContext_Names ) == (PGC_USERSET + 1 ),
646+ "array length mismatch" );
647+
618648/*
619649 * Displayable names for source types (enum GucSource)
620650 *
@@ -638,6 +668,9 @@ const char *const GucSource_Names[] =
638668 /* PGC_S_SESSION */ "session"
639669};
640670
671+ StaticAssertDecl (lengthof (GucSource_Names ) == (PGC_S_SESSION + 1 ),
672+ "array length mismatch" );
673+
641674/*
642675 * Displayable names for the groupings defined in enum config_group
643676 */
@@ -749,6 +782,9 @@ const char *const config_group_names[] =
749782 NULL
750783};
751784
785+ StaticAssertDecl (lengthof (config_group_names ) == (DEVELOPER_OPTIONS + 2 ),
786+ "array length mismatch" );
787+
752788/*
753789 * Displayable names for GUC variable types (enum config_type)
754790 *
@@ -763,6 +799,9 @@ const char *const config_type_names[] =
763799 /* PGC_ENUM */ "enum"
764800};
765801
802+ StaticAssertDecl (lengthof (config_type_names ) == (PGC_ENUM + 1 ),
803+ "array length mismatch" );
804+
766805/*
767806 * Unit conversion tables.
768807 *
0 commit comments