Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – /branches/tendra5/src/producers/common/utility/option.c – Rev 2

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
#include "config.h"
32
#include <limits.h>
33
#if FS_STDARG
34
#include <stdarg.h>
35
#else
36
#include <varargs.h>
37
#endif
38
#include "c_types.h"
39
#include "err_ops.h"
40
#include "exp_ops.h"
41
#include "hashid_ops.h"
42
#include "id_ops.h"
43
#include "str_ops.h"
44
#include "error.h"
45
#include "catalog.h"
46
#include "cast.h"
47
#include "char.h"
48
#include "constant.h"
49
#include "declare.h"
50
#include "file.h"
51
#include "hash.h"
52
#include "instance.h"
53
#include "inttype.h"
54
#include "lex.h"
55
#include "literal.h"
56
#include "namespace.h"
57
#include "option.h"
58
#include "predict.h"
59
#include "preproc.h"
60
#include "redeclare.h"
61
#include "syntax.h"
62
#include "ustring.h"
63
#include "xalloc.h"
64
 
65
 
66
/*
67
    OPTION CATALOGUE
68
 
69
    This table gives the catalogue of all options.  Each entry consists
70
    of an option name plus the default value of the option in the
71
    various standard compilation modes.  The main body is automatically
72
    generated from the error database.
73
*/
74
 
75
#define OPT_VALUE_off		1, { OPTION_OFF, OPTION_OFF }
76
#define OPT_VALUE_on		1, { OPTION_ON, OPTION_ON }
77
#define OPT_VALUE_none		1, { OPTION_ALLOW, OPTION_ALLOW }
78
#define OPT_VALUE_warning	1, { OPTION_WARN, OPTION_WARN }
79
#define OPT_VALUE_error		1, { OPTION_DISALLOW, OPTION_DISALLOW }
80
#define OPT_VALUE_whatever	1, { OPTION_WHATEVER, OPTION_WHATEVER }
81
#define OPT_VALUE_new		1, { OPTION_WARN, OPTION_DISALLOW }
82
#define OPT_VALUE_wall		1, { OPTION_ALLOW, OPTION_WARN }
83
 
84
OPT_DATA OPT_CATALOG [] = {
85
#include "opts.h"
86
    { NULL, OPT_VALUE_off }
87
} ;
88
 
89
#define CATALOG_SIZE		array_size ( OPT_CATALOG )
90
 
91
 
92
/*
93
    OPTION VALUE CATALOGUE
94
 
95
    This table gives the catalogue of all option values.  Each entry
96
    consists of an option name, its maximum value allowed within the
97
    program, its minimum maximum value allowed by the standard and a
98
    current value.  The entries need to be kept in step with the
99
    OPT_VAL_* macros defined in options.h.  Note that most of the
100
    implementation limits are NO_LIMIT, indicating that there is no
101
    built-in limit.
102
*/
103
 
104
#if LANGUAGE_CPP
105
#define LIMIT( A, B )		( ( unsigned long ) ( A ) )
106
#else
107
#define LIMIT( A, B )		( ( unsigned long ) ( B ) )
108
#endif
109
#define NO_LIMIT		ULONG_MAX
110
#define STR_LIMIT		( ULONG_MAX >> 3 )
111
 
112
OPT_VALUE_DATA OPT_VALUE_CATALOG [] = {
113
    /* Implementation quantities (from Annex B) */
114
    { "statement_depth", &crt_loc, NO_LIMIT, LIMIT ( 256, 15 ), 0, 1 },
115
    { "hash_if_depth", &preproc_loc, NO_LIMIT, LIMIT ( 256, 8 ), 0, 1 },
116
    { "declarator_max", &crt_loc, NO_LIMIT, LIMIT ( 256, 12 ), 0, 0 },
117
    { "paren_depth", &crt_loc, NO_LIMIT, LIMIT ( 256, 32 ), 0, 1 },
118
    { "name_limit", &crt_loc, NO_LIMIT, LIMIT ( 1024, 31 ), 0, 0 },
119
    { "extern_name_limit", &crt_loc, NO_LIMIT, LIMIT ( 1024, 6 ), 0, 0 },
120
    { "external_ids", &crt_loc, NO_LIMIT, LIMIT ( 65536, 511 ), 0, 0 },
121
    { "block_ids", &crt_loc, NO_LIMIT, LIMIT ( 1024, 127 ), 0, 0 },
122
    { "macro_ids", &preproc_loc, NO_LIMIT, LIMIT ( 65536, 1024 ), 0, 1 },
123
    { "func_pars", &crt_loc, NO_LIMIT, LIMIT ( 256, 31 ), 0, 0 },
124
    { "func_args", &crt_loc, NO_LIMIT, LIMIT ( 256, 31 ), 0, 0 },
125
    { "macro_pars", &preproc_loc, NO_LIMIT, LIMIT ( 256, 31 ), 0, 0 },
126
    { "macro_args", &crt_loc, NO_LIMIT, LIMIT ( 256, 31 ), 0, 0 },
127
    { "line_length", &crt_loc, NO_LIMIT, LIMIT ( 65536, 509 ), 0, 0 },
128
    { "string_length", &crt_loc, STR_LIMIT, LIMIT ( 65536, 509 ), 0, 0 },
129
    { "sizeof_object", &crt_loc, NO_LIMIT, LIMIT ( 262144, 32767 ), 0, 0 },
130
    { "include_depth", &preproc_loc, 256, LIMIT ( 256, 8 ), 0, 1 },
131
    { "switch_cases", &crt_loc, NO_LIMIT, LIMIT ( 16384, 257 ), 0, 0 },
132
    { "data_members", &crt_loc, NO_LIMIT, LIMIT ( 16384, 127 ), 0, 0 },
133
    { "enum_consts", &crt_loc, NO_LIMIT, LIMIT ( 4096, 127 ), 0, 0 },
134
    { "nested_class", &crt_loc, NO_LIMIT, LIMIT ( 256, 15 ), 0, 1 },
135
    { "atexit_funcs", &crt_loc, NO_LIMIT, LIMIT ( 32, 32 ), 0, 0 },
136
    { "base_classes", &crt_loc, NO_LIMIT, LIMIT ( 16384, 0 ), 0, 0 },
137
    { "direct_bases", &crt_loc, NO_LIMIT, LIMIT ( 1024, 0 ), 0, 0 },
138
    { "class_members", &crt_loc, NO_LIMIT, LIMIT ( 4096, 0 ), 0, 0 },
139
    { "virtual_funcs", &crt_loc, NO_LIMIT, LIMIT ( 16384, 0 ), 0, 0 },
140
    { "virtual_bases", &crt_loc, NO_LIMIT, LIMIT ( 1024, 0 ), 0, 0 },
141
    { "static_members", &crt_loc, NO_LIMIT, LIMIT ( 1024, 0 ), 0, 0 },
142
    { "friends", &crt_loc, NO_LIMIT, LIMIT ( 4096, 0 ), 0, 0 },
143
    { "access_declarations", &crt_loc, NO_LIMIT, LIMIT ( 4096, 0 ), 0, 0 },
144
    { "ctor_initializers", &crt_loc, NO_LIMIT, LIMIT ( 6144, 0 ), 0, 0 },
145
    { "scope_qualifiers", &crt_loc, NO_LIMIT, LIMIT ( 256, 0 ), 0, 0 },
146
    { "external_specs", &crt_loc, NO_LIMIT, LIMIT ( 1024, 0 ), 0, 1 },
147
    { "template_pars", &crt_loc, NO_LIMIT, LIMIT ( 1024, 0 ), 0, 0 },
148
    { "instance_depth", &crt_loc, 17, LIMIT ( 17, 0 ), 0, 1 },
149
    { "exception_handlers", &crt_loc, NO_LIMIT, LIMIT ( 256, 0 ), 0, 0 },
150
    { "exception_specs", &crt_loc, NO_LIMIT, LIMIT ( 256, 0 ), 0, 0 },
151
 
152
    /* Other quantities */
153
    { "cast_explicit", &crt_loc, CAST_EXPLICIT, 0, 0, 0 },
154
    { "maximum_error", &crt_loc, 32, 1, 0, 0 },
155
    { "tab_width", &crt_loc, 8, 1, 0, 0 },
156
    { NULL, NULL, 0, 0, 0, 0 }
157
} ;
158
 
