@@ -241,6 +241,9 @@ static const struct config_enum_entry bytea_output_options[] = {
241
241
{NULL , 0 , false}
242
242
};
243
243
244
+ StaticAssertDecl (lengthof (bytea_output_options ) == (BYTEA_OUTPUT_HEX + 2 ),
245
+ "array length mismatch" );
246
+
244
247
/*
245
248
* We have different sets for client and server message level options because
246
249
* they sort slightly different (see "log" level), and because "fatal"/"panic"
@@ -286,13 +289,19 @@ static const struct config_enum_entry intervalstyle_options[] = {
286
289
{NULL , 0 , false}
287
290
};
288
291
292
+ StaticAssertDecl (lengthof (intervalstyle_options ) == (INTSTYLE_ISO_8601 + 2 ),
293
+ "array length mismatch" );
294
+
289
295
static const struct config_enum_entry log_error_verbosity_options [] = {
290
296
{"terse" , PGERROR_TERSE , false},
291
297
{"default" , PGERROR_DEFAULT , false},
292
298
{"verbose" , PGERROR_VERBOSE , false},
293
299
{NULL , 0 , false}
294
300
};
295
301
302
+ StaticAssertDecl (lengthof (log_error_verbosity_options ) == (PGERROR_VERBOSE + 2 ),
303
+ "array length mismatch" );
304
+
296
305
static const struct config_enum_entry log_statement_options [] = {
297
306
{"none" , LOGSTMT_NONE , false},
298
307
{"ddl" , LOGSTMT_DDL , false},
@@ -301,6 +310,9 @@ static const struct config_enum_entry log_statement_options[] = {
301
310
{NULL , 0 , false}
302
311
};
303
312
313
+ StaticAssertDecl (lengthof (log_statement_options ) == (LOGSTMT_ALL + 2 ),
314
+ "array length mismatch" );
315
+
304
316
static const struct config_enum_entry isolation_level_options [] = {
305
317
{"serializable" , XACT_SERIALIZABLE , false},
306
318
{"repeatable read" , XACT_REPEATABLE_READ , false},
@@ -316,6 +328,9 @@ static const struct config_enum_entry session_replication_role_options[] = {
316
328
{NULL , 0 , false}
317
329
};
318
330
331
+ StaticAssertDecl (lengthof (session_replication_role_options ) == (SESSION_REPLICATION_ROLE_LOCAL + 2 ),
332
+ "array length mismatch" );
333
+
319
334
static const struct config_enum_entry syslog_facility_options [] = {
320
335
#ifdef HAVE_SYSLOG
321
336
{"local0" , LOG_LOCAL0 , false},
@@ -339,18 +354,27 @@ static const struct config_enum_entry track_function_options[] = {
339
354
{NULL , 0 , false}
340
355
};
341
356
357
+ StaticAssertDecl (lengthof (track_function_options ) == (TRACK_FUNC_ALL + 2 ),
358
+ "array length mismatch" );
359
+
342
360
static const struct config_enum_entry xmlbinary_options [] = {
343
361
{"base64" , XMLBINARY_BASE64 , false},
344
362
{"hex" , XMLBINARY_HEX , false},
345
363
{NULL , 0 , false}
346
364
};
347
365
366
+ StaticAssertDecl (lengthof (xmlbinary_options ) == (XMLBINARY_HEX + 2 ),
367
+ "array length mismatch" );
368
+
348
369
static const struct config_enum_entry xmloption_options [] = {
349
370
{"content" , XMLOPTION_CONTENT , false},
350
371
{"document" , XMLOPTION_DOCUMENT , false},
351
372
{NULL , 0 , false}
352
373
};
353
374
375
+ StaticAssertDecl (lengthof (xmloption_options ) == (XMLOPTION_CONTENT + 2 ),
376
+ "array length mismatch" );
377
+
354
378
/*
355
379
* Although only "on", "off", and "safe_encoding" are documented, we
356
380
* accept all the likely variants of "on" and "off".
@@ -465,6 +489,9 @@ const struct config_enum_entry ssl_protocol_versions_info[] = {
465
489
{NULL , 0 , false}
466
490
};
467
491
492
+ StaticAssertDecl (lengthof (ssl_protocol_versions_info ) == (PG_TLS1_3_VERSION + 2 ),
493
+ "array length mismatch" );
494
+
468
495
static struct config_enum_entry shared_memory_options [] = {
469
496
#ifndef WIN32
470
497
{"sysv" , SHMEM_TYPE_SYSV , false},
@@ -615,6 +642,9 @@ const char *const GucContext_Names[] =
615
642
/* PGC_USERSET */ "user"
616
643
};
617
644
645
+ StaticAssertDecl (lengthof (GucContext_Names ) == (PGC_USERSET + 1 ),
646
+ "array length mismatch" );
647
+
618
648
/*
619
649
* Displayable names for source types (enum GucSource)
620
650
*
@@ -638,6 +668,9 @@ const char *const GucSource_Names[] =
638
668
/* PGC_S_SESSION */ "session"
639
669
};
640
670
671
+ StaticAssertDecl (lengthof (GucSource_Names ) == (PGC_S_SESSION + 1 ),
672
+ "array length mismatch" );
673
+
641
674
/*
642
675
* Displayable names for the groupings defined in enum config_group
643
676
*/
@@ -749,6 +782,9 @@ const char *const config_group_names[] =
749
782
NULL
750
783
};
751
784
785
+ StaticAssertDecl (lengthof (config_group_names ) == (DEVELOPER_OPTIONS + 2 ),
786
+ "array length mismatch" );
787
+
752
788
/*
753
789
* Displayable names for GUC variable types (enum config_type)
754
790
*
@@ -763,6 +799,9 @@ const char *const config_type_names[] =
763
799
/* PGC_ENUM */ "enum"
764
800
};
765
801
802
+ StaticAssertDecl (lengthof (config_type_names ) == (PGC_ENUM + 1 ),
803
+ "array length mismatch" );
804
+
766
805
/*
767
806
* Unit conversion tables.
768
807
*
0 commit comments