159
#define VALUE_CAT_SIZE		array_size ( OPT_VALUE_CATALOG )
160
 
161
 
162
/*
163
    ERROR TYPE CATALOGUE
164
 
165
    This table gives the names of all the types used in the error catalogue
166
    together with the code letter used to encode them.
167
*/
168
 
169
typedef struct {
170
    CONST char *name ;
171
    int number ;
172
} OPT_TYPE_DATA ;
173
 
174
static OPT_TYPE_DATA OPT_TYPE_CATALOG [] = {
175
    { "ACCESS", ERR_KEY_ACCESS },
176
    { "BASE_TYPE", ERR_KEY_BASE_TYPE },
177
    { "CLASS_TYPE", ERR_KEY_CLASS_TYPE },
178
    { "CV_SPEC", ERR_KEY_CV_SPEC },
179
    { "DECL_SPEC", ERR_KEY_DECL_SPEC },
180
    { "FLOAT", ERR_KEY_FLOAT },
181
    { "HASHID", ERR_KEY_HASHID },
182
    { "IDENTIFIER", ERR_KEY_IDENTIFIER },
183
    { "LEX", ERR_KEY_LEX },
184
    { "LONG_ID", ERR_KEY_LONG_ID },
185
    { "NAMESPACE", ERR_KEY_NAMESPACE },
186
    { "NAT", ERR_KEY_NAT },
187
    { "PPTOKEN_P", ERR_KEY_PPTOKEN_P },
188
    { "PTR_LOC", ERR_KEY_PTR_LOC },
189
    { "QUALIFIER", ERR_KEY_QUALIFIER },
190
    { "STRING", ERR_KEY_STRING },
191
    { "TYPE", ERR_KEY_TYPE },
192
    { "cint", ERR_KEY_cint },
193
    { "cstring", ERR_KEY_cstring },
194
    { "string", ERR_KEY_string },
195
    { "ucint", ERR_KEY_ucint },
196
    { "ulong", ERR_KEY_ulong },
197
    { "unsigned", ERR_KEY_unsigned },
198
    { "plural", ERR_KEY_plural }
199
} ;
200
 
201
#define TYPE_CAT_SIZE		array_size ( OPT_TYPE_CATALOG )
202
 
203
 
204
/*
205
    OPTION NAME HASH TABLE
206
 
207
    This hash table is used to hold the names of the various options in
208
    the option catalogue.
209
*/
210
 
211
typedef struct opt_hash_tag {
212
    int number ;
213
    OPT_DATA *entry ;
214
    struct opt_hash_tag *next ;
215
} OPT_HASH ;
216
 
217
#define HASH_OPTION		128
218
static OPT_HASH *option_hash [ HASH_OPTION + 1 ] ;
219
static OPT_HASH *all_option_hash = NULL ;
220
 
221
 
222
/*
223
    INITIALISE THE OPTION HASH TABLE
224
 
225
    This routine sets up the option hash table.
226
*/
227
 
228
static void init_opt_hash
229
    PROTO_Z ()
230
{
231
    int i ;
232
    OPT_DATA *cat = OPT_CATALOG ;
233
    OPT_HASH *opt = xmalloc_nof ( OPT_HASH, CATALOG_SIZE ) ;
234
    for ( i = 0 ; i <= HASH_OPTION ; i++ ) {
235
	option_hash [i] = NULL ;
236
    }
237
    all_option_hash = opt ;
238
    for ( i = 0 ; i < CATALOG_SIZE ; i++ ) {
239
	unsigned long h ;
240
	string s = ustrlit ( cat->name ) ;
241
	if ( s ) {
242
	    h = hash ( s ) ;
243
	    h %= HASH_OPTION ;
244
	} else {
245
	    h = HASH_OPTION ;
246
	}
247
	opt->number = i ;
248
	opt->entry = cat ;
249
	opt->next = option_hash [h] ;
250
	option_hash [h] = opt ;
251
	cat++ ;
252
	opt++ ;
253
    }
254
    return ;
255
}
256
 
257
 
258
/*
259
    FIND AN OPTION NUMBER
260
 
261
    This routine finds the option number corresponding to the string
262
    literal expression s.  n gives a likely value to try first.  It
263
    returns -1 if s is not the name of a known option.
264
*/
265
 
266
int find_option_no
267
    PROTO_N ( ( s, n ) )
268
    PROTO_T ( STRING s X int n )
269
{
270
    unsigned kind = DEREF_unsigned ( str_simple_kind ( s ) ) ;
271
    if ( kind == STRING_NONE ) {
272
	OPT_HASH *opt ;
273
	unsigned long h ;
274
	string text = DEREF_string ( str_simple_text ( s ) ) ;
275
	ulong len = DEREF_ulong ( str_simple_len ( s ) ) ;
276
	if ( n >= 0 && n < CATALOG_SIZE ) {
277
	    string nm = ustrlit ( OPT_CATALOG [n].name ) ;
278
	    if ( nm && ustreq ( text, nm ) ) {
279
		if ( len == ( ulong ) ustrlen ( nm ) ) return ( n ) ;
280
	    }
281
	}
282
	if ( all_option_hash == NULL ) init_opt_hash () ;
283
	h = hash ( text ) ;
284
	h %= HASH_OPTION ;
285
	for ( opt = option_hash [h] ; opt != NULL ; opt = opt->next ) {
286
	    string nm = ustrlit ( opt->entry->name ) ;
287
	    if ( nm && ustreq ( text, nm ) ) {
288
		if ( len == ( ulong ) ustrlen ( nm ) ) {
289
		    return ( opt->number ) ;
290
		}
291
	    }
292
	}
293
    }
294
    return ( -1 ) ;
295
}
296
 
297
 
298
/*
299
    FIND A VALUE OPTION NUMBER
300
 
301
    This routine finds the value option number corresponding to the
302
    string literal expression s.  n gives a likely value to try first.
303
    It returns -1 if s is not the name of a known value option.  Note
304
    that there are not enough cases to warrant a hash table.
305
*/
306
 
307
int find_value_no
308
    PROTO_N ( ( s, n ) )
309
    PROTO_T ( STRING s X int n )
310
{
311
    unsigned kind = DEREF_unsigned ( str_simple_kind ( s ) ) ;
312
    if ( kind == STRING_NONE ) {
313
	int i ;
314
	OPT_VALUE_DATA *p = OPT_VALUE_CATALOG ;
315
	string text = DEREF_string ( str_simple_text ( s ) ) ;
316
	ulong len = DEREF_ulong ( str_simple_len ( s ) ) ;
317
	if ( n >= 0 && n < VALUE_CAT_SIZE ) {
318
	    string nm = ustrlit ( p [n].name ) ;
319
	    if ( nm && ustreq ( text, nm ) ) {
320
		if ( len == ( ulong ) ustrlen ( nm ) ) return ( n ) ;
321
	    }
322
	}
323
	for ( i = 0 ; i < VALUE_CAT_SIZE ; i++ ) {
324
	    string nm = ustrlit ( p->name ) ;
325
	    if ( nm && ustreq ( text, nm ) ) {
326
		if ( len == ( ulong ) ustrlen ( nm ) ) return ( i ) ;
327
	    }
328
	    p++ ;
329
	}
330
    }
331
    return ( -1 ) ;
332
}
333
 
334
 
335
/*
336
    FIND A ERROR TYPE NUMBER
337
 
338
    This routine finds the encoding character for the type corresponding
339
    to the string literal expression s.  It returns -1 if s is not the
340
    name of a known value option.  Note that there are not enough cases
341
    to warrant a hash table.
342
*/
343
 
344
int find_type_no
345
    PROTO_N ( ( s ) )
346
    PROTO_T ( STRING s )
347
{
348
    unsigned kind = DEREF_unsigned ( str_simple_kind ( s ) ) ;
349
    if ( kind == STRING_NONE ) {
350
	int i ;
351
	OPT_TYPE_DATA *p = OPT_TYPE_CATALOG ;
352
	string text = DEREF_string ( str_simple_text ( s ) ) ;
353
	ulong len = DEREF_ulong ( str_simple_len ( s ) ) ;
354
	for ( i = 0 ; i < TYPE_CAT_SIZE ; i++ ) {
355
	    string nm = ustrlit ( p->name ) ;
356
	    if ( nm && ustreq ( text, nm ) ) {
357
		if ( len == ( ulong ) ustrlen ( nm ) ) {
358
		    return ( p->number ) ;
359
		}
360
	    }
361
	    p++ ;
362
	}
363
    }
364
    return ( -1 ) ;
365
}
366
 
367
 
368
/*
369
    CURRENT OPTION STATE
370
 
371
    The variable crt_opts is used to record the current option state.
372
    In addition a list of all scopes defined, all_opts, is maintained.
373
    The variable crt_opt shadows crt_opts->opt and gives a user-accessible
374
    array of option values.
375
*/
376
 
377
OPTIONS *crt_opts = NULL ;
378
OPTIONS *real_opts = NULL ;
379
static OPTIONS *all_opts = NULL ;
380
OPTION *crt_opt = NULL ;
381
 
382
 
383
/*
384
    SET AN ERROR TO AN OPTION LEVEL
385
 
386
    This routine modifies the severity level of the error err using the
387
    option n.  Whether the severity is set to that of option n depends
388
    on the value of set; it is always set if set is zero, only set if
389
    option n is more severe if set is positive, and only set if option
390
    n is less severe if set is negative.
391
*/
392
 
393
ERROR set_severity
394
    PROTO_N ( ( err, n, set ) )
395
    PROTO_T ( ERROR err X int n X int set )
396
{
397
    if ( !IS_NULL_err ( err ) ) {
398
	OPTION opt = crt_opts->opt [n] ;
399
	int e = error_severity [ opt ] ;
400
	if ( set != 0 ) {
401
	    /* Compare with previous severity */
402
	    int c = DEREF_int ( err_severity ( err ) ) ;
403
	    if ( set > 0 ) {
404
		if ( e < c ) e = c ;
405
	    } else {
406
		if ( e > c ) e = c ;
407
	    }
408
	}
409
	if ( e == ERROR_NONE ) {
410
	    /* Option off - return null error */
411
	    destroy_error ( err, 1 ) ;
412
	    err = NULL_err ;
413
	} else {
414
	    /* Set severity level */
415
	    COPY_int ( err_severity ( err ), e ) ;
416
	}
417
    }
418
    return ( err ) ;
419
}
420
 
421
 
422
/*
423
    PERFORM ACTIONS FOR AN OPTION
424
 
425
    This routine performs any actions associated with setting the value
426
    of option n to opt.  The flag end is true if this call is at the
427
    end of a scope to restore the old value of option n.
428
*/
429
 
430
static void action_option
431
    PROTO_N ( ( n, opt, end ) )
432
    PROTO_T ( int n X unsigned opt X int end )
433
{
434
    switch ( n ) {
435
	case OPT_none : {
436
	    error_severity [ OPTION_OFF ] = default_severity [ opt ] ;
437
	    break ;
438
	}
439
	case OPT_warning : {
440
	    error_severity [ OPTION_WARN ] = default_severity [ opt ] ;
441
	    break ;
442
	}
443
	case OPT_error : {
444
	    error_severity [ OPTION_ON ] = default_severity [ opt ] ;
445
	    break ;
446
	}
447
	case OPT_whatever : {
448
	    error_severity [ OPTION_WHATEVER ] = default_severity [ opt ] ;
449
	    break ;
450
	}
451
	case OPT_conv_int_int_expl :
452
	case OPT_conv_int_int_impl :
453
	case OPT_conv_int_ptr_expl :
454
	case OPT_conv_ptr_ptr_expl : {
455
	    /* Individual conversion options */
456
	    if ( !end ) {
457
		OPTION *q = real_opts->opt ;
458
		OPTION c = OPTION_OFF ;
459
		OPTION c1 = OPTION_OFF ;
460
		OPTION c2 = q [ OPT_conv_int_ptr_expl ] ;
461
		OPTION c3 = q [ OPT_conv_ptr_ptr_expl ] ;
462
		OPTION c11 = q [ OPT_conv_int_int_expl ] ;
463
		OPTION c12 = q [ OPT_conv_int_int_impl ] ;
464
		if ( c11 || c12 ) c1 = OPTION_ON ;
465
		if ( c1 || c2 || c3 ) c = OPTION_ON ;
466
		q [ OPT_conv_ptr_ptr ] = c3 ;
467
		q [ OPT_conv_int_ptr ] = c2 ;
468
		q [ OPT_conv_int_int ] = c1 ;
469
		q [ OPT_conv ] = c ;
470
	    }
471
	    break ;
472
	}
473
	case OPT_discard_func :
474
	case OPT_discard_static :
475
	case OPT_discard_value : {
476
	    /* Individual discard options */
477
	    if ( !end ) {
478
		OPTION *q = real_opts->opt ;
479
		OPTION d = OPTION_OFF ;
480
		OPTION d1 = OPTION_OFF ;
481
		OPTION d2 = q [ OPT_discard_static ] ;
482
		OPTION d11 = q [ OPT_discard_func ] ;
483
		OPTION d12 = q [ OPT_discard_value ] ;
484
		if ( d11 || d12 ) d1 = OPTION_ON ;
485
		if ( d1 || d2 ) d = OPTION_ON ;
486
		q [ OPT_discard_exp ] = d1 ;
487
		q [ OPT_discard ] = d ;
488
	    }
489
	    break ;
490
	}
491
	case OPT_const_internal : {
492
	    /* Linkage of const objects */
493
	    if ( opt == OPTION_ON ) {
494
		const_linkage = dspec_static ;
495
	    } else {
496
		const_linkage = dspec_extern ;
497
	    }
498
	    break ;
499
	}
500
	case OPT_inline_internal : {
501
	    /* Linkage of inline functions */
502
	    if ( opt == OPTION_ON ) {
503
		inline_linkage = dspec_static ;
504
	    } else {
505
		inline_linkage = dspec_extern ;
506
	    }
507
	    break ;
508
	}
509
	case OPT_decl_volatile : {
510
	    /* Volatility of external objects */
511
	    if ( opt == OPTION_ON ) {
512
		cv_extern = cv_volatile ;
513
	    } else {
514
		cv_extern = cv_none ;
515
	    }
516
	    break ;
517
	}
518
	case OPT_proto_scope : {
519
	    /* Recalculate namespaces */
520
	    update_namespace () ;
521
	    break ;
522
	}
523
	case OPT_cpplus_comment : {
524
	    /* C++ comments */
525
	    allow_cpp_comments = ( opt != OPTION_DISALLOW ) ;
526
	    break ;
527
	}
528
	case OPT_digraph : {
529
	    /* Digraphs */
530
	    allow_digraphs = ( opt != OPTION_DISALLOW ) ;
531
	    break ;
532
	}
533
	case OPT_dollar_ident : {
534
	    /* Dollar in identifier */
535
	    int c = char_z ;
536
	    if ( opt == OPTION_DISALLOW ) c = char_dollar ;
537
	    set_char_lookup ( char_dollar, c ) ;
538
	    break ;
539
	}
540
	case OPT_iso_keyword : {
541
	    /* ISO keywords */
542
	    allow_iso_keywords = ( opt != OPTION_DISALLOW ) ;
543
	    break ;
544
	}
545
	case OPT_lint_comment : {
546
	    /* Lint comments */
547
	    analyse_comments = ( opt != OPTION_DISALLOW ) ;
548
	    break ;
549
	}
550
	case OPT_longlong : {
551
	    /* 'long long' types */
552
	    int key = ( opt != OPTION_DISALLOW ) ;
553
	    basetype_info [ ntype_sllong ].key = key ;
554
	    basetype_info [ ntype_ullong ].key = key ;
555
	    break ;
556
	}
557
	case OPT_trigraph : {
558
	    /* Trigraphs */
559
	    allow_trigraphs = ( opt != OPTION_DISALLOW ) ;
560
	    break ;
561
	}
562
    }
563
    return ;
564
}
565
 
566
 
567
/*
568
    SET AN OPTION LEVEL
569
 
570
    This routine sets the option n to option level opt.  This can be
571
    OPTION_OFF (for 'off' or 'allow'), OPTION_WARN (for 'warning') or
572
    OPTION_ON (for 'on' or 'disallow').  Note that special action needs
573
    to be taken if n represents a set of options such as conv or discard
574
    where the set value is the logical or of the values of the set
575
    members.
576
*/
577
 
578
void set_option
579
    PROTO_N ( ( n, opt ) )
580
    PROTO_T ( int n X unsigned opt )
581
{
582
    if ( n != -1 ) {
583
	/* Set the option level */
584
	switch ( n ) {
585
	    case OPT_conv : {
586
		/* All conversion options */
587
		set_option ( OPT_conv_int_int_expl, opt ) ;
588
		set_option ( OPT_conv_int_int_impl, opt ) ;
589
		set_option ( OPT_conv_int_ptr_expl, opt ) ;
590
		set_option ( OPT_conv_ptr_ptr_expl, opt ) ;
591
		break ;
592
	    }
593
	    case OPT_conv_int_int : {
594
		/* All integer conversion options */
595
		set_option ( OPT_conv_int_int_expl, opt ) ;
596
		set_option ( OPT_conv_int_int_impl, opt ) ;
597
		break ;
598
	    }
599
	    case OPT_conv_int_ptr : {
600
		/* All integer to pointer conversion options */
601
		set_option ( OPT_conv_int_ptr_expl, opt ) ;
602
		break ;
603
	    }
604
	    case OPT_conv_ptr_ptr : {
605
		/* All pointer conversion options */
606
		set_option ( OPT_conv_ptr_ptr_expl, opt ) ;
607
		break ;
608
	    }
609
	    case OPT_discard : {
610
		/* All discard options */
611
		set_option ( OPT_discard_func, opt ) ;
612
		set_option ( OPT_discard_static, opt ) ;
613
		set_option ( OPT_discard_value, opt ) ;
614
		break ;
615
	    }
616
	    case OPT_discard_exp : {
617
		/* Expression discard options */
618
		set_option ( OPT_discard_func, opt ) ;
619
		set_option ( OPT_discard_value, opt ) ;
620
		break ;
621
	    }
622
	    case OPT_func_impl : {
623
		/* These options are negated */
624
		if ( opt == OPTION_ON ) {
625
		    opt = OPTION_OFF ;
626
		} else if ( opt == OPTION_OFF ) {
627
		    opt = OPTION_ON ;
628
		}
629
		goto default_lab ;
630
	    }
631
	    default :
632
	    default_lab : {
633
		/* Simple options */
634
		OPTIONS *p = crt_opts ;
635
		if ( OPT_CATALOG [n].scoped ) {
636
		    /* Scoped options */
637
		    int sev = ( int ) p->set [n] ;
638
		    OPTION new_opt = ( OPTION ) opt ;
639
		    OPTION old_opt = p->opt [n] ;
640
		    if ( new_opt != old_opt ) {
641
			/* Option value changed */
642
			p->opt [n] = new_opt ;
643
			action_option ( n, opt, 0 ) ;
644
		    }
645
		    if ( sev != ERROR_WHATEVER ) {
646
			/* Option already set in this scope */
647
			string s = ustrlit ( OPT_CATALOG [n].name ) ;
648
			ERROR err = ERR_pragma_scope_set ( s ) ;
649
			if ( !IS_NULL_err ( err ) ) {
650
			    COPY_int ( err_severity ( err ), sev ) ;
651
			    report ( preproc_loc, err ) ;
652
			}
653
		    }
654
		    p->set [n] = ERROR_SERIOUS ;
655
		} else {
656
		    /* Unscoped options */
657
		    p->opt [n] = ( OPTION ) opt ;
658
		    action_option ( n, opt, 0 ) ;
659
		    p->set [n] = ERROR_SERIOUS ;
660
		}
661
		break ;
662
	    }
663
	}
664
    }
665
    return ;
666
}
667
 
668
 
669
/*
670
    PERFORM ACTIONS FOR AN OPTION VALUE
671
 
672
    This routine performs any actions associated with setting option value
673
    n to v.  The flag end is true if this call is at the end of a scope to
674
    restore the old value of option n.
675
*/
676
 
677
static void action_value
678
    PROTO_N ( ( n, v ) )
679
    PROTO_T ( int n X unsigned long v )
680
{
681
    switch ( n ) {
682
	case OPT_VAL_include_depth : {
683
	    set_incl_depth ( v ) ;
684
	    break ;
685
	}
686
	case OPT_VAL_name_limit : {
687
	    if ( v < max_id_length ) max_id_length = v ;
688
	    break ;
689
	}
690
	case OPT_VAL_maximum_error : {
691
	    max_errors = v ;
692
	    break ;
693
	}
694
	case OPT_VAL_tab_width : {
695
	    if ( v != 0 ) tab_width = v ;
696
	    break ;
697
	}
698
    }
699
    return ;
700
}
701
 
702
 
703
/*
704
    SET OPTION VALUE
705
 
706
    This routine sets the option value for option n to the integer literal
707
    expression e or the value v.  Note that option values are not scoped.
708
*/
709
 
710
void set_value
711
    PROTO_N ( ( n, e, v ) )
712
    PROTO_T ( int n X EXP e X unsigned long v )
713
{
714
    if ( !IS_NULL_exp ( e ) ) {
715
	NAT m ;
716
	if ( !IS_exp_int_lit ( e ) ) return ;
717
	m = DEREF_nat ( exp_int_lit_nat ( e ) ) ;
718
	v = get_nat_value ( m ) ;
719
    }
720
    if ( n != -1 ) {
721
	OPT_VALUE_CATALOG [n].max_value = v ;
722
	OPT_VALUE_CATALOG [n].min_value = v ;
723
	action_value ( n, v ) ;
724
    }
725
    return ;
726
}
727
 
728
 
729
/*
730
    CHECK AN OPTION VALUE
731
 
732
    This routine checks whether the value v is less than the maximum
733
    permitted value for the option n.  It returns true if so.  Extra
734
    arguments for use in error reporting may be provided.
735
*/
736
 
737
int check_value
738
    PROTO_V ( ( int n, unsigned long v, ... ) ) /* VARARGS */
739
{
740
    va_list args ;
741
    unsigned long u ;
742
    OPT_VALUE_DATA *p ;
743
#if FS_STDARG
744
    va_start ( args, v ) ;
745
#else
746
    int n ;
747
    unsigned long v ;
748
    va_start ( args ) ;
749
    n = va_arg ( args, int ) ;
750
    v = va_arg ( args, unsigned long ) ;
751
#endif
752
 
753
    /* Check against implementation limit */
754
    p = OPT_VALUE_CATALOG + n ;
755
    u = p->max_value ;
756
    if ( v > u ) {
757
	int err = 1 ;
758
	if ( p->incr ) {
759
	    if ( v > u + 1 ) err = 0 ;
760
	    p->incr = 2 ;
761
	}
762
	if ( err ) {
763
	    LOCATION *loc = p->loc ;
764
	    switch ( n ) {
765
		case OPT_VAL_include_depth : {
766
		    /* Include depth too great */
767
		    print_error ( loc, ERR_cpp_include_depth ( v ) ) ;
768
		    break ;
769
		}
770
		case OPT_VAL_name_limit : {
771
		    /* Name length too great */
772
		    HASHID nm = va_arg ( args, HASHID ) ;
773
		    print_error ( loc, ERR_lex_name_limit ( nm, v, u ) ) ;
774
		    break ;
775
		}
776
		case OPT_VAL_instance_depth : {
777
		    /* Instantiation depth too great */
778
		    print_error ( loc, ERR_temp_inst_depth ( v ) ) ;
779
		    break ;
780
		}
781
		default : {
782
		    /* Other limit exceeded */
783
		    string s = ustrlit ( p->name ) ;
784
		    print_error ( loc, ERR_limits_max ( s, v, u ) ) ;
785
		    break ;
786
		}
787
	    }
788
	}
789
	va_end ( args ) ;
790
	return ( 0 ) ;
791
    }
792
 
793
    /* Check against minimum implementation limit */
794
    u = p->min_value ;
795
    if ( v > u ) {
796
	if ( p->incr ) {
797
	    p->incr = 2 ;
798
	} else {
799
	    LOCATION *loc = p->loc ;
800
	    string s = ustrlit ( p->name ) ;
801
	    print_error ( loc, ERR_limits_min ( s, v, u ) ) ;
802
	}
803
    }
804
    va_end ( args ) ;
805
    return ( 1 ) ;
806
}
807
 
808
 
809
/*
810
    INCREMENT AN OPTION VALUE
811
 
812
    This routine increments the current value of the option value n,
813
    applying check_value to the result.
814
*/
815
 
816
int incr_value
817
    PROTO_N ( ( n ) )
818
    PROTO_T ( int n )
819
{
820
    OPT_VALUE_DATA *p = OPT_VALUE_CATALOG + n ;
821
    unsigned long v = ++( p->crt_value ) ;
822
    ASSERT ( p->incr ) ;
823
    return ( check_value ( n, v ) ) ;
824
}
825
 
826
 
827
/*
828
    DECREMENT AN OPTION VALUE
829
 
830
    This routine decrements the current value of the option value n.
831
*/
832
 
833
void decr_value
834
    PROTO_N ( ( n ) )
835
    PROTO_T ( int n )
836
{
837
    OPT_VALUE_DATA *p = OPT_VALUE_CATALOG + n ;
838
    unsigned long v = p->crt_value ;
839
    if ( v ) {
840
	if ( p->incr == 2 ) {
841
	    /* Report maximum value attained */
842
	    LOCATION *loc = p->loc ;
843
	    string s = ustrlit ( p->name ) ;
844
	    unsigned long u = p->min_value ;
845
	    print_error ( loc, ERR_limits_min ( s, v, u ) ) ;
846
	    p->incr = 1 ;
847
	}
848
	p->crt_value = v - 1 ;
849
    }
850
    return ;
851
}
852
 
853
 
854
/*
855
    SET LINKAGE OPTION
856
 
857
    This routine sets the current external linkage option to ds.
858
*/
859
 
860
void set_link_opt
861
    PROTO_N ( ( ds ) )
862
    PROTO_T ( DECL_SPEC ds )
863
{
864
    OPTIONS *p = crt_opts ;
865
    if ( p ) {
866
	DECL_SPEC ods = p->lnk_opt [1] ;
867
	if ( ods != dspec_ignore ) {
868
	    /* Option already set in this scope */
869
	    string s = ustrlit ( "link_extern" ) ;
870
	    ERROR err = ERR_pragma_scope_set ( s ) ;
871
	    if ( !IS_NULL_err ( err ) ) {
872
		report ( preproc_loc, err ) ;
873
	    }
874
	}
875
	p->lnk_opt [1] = ds ;
876
	crt_linkage = ds ;
877
	new_linkage = ds ;
878
    }
879
    return ;
880
}
881
 
882
 
883
/*
884
    FIND A NAMED CHECKING SCOPE
885
 
886
    This routine searches for a checking scope named nm, returning the
887
    corresponding table of options.  If nm has not been defined then the
888
    null pointer is returned.
889
*/
890
 
891
static OPTIONS *find_option
892
    PROTO_N ( ( nm ) )
893
    PROTO_T ( HASHID nm )
894
{
895
    OPTIONS *p ;
896
    for ( p = all_opts ; p != NULL ; p = p->next ) {
897
	if ( EQ_hashid ( nm, p->name ) ) return ( p ) ;
898
    }
899
    return ( NULL ) ;
900
}
901
 
902
 
903
/*
904
    CREATE A NEW OPTION
905
 
906
    This routine creates a new option scope named nm with initial
907
    values taken either from the existing scope q or, if this is the
908
    null pointer, the nth entry of the options catalogue above.
909
*/
910
 
911
static OPTIONS *new_option
912
    PROTO_N ( ( nm, q, n ) )
913
    PROTO_T ( HASHID nm X OPTIONS *q X int n )
914
{
915
    /* Allocate space for new scope */
916
    int i ;
917
    OPTIONS *p = xmalloc_nof ( OPTIONS, 1 ) ;
918
    OPTION *po = xmalloc_nof ( OPTION, 2 * CATALOG_SIZE ) ;
919
    OPTION *ps = po + CATALOG_SIZE ;
920
    p->opt = po ;
921
    p->set = ps ;
922
    p->val_opt [0] = no_declarations ;
923
    p->lnk_opt [0] = crt_linkage ;
924
    p->lnk_opt [1] = dspec_ignore ;
925
    p->prev = NULL ;
926
    p->name = NULL_hashid ;
927
    p->next = all_opts ;
928
    all_opts = p ;
929
 
930
    /* Check scope name */
931
    if ( !IS_NULL_hashid ( nm ) ) {
932
	if ( find_option ( nm ) ) {
933
	    report ( preproc_loc, ERR_pragma_scope_redef ( nm ) ) ;
934
	}
935
	p->name = nm ;
936
    }
937
 
938
    /* Set up scope */
939
    if ( q ) {
940
	/* Copy existing scope */
941
	OPTION *qo = q->opt ;
942
	for ( i = 0 ; i < CATALOG_SIZE ; i++ ) {
943
	    *( po++ ) = *( qo++ ) ;
944
	    *( ps++ ) = ERROR_WHATEVER ;
945
	}
946
    } else {
947
	/* Use standard scope */
948
	OPT_DATA *cat = OPT_CATALOG ;
949
	for ( i = 0 ; i < CATALOG_SIZE ; i++ ) {
950
	    /* Use the nth entry from the catalogue */
951
	    *( po++ ) = cat->def [n] ;
952
	    *( ps++ ) = ERROR_SERIOUS ;
953
	    cat++ ;
954
	}
955
    }
956
    return ( p ) ;
957
}
958
 
959
 
960
/*
961
    BEGIN A CHECKING SCOPE
962
 
963
    This routine begins a new checking scope.
964
*/
965
 
966
void begin_option
967
    PROTO_N ( ( id ) )
968
    PROTO_T ( IDENTIFIER id )
969
{
970
    OPTIONS *p ;
971
    HASHID nm = NULL_hashid ;
972
    if ( !IS_NULL_id ( id ) ) nm = DEREF_hashid ( id_name ( id ) ) ;
973
    p = new_option ( nm, real_opts, 0 ) ;
974
    p->prev = real_opts ;
975
    crt_opts = p ;
976
    real_opts = p ;
977
    crt_opt = p->opt ;
978
    return ;
979
}
980
 
981
 
982
/*
983
    END A CHECKING SCOPE
984
 
985
    This routine ends the current checking scope.
986
*/
987
 
988
void end_option
989
    PROTO_N ( ( expl ) )
990
    PROTO_T ( int expl )
991
{
992
    OPTIONS *p = real_opts ;
993
    if ( p ) {
994
	OPTIONS *q = p->prev ;
995
	DECL_SPEC ds = p->lnk_opt [0] ;
996
	if ( expl && p->val_opt [0] == no_declarations ) {
997
	    if ( IS_NULL_hashid ( p->name ) && !preproc_only ) {
998
		report ( preproc_loc, ERR_dcl_dcl_none () ) ;
999
	    }
1000
	}
1001
	crt_linkage = ds ;
1002
	new_linkage = ds ;
1003
	if ( q ) {
1004
	    int i ;
1005
	    crt_opts = q ;
1006
	    real_opts = q ;
1007
	    crt_opt = q->opt ;
1008
	    for ( i = 0 ; i < CATALOG_SIZE ; i++ ) {
1009
		if ( p->set [i] != ERROR_WHATEVER ) {
1010
		    /* Restore old option value */
1011
		    OPTION opt_old = p->opt [i] ;
1012
		    OPTION opt_new = q->opt [i] ;
1013
		    if ( opt_new != opt_old ) {
1014
			if ( OPT_CATALOG [i].scoped ) {
1015
			    action_option ( i, ( unsigned ) opt_new, 1 ) ;
1016
			} else {
1017
			    q->opt [i] = opt_old ;
1018
			    q->set [i] = 1 ;
1019
			}
1020
		    }
1021
		}
1022
	    }
1023
	    return ;
1024
	}
1025
    }
1026
    report ( preproc_loc, ERR_pragma_scope_end () ) ;
1027
    return ;
1028
}
1029
 
1030
 
1031
/*
1032
    USE A CHECKING SCOPE
1033
 
1034
    This routine brings the set of checks given by p into the current
1035
    checking scope.  e indicates the error severity with which to report
1036
    reset options.
1037
*/
1038
 
1039
void use_mode
1040
    PROTO_N ( ( p, e ) )
1041
    PROTO_T ( OPTIONS *p X int e )
1042
{
1043
    int i ;
1044
    OPTIONS *q = real_opts ;
1045
    DECL_SPEC ds = p->lnk_opt [1] ;
1046
    if ( ds != dspec_ignore ) {
1047
	DECL_SPEC ods = q->lnk_opt [1] ;
1048
	if ( ods != dspec_ignore ) {
1049
	    /* Option already set in this scope */
1050
	    string s = ustrlit ( "link_extern" ) ;
1051
	    ERROR err = ERR_pragma_scope_set ( s ) ;
1052
	    if ( !IS_NULL_err ( err ) ) {
1053
		COPY_int ( err_severity ( err ), e ) ;
1054
		report ( preproc_loc, err ) ;
1055
	    }
1056
	}
1057
	q->lnk_opt [1] = ds ;
1058
	crt_linkage = ds ;
1059
	new_linkage = ds ;
1060
    }
1061
    for ( i = 0 ; i < CATALOG_SIZE ; i++ ) {
1062
	if ( p->set [i] != ERROR_WHATEVER && OPT_CATALOG [i].scoped ) {
1063
	    OPTION new_opt = p->opt [i] ;
1064
	    OPTION old_opt = q->opt [i] ;
1065
	    if ( new_opt != old_opt ) {
1066
		/* Option value changed */
1067
		q->opt [i] = new_opt ;
1068
		action_option ( i, ( unsigned ) new_opt, 0 ) ;
1069
	    }
1070
	    if ( q->set [i] != ERROR_WHATEVER && e != ERROR_NONE ) {
1071
		/* Option already set in this scope */
1072
		string s = ustrlit ( OPT_CATALOG [i].name ) ;
1073
		ERROR err = ERR_pragma_scope_set ( s ) ;
1074
		if ( !IS_NULL_err ( err ) ) {
1075
		    COPY_int ( err_severity ( err ), e ) ;
1076
		    report ( preproc_loc, err ) ;
1077
		}
1078
	    }
1079
	    q->set [i] = ERROR_SERIOUS ;
1080
	}
1081
    }
1082
    return ;
1083
}
1084
 
1085
 
1086
/*
1087
    SET CURRENT CHECKING SCOPE
1088
 
1089
    This routine sets the current checking scope to p.  It is used in
1090
    context switching in macro expansion.
1091
*/
1092
 
1093
void set_mode
1094
    PROTO_N ( ( p ) )
1095
    PROTO_T ( OPTIONS *p )
1096
{
1097
    if ( p ) {
1098
	crt_opts = p ;
1099
	crt_opt = p->opt ;
1100
    }
1101
    return ;
1102
}
1103
 
1104
 
1105
/*
1106
    USE A NAMED CHECKING SCOPE
1107
 
1108
    This routine brings the named checking scope id back into scope.  The
1109
    opt argument describes how the resetting of these options are to be
1110
    handled.
1111
*/
1112
 
1113
void use_option
1114
    PROTO_N ( ( id, opt ) )
1115
    PROTO_T ( IDENTIFIER id X unsigned opt )
1116
{
1117
    HASHID nm = DEREF_hashid ( id_name ( id ) ) ;
1118
    OPTIONS *p = find_option ( nm ) ;
1119
    if ( p == NULL ) {
1120
	report ( preproc_loc, ERR_pragma_scope_undef ( nm ) ) ;
1121
	return ;
1122
    }
1123
    use_mode ( p, error_severity [ opt ] ) ;
1124
    return ;
1125
}
1126
 
1127
 
1128
/*
1129
    ASSOCIATE A CHECKING SCOPE WITH A DIRECTORY
1130
 
1131
    This routine associates the named checking scope id with the named
1132
    include file directory dir.
1133
*/
1134
 
1135
void directory_option
1136
    PROTO_N ( ( dir, id ) )
1137
    PROTO_T ( IDENTIFIER dir X IDENTIFIER id )
1138
{
1139
    string s ;
1140
    HASHID nm = DEREF_hashid ( id_name ( id ) ) ;
1141
    OPTIONS *p = find_option ( nm ) ;
1142
    if ( p == NULL ) {
1143
	report ( preproc_loc, ERR_pragma_scope_undef ( nm ) ) ;
1144
    }
1145
    nm = DEREF_hashid ( id_name ( dir ) ) ;
1146
    s = DEREF_string ( hashid_name_etc_text ( nm ) ) ;
1147
    directory_mode ( s, p ) ;
1148
    return ;
1149
}
1150
 
1151
 
1152
/*
1153
    INITIALISE OPTIONS
1154
 
1155
    This routine initialises the outer checking scope at the checking
1156
    level indicated by level and sets up the option hash table.
1157
*/
1158
 
1159
void init_option
1160
    PROTO_N ( ( level ) )
1161
    PROTO_T ( int level )
1162
{
1163
    int i ;
1164
    string s ;
1165
    HASHID nm ;
1166
    OPTION *po ;
1167
    OPTIONS *p1, *p2 ;
1168
    OPT_DATA *cat = OPT_CATALOG ;
1169
    OPT_VALUE_DATA *vcat = OPT_VALUE_CATALOG ;
1170
 
1171
    /* Mark basic options */
1172
    cat [ OPT_none ].scoped = 0 ;
1173
    cat [ OPT_warning ].scoped = 0 ;
1174
    cat [ OPT_error ].scoped = 0 ;
1175
    cat [ OPT_whatever ].scoped = 0 ;
1176
 
1177
    /* Mark unscoped options */
1178
    cat [ OPT_const_internal ].scoped = 0 ;
1179
    cat [ OPT_cpplus_comment ].scoped = 0 ;
1180
    cat [ OPT_digraph ].scoped = 0 ;
1181
    cat [ OPT_dollar_ident ].scoped = 0 ;
1182
    cat [ OPT_ellipsis_ident ].scoped = 0 ;
1183
    cat [ OPT_inline_internal ].scoped = 0 ;
1184
    cat [ OPT_iso_keyword ].scoped = 0 ;
1185
    cat [ OPT_lint_comment ].scoped = 0 ;
1186
    cat [ OPT_trigraph ].scoped = 0 ;
1187
 
1188
    /* A few other initialisations */
1189
    max_id_length = vcat [ OPT_VAL_name_limit ].min_value ;
1190
 
1191
    /* Set up default compilation modes */
1192
    s = ustrlit ( "__DEFAULT__" ) ;
1193
    nm = lookup_name ( s, hash ( s ), 0, lex_identifier ) ;
1194
    p1 = new_option ( nm, NIL ( OPTIONS ), 0 ) ;
1195
    s = ustrlit ( "__ALL__" ) ;
1196
    nm = lookup_name ( s, hash ( s ), 0, lex_identifier ) ;
1197
    p2 = new_option ( nm, NIL ( OPTIONS ), 1 ) ;
1198
 
1199
    /* Bring option into scope */
1200
    if ( level == 1 ) p1 = p2 ;
1201
    p1 = new_option ( NULL_hashid, p1, 0 ) ;
1202
    crt_opts = p1 ;
1203
    real_opts = p1 ;
1204
    po = p1->opt ;
1205
    crt_opt = po ;
1206
    for ( i = 0 ; i < CATALOG_SIZE ; i++ ) {
1207
	OPTION e = *( po++ ) ;
1208
	action_option ( i, ( unsigned ) e, 0 ) ;
1209
    }
1210
    for ( i = 0 ; i < VALUE_CAT_SIZE ; i++ ) {
1211
	action_value ( i, vcat->max_value ) ;
1212
	vcat++ ;
1213
    }
1214
    return ;
1215
}
1216
 
1217
 
1218
/*
1219
    TERMINATE OPTIONS
1220
 
1221
    This routine calls end_option for all unterminated checking scopes.
1222
    It also reports any implementation limits which have been exceeded
1223
    but not previously reported.
1224
*/
1225
 
1226
void term_option
1227
    PROTO_Z ()
1228
{
1229
    if ( real_opts ) {
1230
	int i ;
1231
	int expl = 1 ;
1232
	OPT_VALUE_DATA *p = OPT_VALUE_CATALOG ;
1233
	for ( i = 0 ; i < VALUE_CAT_SIZE ; i++ ) {
1234
	    if ( p->incr == 2 ) {
1235
		/* Implementation limit exceeded */
1236
		string s = ustrlit ( p->name ) ;
1237
		unsigned long v = p->crt_value ;
1238
		unsigned long u = p->min_value ;
1239
		report ( preproc_loc, ERR_limits_min ( s, v, u ) ) ;
1240
		p->incr = 1 ;
1241
	    }
1242
	    p++ ;
1243
	}
1244
	while ( real_opts->prev ) {
1245
	    end_option ( expl ) ;
1246
	    expl = 0 ;
1247
	}
1248
	if ( expl && no_declarations == 0 && !preproc_only ) {
1249
	    report ( preproc_loc, ERR_dcl_dcl_none () ) ;
1250
	}
1251
    }
1252
    xfree_nof ( all_option_hash ) ;
1253
    all_option_hash = NULL ;
1254
    return ;
1255
}