1/* Definitions for c-common.c.
2 Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
3 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
--- 5 unchanged lines hidden (view full) ---
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
21
22#ifndef GCC_C_COMMON_H
23#define GCC_C_COMMON_H
24
25#include "splay-tree.h"
26#include "cpplib.h"
27
28/* Usage of TREE_LANG_FLAG_?:
29 0: COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
--- 8 unchanged lines hidden (view full) ---
38 STMT_IS_FULL_EXPR_P (in _STMT)
39 2: STMT_LINENO_FOR_FN_P (in _STMT)
40 3: SCOPE_NO_CLEANUPS_P (in SCOPE_STMT)
41 COMPOUND_STMT_BODY_BLOCK (in COMPOUND_STMT)
42 4: SCOPE_PARTIAL_P (in SCOPE_STMT)
43*/
44
45/* Reserved identifiers. This is the union of all the keywords for C,
46 C++, and Objective-C. All the type modifiers have to be in one
47 block at the beginning, because they are used as mask bits. There
48 are 27 type modifiers; if we add many more we will have to redesign
49 the mask mechanism. */
50
51enum rid
52{
53 /* Modifiers: */
54 /* C, in empirical order of frequency. */
55 RID_STATIC = 0,
56 RID_UNSIGNED, RID_LONG, RID_CONST, RID_EXTERN,
57 RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
58 RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
59
60 /* C extensions */
61 RID_BOUNDED, RID_UNBOUNDED, RID_COMPLEX, RID_THREAD,
62
63 /* C++ */
64 RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
65
66 /* ObjC */
67 RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
68
69 /* C */
--- 18 unchanged lines hidden (view full) ---
88 RID_DELETE, RID_FALSE, RID_NAMESPACE,
89 RID_NEW, RID_OPERATOR, RID_THIS,
90 RID_THROW, RID_TRUE, RID_TRY,
91 RID_TYPENAME, RID_TYPEID, RID_USING,
92
93 /* casts */
94 RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
95
96 /* Objective-C */
97 RID_ID, RID_AT_ENCODE, RID_AT_END,
98 RID_AT_CLASS, RID_AT_ALIAS, RID_AT_DEFS,
99 RID_AT_PRIVATE, RID_AT_PROTECTED, RID_AT_PUBLIC,
100 RID_AT_PROTOCOL, RID_AT_SELECTOR, RID_AT_INTERFACE,
101 RID_AT_IMPLEMENTATION,
102
103 RID_MAX,
104
--- 64 unchanged lines hidden (view full) ---
169
170 CTI_MAX
171};
172
173#define C_RID_CODE(id) (((struct c_common_identifier *) (id))->node.rid_code)
174
175/* Identifier part common to the C front ends. Inherits from
176 tree_identifier, despite appearances. */
177struct c_common_identifier GTY(())
178{
179 struct tree_common common;
180 struct cpp_hashnode GTY ((skip (""))) node;
181};
182
183#define wchar_type_node c_global_trees[CTI_WCHAR_TYPE]
184#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE]
185#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
186#define wint_type_node c_global_trees[CTI_WINT_TYPE]
187#define signed_size_type_node c_global_trees[CTI_SIGNED_SIZE_TYPE]
188#define unsigned_ptrdiff_type_node c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
--- 27 unchanged lines hidden (view full) ---
216#define function_name_decl_node c_global_trees[CTI_FUNCTION_NAME_DECL]
217#define pretty_function_name_decl_node c_global_trees[CTI_PRETTY_FUNCTION_NAME_DECL]
218#define c99_function_name_decl_node c_global_trees[CTI_C99_FUNCTION_NAME_DECL]
219#define saved_function_name_decls c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS]
220
221/* A node for `((void) 0)'. */
222#define void_zero_node c_global_trees[CTI_VOID_ZERO]
223
224extern GTY(()) tree c_global_trees[CTI_MAX];
225
226/* Mark which labels are explicitly declared.
227 These may be shadowed, and may be referenced from nested functions. */
228#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
229
230/* Flag strings given by __FUNCTION__ and __PRETTY_FUNCTION__ for a
231 warning if they undergo concatenation. */
232#define C_ARTIFICIAL_STRING_P(NODE) TREE_LANG_FLAG_0 (NODE)
233
234typedef enum c_language_kind
235{
236 clk_c = 0, /* A dialect of C: K&R C, ANSI/ISO C89, C2000, etc. */
237 clk_cplusplus /* ANSI/ISO C++ */
238}
239c_language_kind;
240
241/* Information about a statement tree. */
242
243struct stmt_tree_s GTY(()) {
244 /* The last statement added to the tree. */
245 tree x_last_stmt;
246 /* The type of the last expression statement. (This information is
247 needed to implement the statement-expression extension.) */
248 tree x_last_expr_type;
249 /* The last filename we recorded. */
250 const char *x_last_expr_filename;
251 /* In C++, Nonzero if we should treat statements as full
252 expressions. In particular, this variable is no-zero if at the
253 end of a statement we should destroy any temporaries created
254 during that statement. Similarly, if, at the end of a block, we
255 should destroy any local variables in this block. Normally, this
256 variable is nonzero, since those are the normal semantics of
257 C++.
258
259 However, in order to represent aggregate initialization code as
260 tree structure, we use statement-expressions. The statements
261 within the statement expression should not result in cleanups
262 being run until the entire enclosing statement is complete.
263
264 This flag has no effect in C. */
265 int stmts_are_full_exprs_p;
266};
267
268typedef struct stmt_tree_s *stmt_tree;
269
270/* Global state pertinent to the current function. Some C dialects
271 extend this structure with additional fields. */
272
273struct c_language_function GTY(()) {
274 /* While we are parsing the function, this contains information
275 about the statement-tree that we are building. */
276 struct stmt_tree_s x_stmt_tree;
277 /* The stack of SCOPE_STMTs for the current function. */
278 tree x_scope_stmt_stack;
279};
280
281/* When building a statement-tree, this is the last statement added to
--- 22 unchanged lines hidden (view full) ---
304 } while (0)
305
306/* Language-specific hooks. */
307
308extern int (*lang_statement_code_p) PARAMS ((enum tree_code));
309extern void (*lang_expand_stmt) PARAMS ((tree));
310extern void (*lang_expand_decl_stmt) PARAMS ((tree));
311extern void (*lang_expand_function_end) PARAMS ((void));
312extern tree gettags PARAMS ((void));
313
314/* Callback that determines if it's ok for a function to have no
315 noreturn attribute. */
316extern int (*lang_missing_noreturn_ok_p) PARAMS ((tree));
317
318extern int yyparse PARAMS ((void));
319extern void free_parser_stacks PARAMS ((void));
320
321extern stmt_tree current_stmt_tree PARAMS ((void));
322extern tree *current_scope_stmt_stack PARAMS ((void));
323extern void begin_stmt_tree PARAMS ((tree *));
324extern tree add_stmt PARAMS ((tree));
325extern void add_decl_stmt PARAMS ((tree));
326extern tree add_scope_stmt PARAMS ((int, int));
327extern void finish_stmt_tree PARAMS ((tree *));
328
329extern int statement_code_p PARAMS ((enum tree_code));
330extern tree walk_stmt_tree PARAMS ((tree *,
331 walk_tree_fn,
332 void *));
333extern void prep_stmt PARAMS ((tree));
334extern void expand_stmt PARAMS ((tree));
335extern void shadow_warning PARAMS ((const char *,
336 tree, tree));
337extern tree c_begin_if_stmt PARAMS ((void));
338extern tree c_begin_while_stmt PARAMS ((void));
339extern void c_finish_while_stmt_cond PARAMS ((tree, tree));
340
341
342/* Extra information associated with a DECL. Other C dialects extend
343 this structure in various ways. The C front-end only uses this
344 structure for FUNCTION_DECLs; all other DECLs have a NULL
345 DECL_LANG_SPECIFIC field. */
346
347struct c_lang_decl GTY(()) {
348 unsigned declared_inline : 1;
349};
350
351/* In a FUNCTION_DECL for which DECL_BUILT_IN does not hold, this is
352 the approximate number of statements in this function. There is
353 no need for this number to be exact; it is only used in various
354 heuristics regarding optimization. */
355#define DECL_NUM_STMTS(NODE) \
356 (FUNCTION_DECL_CHECK (NODE)->decl.u1.i)
357
358/* The variant of the C language being processed. Each C language
359 front-end defines this variable. */
360
361extern c_language_kind c_language;
362
363/* Switches common to the C front ends. */
364
365/* Nonzero if prepreprocessing only. */
366extern int flag_preprocess_only;
367
368/* Nonzero if an ISO standard was selected. It rejects macros in the
369 user's namespace. */
370extern int flag_iso;
371
372/* Nonzero whenever Objective-C functionality is being used. */
373extern int flag_objc;
374
375/* Nonzero if -undef was given. It suppresses target built-in macros
376 and assertions. */
377extern int flag_undef;
378
379/* Nonzero means don't recognize the non-ANSI builtin functions. */
380
381extern int flag_no_builtin;
382
383/* Nonzero means don't recognize the non-ANSI builtin functions.
384 -ansi sets this. */
385
386extern int flag_no_nonansi_builtin;
387
388/* Nonzero means give `double' the same size as `float'. */
389
390extern int flag_short_double;
391
392/* Nonzero means give `wchar_t' the same size as `short'. */
393
394extern int flag_short_wchar;
395
396/* Nonzero means allow Microsoft extensions without warnings or errors. */
397extern int flag_ms_extensions;
398
399/* Nonzero means don't recognize the keyword `asm'. */
400
401extern int flag_no_asm;
402
403/* Nonzero means give string constants the type `const char *', as mandated
404 by the standard. */
405
406extern int flag_const_strings;
407
408/* Nonzero means `$' can be in an identifier. */
409
410extern int dollars_in_ident;
411
412/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
413
414extern int flag_signed_bitfields;
415extern int explicit_flag_signed_bitfields;
416
417/* Nonzero means warn about pointer casts that can drop a type qualifier
418 from the pointer target type. */
419
420extern int warn_cast_qual;
421
422/* Warn about functions which might be candidates for format attributes. */
423
424extern int warn_missing_format_attribute;
425
426/* Nonzero means do not warn that K&R style main() is not a function prototype. */
427extern int flag_bsd_no_warn_kr_main;
428
429/* Nonzero means warn about sizeof(function) or addition/subtraction
430 of function pointers. */
431
432extern int warn_pointer_arith;
433
434/* Nonzero means warn for any global function def
435 without separate previous prototype decl. */
436
437extern int warn_missing_prototypes;
438
439/* Warn if adding () is suggested. */
440
441extern int warn_parentheses;
442
443/* Warn if initializer is not completely bracketed. */
444
445extern int warn_missing_braces;
446
447/* Warn about comparison of signed and unsigned values.
448 If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */
449
450extern int warn_sign_compare;
451
452/* Nonzero means warn about usage of long long when `-pedantic'. */
453
454extern int warn_long_long;
455
456/* Nonzero means warn about deprecated conversion from string constant to
457 `char *'. */
458
459extern int warn_write_strings;
460
461/* Nonzero means warn about multiple (redundant) decls for the same single
462 variable or function. */
463
464extern int warn_redundant_decls;
465
466/* Warn about testing equality of floating point numbers. */
467
468extern int warn_float_equal;
469
470/* Warn about a subscript that has type char. */
471
472extern int warn_char_subscripts;
473
474/* Warn if a type conversion is done that might have confusing results. */
475
476extern int warn_conversion;
477
478/* Warn about #pragma directives that are not recognized. */
479
480extern int warn_unknown_pragmas; /* Tri state variable. */
481
482/* Warn about format/argument anomalies in calls to formatted I/O functions
483 (*printf, *scanf, strftime, strfmon, etc.). */
484
485extern int warn_format;
486
487/* Warn about Y2K problems with strftime formats. */
488
489extern int warn_format_y2k;
490
491/* Warn about excess arguments to formats. */
492
493extern int warn_format_extra_args;
494
495/* Warn about zero-length formats. */
496
497extern int warn_format_zero_length;
498
499/* Warn about non-literal format arguments. */
500
501extern int warn_format_nonliteral;
502
503/* Warn about possible security problems with calls to format functions. */
504
505extern int warn_format_security;
506
507
508/* C/ObjC language option variables. */
509
510
511/* Nonzero means message about use of implicit function declarations;
512 1 means warning; 2 means error. */
513
514extern int mesg_implicit_function_declaration;
515
516/* Nonzero means allow type mismatches in conditional expressions;
517 just make their values `void'. */
518
519extern int flag_cond_mismatch;
520
521/* Nonzero means enable C89 Amendment 1 features. */
522
523extern int flag_isoc94;
524
525/* Nonzero means use the ISO C99 dialect of C. */
526
527extern int flag_isoc99;
528
529/* Nonzero means allow the BSD kernel printf enhancments. */
530
531extern int flag_bsd_format;
532
533/* Nonzero means that we have builtin functions, and main is an int */
534
535extern int flag_hosted;
536
537/* Nonzero means add default format_arg attributes for functions not
538 in ISO C. */
539
540extern int flag_noniso_default_format_attributes;
541
542/* Nonzero means warn when casting a function call to a type that does
543 not match the return type (e.g. (float)sqrt() or (anything*)malloc()
544 when there is no previous declaration of sqrt or malloc. */
545
546extern int warn_bad_function_cast;
547
548/* Warn about traditional constructs whose meanings changed in ANSI C. */
549
550extern int warn_traditional;
551
552/* Nonzero means warn for non-prototype function decls
553 or non-prototyped defs without previous prototype. */
554
555extern int warn_strict_prototypes;
556
557/* Nonzero means warn for any global function def
558 without separate previous decl. */
559
560extern int warn_missing_declarations;
561
562/* Nonzero means warn about extern declarations of objects not at
563 file-scope level and about *all* declarations of functions (whether
564 extern or static) not at file-scope level. Note that we exclude
565 implicit function declarations. To get warnings about those, use
566 -Wimplicit. */
567
568extern int warn_nested_externs;
569
570/* Warn if main is suspicious. */
571
572extern int warn_main;
573
574/* Nonzero means warn about possible violations of sequence point rules. */
575
576extern int warn_sequence_point;
577
578/* Nonzero means to warn about compile-time division by zero. */
579extern int warn_div_by_zero;
580
581/* Nonzero means warn about use of implicit int. */
582
583extern int warn_implicit_int;
584
585/* Warn about NULL being passed to argument slots marked as requiring
586 non-NULL. */
587
588extern int warn_nonnull;
589
590
591/* ObjC language option variables. */
592
593
594/* Open and close the file for outputting class declarations, if
595 requested (ObjC). */
596
597extern int flag_gen_declaration;
598
599/* Generate code for GNU or NeXT runtime environment. */
600
601extern int flag_next_runtime;
602
603/* Tells the compiler that this is a special run. Do not perform any
604 compiling, instead we are to test some platform dependent features
605 and output a C header file with appropriate definitions. */
606
607extern int print_struct_values;
608
609/* ???. Undocumented. */
610
611extern const char *constant_string_class_name;
612
613/* Warn if multiple methods are seen for the same selector, but with
614 different argument types. Performs the check on the whole selector
615 table at the end of compilation. */
616
617extern int warn_selector;
618
619/* Warn if a @selector() is found, and no method with that selector
620 has been previously declared. The check is done on each
621 @selector() as soon as it is found - so it warns about forward
622 declarations. */
623
624extern int warn_undeclared_selector;
625
626/* Warn if methods required by a protocol are not implemented in the
627 class adopting it. When turned off, methods inherited to that
628 class are also considered implemented. */
629
630extern int warn_protocol;
631
632
633/* C++ language option variables. */
634
635
636/* Nonzero means don't recognize any extension keywords. */
637
638extern int flag_no_gnu_keywords;
639
640/* Nonzero means do emit exported implementations of functions even if
641 they can be inlined. */
642
643extern int flag_implement_inlines;
644
645/* Nonzero means do emit exported implementations of templates, instead of
646 multiple static copies in each file that needs a definition. */
647
648extern int flag_external_templates;
649
650/* Nonzero means that the decision to emit or not emit the implementation of a
651 template depends on where the template is instantiated, rather than where
652 it is defined. */
653
654extern int flag_alt_external_templates;
655
656/* Nonzero means that implicit instantiations will be emitted if needed. */
657
658extern int flag_implicit_templates;
659
660/* Nonzero means that implicit instantiations of inline templates will be
661 emitted if needed, even if instantiations of non-inline templates
662 aren't. */
663
664extern int flag_implicit_inline_templates;
665
666/* Nonzero means generate separate instantiation control files and
667 juggle them at link time. */
668
669extern int flag_use_repository;
670
671/* Nonzero if we want to issue diagnostics that the standard says are not
672 required. */
673
674extern int flag_optional_diags;
675
676/* Nonzero means we should attempt to elide constructors when possible. */
677
678extern int flag_elide_constructors;
679
680/* Nonzero means that member functions defined in class scope are
681 inline by default. */
682
683extern int flag_default_inline;
684
685/* Controls whether compiler generates 'type descriptor' that give
686 run-time type information. */
687
688extern int flag_rtti;
689
690/* Nonzero if we want to conserve space in the .o files. We do this
691 by putting uninitialized data and runtime initialized data into
692 .common instead of .data at the expense of not flagging multiple
693 definitions. */
694
695extern int flag_conserve_space;
696
697/* Nonzero if we want to obey access control semantics. */
698
699extern int flag_access_control;
700
701/* Nonzero if we want to check the return value of new and avoid calling
702 constructors if it is a null pointer. */
703
704extern int flag_check_new;
705
706/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
707 initialization variables.
708 0: Old rules, set by -fno-for-scope.
709 2: New ISO rules, set by -ffor-scope.
710 1: Try to implement new ISO rules, but with backup compatibility
711 (and warnings). This is the default, for now. */
712
713extern int flag_new_for_scope;
714
715/* Nonzero if we want to emit defined symbols with common-like linkage as
716 weak symbols where possible, in order to conform to C++ semantics.
717 Otherwise, emit them as local symbols. */
718
719extern int flag_weak;
720
721/* Nonzero to use __cxa_atexit, rather than atexit, to register
722 destructors for local statics and global objects. */
723
724extern int flag_use_cxa_atexit;
725
726/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
727
728extern int flag_vtable_gc;
729
730/* Nonzero means make the default pedwarns warnings instead of errors.
731 The value of this flag is ignored if -pedantic is specified. */
732
733extern int flag_permissive;
734
735/* Nonzero means to implement standard semantics for exception
736 specifications, calling unexpected if an exception is thrown that
737 doesn't match the specification. Zero means to treat them as
738 assertions and optimize accordingly, but not check them. */
739
740extern int flag_enforce_eh_specs;
741
742/* The version of the C++ ABI in use. The following values are
743 allowed:
744
745 0: The version of the ABI believed most conformant with the
746 C++ ABI specification. This ABI may change as bugs are
747 discovered and fixed. Therefore, 0 will not necessarily
748 indicate the same ABI in different versions of G++.
749
750 1: The version of the ABI first used in G++ 3.2.
751
752 Additional positive integers will be assigned as new versions of
753 the ABI become the default version of the ABI. */
754
755extern int flag_abi_version;
756
757/* Nonzero means warn about things that will change when compiling
758 with an ABI-compliant compiler. */
759
760extern int warn_abi;
761
762/* Nonzero means warn about implicit declarations. */
763
764extern int warn_implicit;
765
766/* Nonzero means warn when all ctors or dtors are private, and the class
767 has no friends. */
768
769extern int warn_ctor_dtor_privacy;
770
771/* Nonzero means warn in function declared in derived class has the
772 same name as a virtual in the base class, but fails to match the
773 type signature of any virtual function in the base class. */
774
775extern int warn_overloaded_virtual;
776
777/* Nonzero means warn when declaring a class that has a non virtual
778 destructor, when it really ought to have a virtual one. */
779
780extern int warn_nonvdtor;
781
782/* Nonzero means warn when the compiler will reorder code. */
783
784extern int warn_reorder;
785
786/* Nonzero means warn when synthesis behavior differs from Cfront's. */
787
788extern int warn_synth;
789
790/* Nonzero means warn when we convert a pointer to member function
791 into a pointer to (void or function). */
792
793extern int warn_pmf2ptr;
794
795/* Nonzero means warn about violation of some Effective C++ style rules. */
796
797extern int warn_ecpp;
798
799/* Nonzero means warn where overload resolution chooses a promotion from
800 unsigned to signed over a conversion to an unsigned of the same size. */
801
802extern int warn_sign_promo;
803
804/* Nonzero means warn when an old-style cast is used. */
805
806extern int warn_old_style_cast;
807
808/* Nonzero means warn when non-templatized friend functions are
809 declared within a template */
810
811extern int warn_nontemplate_friend;
812
813/* Nonzero means complain about deprecated features. */
814
815extern int warn_deprecated;
816
817/* Maximum template instantiation depth. This limit is rather
818 arbitrary, but it exists to limit the time it takes to notice
819 infinite template instantiations. */
820
821extern int max_tinst_depth;
822
823/* Nonzero means the expression being parsed will never be evaluated.
824 This is a count, since unevaluated expressions can nest. */
825
826extern int skip_evaluation;
827
828/* C types are partitioned into three subsets: object, function, and
829 incomplete types. */
830#define C_TYPE_OBJECT_P(type) \
--- 9 unchanged lines hidden (view full) ---
840 object or incomplete types. */
841#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
842 (!C_TYPE_FUNCTION_P (type))
843
844/* Record in each node resulting from a binary operator
845 what operator was specified for it. */
846#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
847
848/* Attribute table common to the C front ends. */
849extern const struct attribute_spec c_common_attribute_table[];
850extern const struct attribute_spec c_common_format_attribute_table[];
851
852/* Pointer to function to lazily generate the VAR_DECL for __FUNCTION__ etc.
853 ID is the identifier to use, NAME is the string.
854 TYPE_DEP indicates whether it depends on type of the function or not
855 (i.e. __PRETTY_FUNCTION__). */
856
857extern tree (*make_fname_decl) PARAMS ((tree, int));
858
859extern tree identifier_global_value PARAMS ((tree));
860extern void record_builtin_type PARAMS ((enum rid,
861 const char *, tree));
862extern tree build_void_list_node PARAMS ((void));
863extern void start_fname_decls PARAMS ((void));
864extern void finish_fname_decls PARAMS ((void));
865extern const char *fname_as_string PARAMS ((int));
866extern tree fname_decl PARAMS ((unsigned, tree));
867extern const char *fname_string PARAMS ((unsigned));
868
869extern void check_function_arguments PARAMS ((tree, tree));
870extern void check_function_arguments_recurse PARAMS ((void (*) (void *,
871 tree,
872 unsigned HOST_WIDE_INT),
873 void *, tree,
874 unsigned HOST_WIDE_INT));
875extern void check_function_format PARAMS ((int *, tree, tree));
876extern void set_Wformat PARAMS ((int));
877extern tree handle_format_attribute PARAMS ((tree *, tree, tree,
878 int, bool *));
879extern tree handle_format_arg_attribute PARAMS ((tree *, tree, tree,
880 int, bool *));
881extern void c_common_insert_default_attributes PARAMS ((tree));
882extern int c_common_decode_option PARAMS ((int, char **));
883extern tree c_common_type_for_mode PARAMS ((enum machine_mode,
884 int));
885extern tree c_common_type_for_size PARAMS ((unsigned int, int));
886extern tree c_common_unsigned_type PARAMS ((tree));
887extern tree c_common_signed_type PARAMS ((tree));
888extern tree c_common_signed_or_unsigned_type PARAMS ((int, tree));
889extern tree c_common_truthvalue_conversion PARAMS ((tree));
890extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
891extern tree c_sizeof_or_alignof_type PARAMS ((tree, enum tree_code, int));
892extern tree c_alignof_expr PARAMS ((tree));
893/* Print an error message for invalid operands to arith operation CODE.
894 NOP_EXPR is used as a special case (see truthvalue_conversion). */
895extern void binary_op_error PARAMS ((enum tree_code));
896#define my_friendly_assert(EXP, N) (void) \
897 (((EXP) == 0) ? (fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0) : 0)
898
899extern tree c_expand_expr_stmt PARAMS ((tree));
900extern void c_expand_start_cond PARAMS ((tree, int, tree));
901extern void c_finish_then PARAMS ((void));
902extern void c_expand_start_else PARAMS ((void));
903extern void c_finish_else PARAMS ((void));
904extern void c_expand_end_cond PARAMS ((void));
905/* Validate the expression after `case' and apply default promotions. */
906extern tree check_case_value PARAMS ((tree));
907extern tree fix_string_type PARAMS ((tree));
908struct varray_head_tag;
909extern tree combine_strings PARAMS ((struct varray_head_tag *));
910extern void constant_expression_warning PARAMS ((tree));
911extern tree convert_and_check PARAMS ((tree, tree));
912extern void overflow_warning PARAMS ((tree));
913extern void unsigned_conversion_warning PARAMS ((tree, tree));
914
915/* Read the rest of the current #-directive line. */
916extern char *get_directive_line PARAMS ((void));
917#define GET_DIRECTIVE_LINE() get_directive_line ()
918#define c_sizeof(T) c_sizeof_or_alignof_type (T, SIZEOF_EXPR, 1)
919#define c_alignof(T) c_sizeof_or_alignof_type (T, ALIGNOF_EXPR, 1)
920
921/* Subroutine of build_binary_op, used for comparison operations.
922 See if the operands have both been converted from subword integer types
923 and, if so, perhaps change them both back to their original type. */
924extern tree shorten_compare PARAMS ((tree *, tree *, tree *, enum tree_code *));
925
926extern tree pointer_int_sum PARAMS ((enum tree_code, tree, tree));
927extern unsigned int min_precision PARAMS ((tree, int));
--- 5 unchanged lines hidden (view full) ---
933 frontends. */
934extern void c_common_nodes_and_builtins PARAMS ((void));
935
936extern void disable_builtin_function PARAMS ((const char *));
937
938extern tree build_va_arg PARAMS ((tree, tree));
939
940extern void c_common_init_options PARAMS ((enum c_language_kind));
941extern bool c_common_post_options PARAMS ((void));
942extern const char *c_common_init PARAMS ((const char *));
943extern void c_common_finish PARAMS ((void));
944extern void c_common_parse_file PARAMS ((int));
945extern HOST_WIDE_INT c_common_get_alias_set PARAMS ((tree));
946extern bool c_promoting_integer_type_p PARAMS ((tree));
947extern int self_promoting_args_p PARAMS ((tree));
948extern tree strip_array_types PARAMS ((tree));
949
950/* These macros provide convenient access to the various _STMT nodes. */
951
952/* Nonzero if this statement should be considered a full-expression,
953 i.e., if temporaries created during this statement should have
954 their destructors run at the end of this statement. (In C, this
955 will always be false, since there are no destructors.) */
--- 14 unchanged lines hidden (view full) ---
970/* DO_STMT accessors. These give access to the condition of the do
971 statement and the body of the do statement, respectively. */
972#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
973#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
974
975/* RETURN_STMT accessors. These give the expression associated with a
976 return statement, and whether it should be ignored when expanding
977 (as opposed to inlining). */
978#define RETURN_STMT_EXPR(NODE) TREE_OPERAND (RETURN_STMT_CHECK (NODE), 0)
979
980/* EXPR_STMT accessor. This gives the expression associated with an
981 expression statement. */
982#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
983
984/* FOR_STMT accessors. These give access to the init statement,
985 condition, update expression, and body of the for statement,
986 respectively. */
--- 113 unchanged lines hidden (view full) ---
1100 (IDENTIFIER_POINTER (FILE_STMT_FILENAME_NODE (NODE)))
1101
1102/* The line-number at which a statement began. But if
1103 STMT_LINENO_FOR_FN_P does holds, then this macro gives the
1104 line number for the end of the current function instead. */
1105#define STMT_LINENO(NODE) \
1106 (TREE_COMPLEXITY ((NODE)))
1107
1108/* If nonzero, the STMT_LINENO for NODE is the line at which the
1109 function ended. */
1110#define STMT_LINENO_FOR_FN_P(NODE) \
1111 (TREE_LANG_FLAG_2 ((NODE)))
1112
1113/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
1114 initialization variables. */
1115#define NEW_FOR_SCOPE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
1116
--- 6 unchanged lines hidden (view full) ---
1123enum c_tree_code {
1124 C_DUMMY_TREE_CODE = LAST_AND_UNUSED_TREE_CODE,
1125#include "c-common.def"
1126 LAST_C_TREE_CODE
1127};
1128
1129#undef DEFTREECODE
1130
1131extern void genrtl_do_pushlevel PARAMS ((void));
1132extern void genrtl_goto_stmt PARAMS ((tree));
1133extern void genrtl_expr_stmt PARAMS ((tree));
1134extern void genrtl_expr_stmt_value PARAMS ((tree, int, int));
1135extern void genrtl_decl_stmt PARAMS ((tree));
1136extern void genrtl_if_stmt PARAMS ((tree));
1137extern void genrtl_while_stmt PARAMS ((tree));
1138extern void genrtl_do_stmt PARAMS ((tree));
--- 69 unchanged lines hidden (view full) ---
1208/* Handle increment and decrement of boolean types. */
1209extern tree boolean_increment PARAMS ((enum tree_code,
1210 tree));
1211
1212/* Hook currently used only by the C++ front end to reset internal state
1213 after entering or leaving a header file. */
1214extern void extract_interface_info PARAMS ((void));
1215
1216extern int case_compare PARAMS ((splay_tree_key,
1217 splay_tree_key));
1218
1219extern tree c_add_case_label PARAMS ((splay_tree,
1220 tree, tree,
1221 tree));
1222
1223extern tree build_function_call PARAMS ((tree, tree));
1224
1225extern tree finish_label_address_expr PARAMS ((tree));
1226
1227/* Same function prototype, but the C and C++ front ends have
1228 different implementations. Used in c-common.c. */
1229extern tree lookup_label PARAMS ((tree));
1230
1231extern rtx c_expand_expr PARAMS ((tree, rtx,
1232 enum machine_mode,
1233 int));
1234
1235extern int c_safe_from_p PARAMS ((rtx, tree));
1236
1237extern int c_staticp PARAMS ((tree));
1238
1239extern int c_common_unsafe_for_reeval PARAMS ((tree));
1240
1241extern const char *init_c_lex PARAMS ((const char *));
1242
1243extern void cb_register_builtins PARAMS ((cpp_reader *));
1244
1245/* Information recorded about each file examined during compilation. */
1246
1247struct c_fileinfo
1248{
1249 int time; /* Time spent in the file. */
1250 short interface_only; /* Flags - used only by C++ */
1251 short interface_unknown;
1252};
1253
1254struct c_fileinfo *get_fileinfo PARAMS ((const char *));
1255extern void dump_time_statistics PARAMS ((void));
1256
1257extern int c_dump_tree PARAMS ((void *, tree));
1258
1259#endif /* ! GCC_C_COMMON_H */
2 Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
3 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
--- 5 unchanged lines hidden (view full) ---
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
21
22#ifndef GCC_C_COMMON_H
23#define GCC_C_COMMON_H
24
25#include "splay-tree.h"
26#include "cpplib.h"
27
28/* Usage of TREE_LANG_FLAG_?:
29 0: COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
--- 8 unchanged lines hidden (view full) ---
38 STMT_IS_FULL_EXPR_P (in _STMT)
39 2: STMT_LINENO_FOR_FN_P (in _STMT)
40 3: SCOPE_NO_CLEANUPS_P (in SCOPE_STMT)
41 COMPOUND_STMT_BODY_BLOCK (in COMPOUND_STMT)
42 4: SCOPE_PARTIAL_P (in SCOPE_STMT)
43*/
44
45/* Reserved identifiers. This is the union of all the keywords for C,
46 C++, and Objective-C. All the type modifiers have to be in one
47 block at the beginning, because they are used as mask bits. There
48 are 27 type modifiers; if we add many more we will have to redesign
49 the mask mechanism. */
50
51enum rid
52{
53 /* Modifiers: */
54 /* C, in empirical order of frequency. */
55 RID_STATIC = 0,
56 RID_UNSIGNED, RID_LONG, RID_CONST, RID_EXTERN,
57 RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
58 RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
59
60 /* C extensions */
61 RID_BOUNDED, RID_UNBOUNDED, RID_COMPLEX, RID_THREAD,
62
63 /* C++ */
64 RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
65
66 /* ObjC */
67 RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
68
69 /* C */
--- 18 unchanged lines hidden (view full) ---
88 RID_DELETE, RID_FALSE, RID_NAMESPACE,
89 RID_NEW, RID_OPERATOR, RID_THIS,
90 RID_THROW, RID_TRUE, RID_TRY,
91 RID_TYPENAME, RID_TYPEID, RID_USING,
92
93 /* casts */
94 RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
95
96 /* Objective-C */
97 RID_ID, RID_AT_ENCODE, RID_AT_END,
98 RID_AT_CLASS, RID_AT_ALIAS, RID_AT_DEFS,
99 RID_AT_PRIVATE, RID_AT_PROTECTED, RID_AT_PUBLIC,
100 RID_AT_PROTOCOL, RID_AT_SELECTOR, RID_AT_INTERFACE,
101 RID_AT_IMPLEMENTATION,
102
103 RID_MAX,
104
--- 64 unchanged lines hidden (view full) ---
169
170 CTI_MAX
171};
172
173#define C_RID_CODE(id) (((struct c_common_identifier *) (id))->node.rid_code)
174
175/* Identifier part common to the C front ends. Inherits from
176 tree_identifier, despite appearances. */
177struct c_common_identifier GTY(())
178{
179 struct tree_common common;
180 struct cpp_hashnode GTY ((skip (""))) node;
181};
182
183#define wchar_type_node c_global_trees[CTI_WCHAR_TYPE]
184#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE]
185#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
186#define wint_type_node c_global_trees[CTI_WINT_TYPE]
187#define signed_size_type_node c_global_trees[CTI_SIGNED_SIZE_TYPE]
188#define unsigned_ptrdiff_type_node c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
--- 27 unchanged lines hidden (view full) ---
216#define function_name_decl_node c_global_trees[CTI_FUNCTION_NAME_DECL]
217#define pretty_function_name_decl_node c_global_trees[CTI_PRETTY_FUNCTION_NAME_DECL]
218#define c99_function_name_decl_node c_global_trees[CTI_C99_FUNCTION_NAME_DECL]
219#define saved_function_name_decls c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS]
220
221/* A node for `((void) 0)'. */
222#define void_zero_node c_global_trees[CTI_VOID_ZERO]
223
224extern GTY(()) tree c_global_trees[CTI_MAX];
225
226/* Mark which labels are explicitly declared.
227 These may be shadowed, and may be referenced from nested functions. */
228#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
229
230/* Flag strings given by __FUNCTION__ and __PRETTY_FUNCTION__ for a
231 warning if they undergo concatenation. */
232#define C_ARTIFICIAL_STRING_P(NODE) TREE_LANG_FLAG_0 (NODE)
233
234typedef enum c_language_kind
235{
236 clk_c = 0, /* A dialect of C: K&R C, ANSI/ISO C89, C2000, etc. */
237 clk_cplusplus /* ANSI/ISO C++ */
238}
239c_language_kind;
240
241/* Information about a statement tree. */
242
243struct stmt_tree_s GTY(()) {
244 /* The last statement added to the tree. */
245 tree x_last_stmt;
246 /* The type of the last expression statement. (This information is
247 needed to implement the statement-expression extension.) */
248 tree x_last_expr_type;
249 /* The last filename we recorded. */
250 const char *x_last_expr_filename;
251 /* In C++, Nonzero if we should treat statements as full
252 expressions. In particular, this variable is no-zero if at the
253 end of a statement we should destroy any temporaries created
254 during that statement. Similarly, if, at the end of a block, we
255 should destroy any local variables in this block. Normally, this
256 variable is nonzero, since those are the normal semantics of
257 C++.
258
259 However, in order to represent aggregate initialization code as
260 tree structure, we use statement-expressions. The statements
261 within the statement expression should not result in cleanups
262 being run until the entire enclosing statement is complete.
263
264 This flag has no effect in C. */
265 int stmts_are_full_exprs_p;
266};
267
268typedef struct stmt_tree_s *stmt_tree;
269
270/* Global state pertinent to the current function. Some C dialects
271 extend this structure with additional fields. */
272
273struct c_language_function GTY(()) {
274 /* While we are parsing the function, this contains information
275 about the statement-tree that we are building. */
276 struct stmt_tree_s x_stmt_tree;
277 /* The stack of SCOPE_STMTs for the current function. */
278 tree x_scope_stmt_stack;
279};
280
281/* When building a statement-tree, this is the last statement added to
--- 22 unchanged lines hidden (view full) ---
304 } while (0)
305
306/* Language-specific hooks. */
307
308extern int (*lang_statement_code_p) PARAMS ((enum tree_code));
309extern void (*lang_expand_stmt) PARAMS ((tree));
310extern void (*lang_expand_decl_stmt) PARAMS ((tree));
311extern void (*lang_expand_function_end) PARAMS ((void));
312extern tree gettags PARAMS ((void));
313
314/* Callback that determines if it's ok for a function to have no
315 noreturn attribute. */
316extern int (*lang_missing_noreturn_ok_p) PARAMS ((tree));
317
318extern int yyparse PARAMS ((void));
319extern void free_parser_stacks PARAMS ((void));
320
321extern stmt_tree current_stmt_tree PARAMS ((void));
322extern tree *current_scope_stmt_stack PARAMS ((void));
323extern void begin_stmt_tree PARAMS ((tree *));
324extern tree add_stmt PARAMS ((tree));
325extern void add_decl_stmt PARAMS ((tree));
326extern tree add_scope_stmt PARAMS ((int, int));
327extern void finish_stmt_tree PARAMS ((tree *));
328
329extern int statement_code_p PARAMS ((enum tree_code));
330extern tree walk_stmt_tree PARAMS ((tree *,
331 walk_tree_fn,
332 void *));
333extern void prep_stmt PARAMS ((tree));
334extern void expand_stmt PARAMS ((tree));
335extern void shadow_warning PARAMS ((const char *,
336 tree, tree));
337extern tree c_begin_if_stmt PARAMS ((void));
338extern tree c_begin_while_stmt PARAMS ((void));
339extern void c_finish_while_stmt_cond PARAMS ((tree, tree));
340
341
342/* Extra information associated with a DECL. Other C dialects extend
343 this structure in various ways. The C front-end only uses this
344 structure for FUNCTION_DECLs; all other DECLs have a NULL
345 DECL_LANG_SPECIFIC field. */
346
347struct c_lang_decl GTY(()) {
348 unsigned declared_inline : 1;
349};
350
351/* In a FUNCTION_DECL for which DECL_BUILT_IN does not hold, this is
352 the approximate number of statements in this function. There is
353 no need for this number to be exact; it is only used in various
354 heuristics regarding optimization. */
355#define DECL_NUM_STMTS(NODE) \
356 (FUNCTION_DECL_CHECK (NODE)->decl.u1.i)
357
358/* The variant of the C language being processed. Each C language
359 front-end defines this variable. */
360
361extern c_language_kind c_language;
362
363/* Switches common to the C front ends. */
364
365/* Nonzero if prepreprocessing only. */
366extern int flag_preprocess_only;
367
368/* Nonzero if an ISO standard was selected. It rejects macros in the
369 user's namespace. */
370extern int flag_iso;
371
372/* Nonzero whenever Objective-C functionality is being used. */
373extern int flag_objc;
374
375/* Nonzero if -undef was given. It suppresses target built-in macros
376 and assertions. */
377extern int flag_undef;
378
379/* Nonzero means don't recognize the non-ANSI builtin functions. */
380
381extern int flag_no_builtin;
382
383/* Nonzero means don't recognize the non-ANSI builtin functions.
384 -ansi sets this. */
385
386extern int flag_no_nonansi_builtin;
387
388/* Nonzero means give `double' the same size as `float'. */
389
390extern int flag_short_double;
391
392/* Nonzero means give `wchar_t' the same size as `short'. */
393
394extern int flag_short_wchar;
395
396/* Nonzero means allow Microsoft extensions without warnings or errors. */
397extern int flag_ms_extensions;
398
399/* Nonzero means don't recognize the keyword `asm'. */
400
401extern int flag_no_asm;
402
403/* Nonzero means give string constants the type `const char *', as mandated
404 by the standard. */
405
406extern int flag_const_strings;
407
408/* Nonzero means `$' can be in an identifier. */
409
410extern int dollars_in_ident;
411
412/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
413
414extern int flag_signed_bitfields;
415extern int explicit_flag_signed_bitfields;
416
417/* Nonzero means warn about pointer casts that can drop a type qualifier
418 from the pointer target type. */
419
420extern int warn_cast_qual;
421
422/* Warn about functions which might be candidates for format attributes. */
423
424extern int warn_missing_format_attribute;
425
426/* Nonzero means do not warn that K&R style main() is not a function prototype. */
427extern int flag_bsd_no_warn_kr_main;
428
429/* Nonzero means warn about sizeof(function) or addition/subtraction
430 of function pointers. */
431
432extern int warn_pointer_arith;
433
434/* Nonzero means warn for any global function def
435 without separate previous prototype decl. */
436
437extern int warn_missing_prototypes;
438
439/* Warn if adding () is suggested. */
440
441extern int warn_parentheses;
442
443/* Warn if initializer is not completely bracketed. */
444
445extern int warn_missing_braces;
446
447/* Warn about comparison of signed and unsigned values.
448 If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */
449
450extern int warn_sign_compare;
451
452/* Nonzero means warn about usage of long long when `-pedantic'. */
453
454extern int warn_long_long;
455
456/* Nonzero means warn about deprecated conversion from string constant to
457 `char *'. */
458
459extern int warn_write_strings;
460
461/* Nonzero means warn about multiple (redundant) decls for the same single
462 variable or function. */
463
464extern int warn_redundant_decls;
465
466/* Warn about testing equality of floating point numbers. */
467
468extern int warn_float_equal;
469
470/* Warn about a subscript that has type char. */
471
472extern int warn_char_subscripts;
473
474/* Warn if a type conversion is done that might have confusing results. */
475
476extern int warn_conversion;
477
478/* Warn about #pragma directives that are not recognized. */
479
480extern int warn_unknown_pragmas; /* Tri state variable. */
481
482/* Warn about format/argument anomalies in calls to formatted I/O functions
483 (*printf, *scanf, strftime, strfmon, etc.). */
484
485extern int warn_format;
486
487/* Warn about Y2K problems with strftime formats. */
488
489extern int warn_format_y2k;
490
491/* Warn about excess arguments to formats. */
492
493extern int warn_format_extra_args;
494
495/* Warn about zero-length formats. */
496
497extern int warn_format_zero_length;
498
499/* Warn about non-literal format arguments. */
500
501extern int warn_format_nonliteral;
502
503/* Warn about possible security problems with calls to format functions. */
504
505extern int warn_format_security;
506
507
508/* C/ObjC language option variables. */
509
510
511/* Nonzero means message about use of implicit function declarations;
512 1 means warning; 2 means error. */
513
514extern int mesg_implicit_function_declaration;
515
516/* Nonzero means allow type mismatches in conditional expressions;
517 just make their values `void'. */
518
519extern int flag_cond_mismatch;
520
521/* Nonzero means enable C89 Amendment 1 features. */
522
523extern int flag_isoc94;
524
525/* Nonzero means use the ISO C99 dialect of C. */
526
527extern int flag_isoc99;
528
529/* Nonzero means allow the BSD kernel printf enhancments. */
530
531extern int flag_bsd_format;
532
533/* Nonzero means that we have builtin functions, and main is an int */
534
535extern int flag_hosted;
536
537/* Nonzero means add default format_arg attributes for functions not
538 in ISO C. */
539
540extern int flag_noniso_default_format_attributes;
541
542/* Nonzero means warn when casting a function call to a type that does
543 not match the return type (e.g. (float)sqrt() or (anything*)malloc()
544 when there is no previous declaration of sqrt or malloc. */
545
546extern int warn_bad_function_cast;
547
548/* Warn about traditional constructs whose meanings changed in ANSI C. */
549
550extern int warn_traditional;
551
552/* Nonzero means warn for non-prototype function decls
553 or non-prototyped defs without previous prototype. */
554
555extern int warn_strict_prototypes;
556
557/* Nonzero means warn for any global function def
558 without separate previous decl. */
559
560extern int warn_missing_declarations;
561
562/* Nonzero means warn about extern declarations of objects not at
563 file-scope level and about *all* declarations of functions (whether
564 extern or static) not at file-scope level. Note that we exclude
565 implicit function declarations. To get warnings about those, use
566 -Wimplicit. */
567
568extern int warn_nested_externs;
569
570/* Warn if main is suspicious. */
571
572extern int warn_main;
573
574/* Nonzero means warn about possible violations of sequence point rules. */
575
576extern int warn_sequence_point;
577
578/* Nonzero means to warn about compile-time division by zero. */
579extern int warn_div_by_zero;
580
581/* Nonzero means warn about use of implicit int. */
582
583extern int warn_implicit_int;
584
585/* Warn about NULL being passed to argument slots marked as requiring
586 non-NULL. */
587
588extern int warn_nonnull;
589
590
591/* ObjC language option variables. */
592
593
594/* Open and close the file for outputting class declarations, if
595 requested (ObjC). */
596
597extern int flag_gen_declaration;
598
599/* Generate code for GNU or NeXT runtime environment. */
600
601extern int flag_next_runtime;
602
603/* Tells the compiler that this is a special run. Do not perform any
604 compiling, instead we are to test some platform dependent features
605 and output a C header file with appropriate definitions. */
606
607extern int print_struct_values;
608
609/* ???. Undocumented. */
610
611extern const char *constant_string_class_name;
612
613/* Warn if multiple methods are seen for the same selector, but with
614 different argument types. Performs the check on the whole selector
615 table at the end of compilation. */
616
617extern int warn_selector;
618
619/* Warn if a @selector() is found, and no method with that selector
620 has been previously declared. The check is done on each
621 @selector() as soon as it is found - so it warns about forward
622 declarations. */
623
624extern int warn_undeclared_selector;
625
626/* Warn if methods required by a protocol are not implemented in the
627 class adopting it. When turned off, methods inherited to that
628 class are also considered implemented. */
629
630extern int warn_protocol;
631
632
633/* C++ language option variables. */
634
635
636/* Nonzero means don't recognize any extension keywords. */
637
638extern int flag_no_gnu_keywords;
639
640/* Nonzero means do emit exported implementations of functions even if
641 they can be inlined. */
642
643extern int flag_implement_inlines;
644
645/* Nonzero means do emit exported implementations of templates, instead of
646 multiple static copies in each file that needs a definition. */
647
648extern int flag_external_templates;
649
650/* Nonzero means that the decision to emit or not emit the implementation of a
651 template depends on where the template is instantiated, rather than where
652 it is defined. */
653
654extern int flag_alt_external_templates;
655
656/* Nonzero means that implicit instantiations will be emitted if needed. */
657
658extern int flag_implicit_templates;
659
660/* Nonzero means that implicit instantiations of inline templates will be
661 emitted if needed, even if instantiations of non-inline templates
662 aren't. */
663
664extern int flag_implicit_inline_templates;
665
666/* Nonzero means generate separate instantiation control files and
667 juggle them at link time. */
668
669extern int flag_use_repository;
670
671/* Nonzero if we want to issue diagnostics that the standard says are not
672 required. */
673
674extern int flag_optional_diags;
675
676/* Nonzero means we should attempt to elide constructors when possible. */
677
678extern int flag_elide_constructors;
679
680/* Nonzero means that member functions defined in class scope are
681 inline by default. */
682
683extern int flag_default_inline;
684
685/* Controls whether compiler generates 'type descriptor' that give
686 run-time type information. */
687
688extern int flag_rtti;
689
690/* Nonzero if we want to conserve space in the .o files. We do this
691 by putting uninitialized data and runtime initialized data into
692 .common instead of .data at the expense of not flagging multiple
693 definitions. */
694
695extern int flag_conserve_space;
696
697/* Nonzero if we want to obey access control semantics. */
698
699extern int flag_access_control;
700
701/* Nonzero if we want to check the return value of new and avoid calling
702 constructors if it is a null pointer. */
703
704extern int flag_check_new;
705
706/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
707 initialization variables.
708 0: Old rules, set by -fno-for-scope.
709 2: New ISO rules, set by -ffor-scope.
710 1: Try to implement new ISO rules, but with backup compatibility
711 (and warnings). This is the default, for now. */
712
713extern int flag_new_for_scope;
714
715/* Nonzero if we want to emit defined symbols with common-like linkage as
716 weak symbols where possible, in order to conform to C++ semantics.
717 Otherwise, emit them as local symbols. */
718
719extern int flag_weak;
720
721/* Nonzero to use __cxa_atexit, rather than atexit, to register
722 destructors for local statics and global objects. */
723
724extern int flag_use_cxa_atexit;
725
726/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
727
728extern int flag_vtable_gc;
729
730/* Nonzero means make the default pedwarns warnings instead of errors.
731 The value of this flag is ignored if -pedantic is specified. */
732
733extern int flag_permissive;
734
735/* Nonzero means to implement standard semantics for exception
736 specifications, calling unexpected if an exception is thrown that
737 doesn't match the specification. Zero means to treat them as
738 assertions and optimize accordingly, but not check them. */
739
740extern int flag_enforce_eh_specs;
741
742/* The version of the C++ ABI in use. The following values are
743 allowed:
744
745 0: The version of the ABI believed most conformant with the
746 C++ ABI specification. This ABI may change as bugs are
747 discovered and fixed. Therefore, 0 will not necessarily
748 indicate the same ABI in different versions of G++.
749
750 1: The version of the ABI first used in G++ 3.2.
751
752 Additional positive integers will be assigned as new versions of
753 the ABI become the default version of the ABI. */
754
755extern int flag_abi_version;
756
757/* Nonzero means warn about things that will change when compiling
758 with an ABI-compliant compiler. */
759
760extern int warn_abi;
761
762/* Nonzero means warn about implicit declarations. */
763
764extern int warn_implicit;
765
766/* Nonzero means warn when all ctors or dtors are private, and the class
767 has no friends. */
768
769extern int warn_ctor_dtor_privacy;
770
771/* Nonzero means warn in function declared in derived class has the
772 same name as a virtual in the base class, but fails to match the
773 type signature of any virtual function in the base class. */
774
775extern int warn_overloaded_virtual;
776
777/* Nonzero means warn when declaring a class that has a non virtual
778 destructor, when it really ought to have a virtual one. */
779
780extern int warn_nonvdtor;
781
782/* Nonzero means warn when the compiler will reorder code. */
783
784extern int warn_reorder;
785
786/* Nonzero means warn when synthesis behavior differs from Cfront's. */
787
788extern int warn_synth;
789
790/* Nonzero means warn when we convert a pointer to member function
791 into a pointer to (void or function). */
792
793extern int warn_pmf2ptr;
794
795/* Nonzero means warn about violation of some Effective C++ style rules. */
796
797extern int warn_ecpp;
798
799/* Nonzero means warn where overload resolution chooses a promotion from
800 unsigned to signed over a conversion to an unsigned of the same size. */
801
802extern int warn_sign_promo;
803
804/* Nonzero means warn when an old-style cast is used. */
805
806extern int warn_old_style_cast;
807
808/* Nonzero means warn when non-templatized friend functions are
809 declared within a template */
810
811extern int warn_nontemplate_friend;
812
813/* Nonzero means complain about deprecated features. */
814
815extern int warn_deprecated;
816
817/* Maximum template instantiation depth. This limit is rather
818 arbitrary, but it exists to limit the time it takes to notice
819 infinite template instantiations. */
820
821extern int max_tinst_depth;
822
823/* Nonzero means the expression being parsed will never be evaluated.
824 This is a count, since unevaluated expressions can nest. */
825
826extern int skip_evaluation;
827
828/* C types are partitioned into three subsets: object, function, and
829 incomplete types. */
830#define C_TYPE_OBJECT_P(type) \
--- 9 unchanged lines hidden (view full) ---
840 object or incomplete types. */
841#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
842 (!C_TYPE_FUNCTION_P (type))
843
844/* Record in each node resulting from a binary operator
845 what operator was specified for it. */
846#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
847
848/* Attribute table common to the C front ends. */
849extern const struct attribute_spec c_common_attribute_table[];
850extern const struct attribute_spec c_common_format_attribute_table[];
851
852/* Pointer to function to lazily generate the VAR_DECL for __FUNCTION__ etc.
853 ID is the identifier to use, NAME is the string.
854 TYPE_DEP indicates whether it depends on type of the function or not
855 (i.e. __PRETTY_FUNCTION__). */
856
857extern tree (*make_fname_decl) PARAMS ((tree, int));
858
859extern tree identifier_global_value PARAMS ((tree));
860extern void record_builtin_type PARAMS ((enum rid,
861 const char *, tree));
862extern tree build_void_list_node PARAMS ((void));
863extern void start_fname_decls PARAMS ((void));
864extern void finish_fname_decls PARAMS ((void));
865extern const char *fname_as_string PARAMS ((int));
866extern tree fname_decl PARAMS ((unsigned, tree));
867extern const char *fname_string PARAMS ((unsigned));
868
869extern void check_function_arguments PARAMS ((tree, tree));
870extern void check_function_arguments_recurse PARAMS ((void (*) (void *,
871 tree,
872 unsigned HOST_WIDE_INT),
873 void *, tree,
874 unsigned HOST_WIDE_INT));
875extern void check_function_format PARAMS ((int *, tree, tree));
876extern void set_Wformat PARAMS ((int));
877extern tree handle_format_attribute PARAMS ((tree *, tree, tree,
878 int, bool *));
879extern tree handle_format_arg_attribute PARAMS ((tree *, tree, tree,
880 int, bool *));
881extern void c_common_insert_default_attributes PARAMS ((tree));
882extern int c_common_decode_option PARAMS ((int, char **));
883extern tree c_common_type_for_mode PARAMS ((enum machine_mode,
884 int));
885extern tree c_common_type_for_size PARAMS ((unsigned int, int));
886extern tree c_common_unsigned_type PARAMS ((tree));
887extern tree c_common_signed_type PARAMS ((tree));
888extern tree c_common_signed_or_unsigned_type PARAMS ((int, tree));
889extern tree c_common_truthvalue_conversion PARAMS ((tree));
890extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
891extern tree c_sizeof_or_alignof_type PARAMS ((tree, enum tree_code, int));
892extern tree c_alignof_expr PARAMS ((tree));
893/* Print an error message for invalid operands to arith operation CODE.
894 NOP_EXPR is used as a special case (see truthvalue_conversion). */
895extern void binary_op_error PARAMS ((enum tree_code));
896#define my_friendly_assert(EXP, N) (void) \
897 (((EXP) == 0) ? (fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0) : 0)
898
899extern tree c_expand_expr_stmt PARAMS ((tree));
900extern void c_expand_start_cond PARAMS ((tree, int, tree));
901extern void c_finish_then PARAMS ((void));
902extern void c_expand_start_else PARAMS ((void));
903extern void c_finish_else PARAMS ((void));
904extern void c_expand_end_cond PARAMS ((void));
905/* Validate the expression after `case' and apply default promotions. */
906extern tree check_case_value PARAMS ((tree));
907extern tree fix_string_type PARAMS ((tree));
908struct varray_head_tag;
909extern tree combine_strings PARAMS ((struct varray_head_tag *));
910extern void constant_expression_warning PARAMS ((tree));
911extern tree convert_and_check PARAMS ((tree, tree));
912extern void overflow_warning PARAMS ((tree));
913extern void unsigned_conversion_warning PARAMS ((tree, tree));
914
915/* Read the rest of the current #-directive line. */
916extern char *get_directive_line PARAMS ((void));
917#define GET_DIRECTIVE_LINE() get_directive_line ()
918#define c_sizeof(T) c_sizeof_or_alignof_type (T, SIZEOF_EXPR, 1)
919#define c_alignof(T) c_sizeof_or_alignof_type (T, ALIGNOF_EXPR, 1)
920
921/* Subroutine of build_binary_op, used for comparison operations.
922 See if the operands have both been converted from subword integer types
923 and, if so, perhaps change them both back to their original type. */
924extern tree shorten_compare PARAMS ((tree *, tree *, tree *, enum tree_code *));
925
926extern tree pointer_int_sum PARAMS ((enum tree_code, tree, tree));
927extern unsigned int min_precision PARAMS ((tree, int));
--- 5 unchanged lines hidden (view full) ---
933 frontends. */
934extern void c_common_nodes_and_builtins PARAMS ((void));
935
936extern void disable_builtin_function PARAMS ((const char *));
937
938extern tree build_va_arg PARAMS ((tree, tree));
939
940extern void c_common_init_options PARAMS ((enum c_language_kind));
941extern bool c_common_post_options PARAMS ((void));
942extern const char *c_common_init PARAMS ((const char *));
943extern void c_common_finish PARAMS ((void));
944extern void c_common_parse_file PARAMS ((int));
945extern HOST_WIDE_INT c_common_get_alias_set PARAMS ((tree));
946extern bool c_promoting_integer_type_p PARAMS ((tree));
947extern int self_promoting_args_p PARAMS ((tree));
948extern tree strip_array_types PARAMS ((tree));
949
950/* These macros provide convenient access to the various _STMT nodes. */
951
952/* Nonzero if this statement should be considered a full-expression,
953 i.e., if temporaries created during this statement should have
954 their destructors run at the end of this statement. (In C, this
955 will always be false, since there are no destructors.) */
--- 14 unchanged lines hidden (view full) ---
970/* DO_STMT accessors. These give access to the condition of the do
971 statement and the body of the do statement, respectively. */
972#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
973#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
974
975/* RETURN_STMT accessors. These give the expression associated with a
976 return statement, and whether it should be ignored when expanding
977 (as opposed to inlining). */
978#define RETURN_STMT_EXPR(NODE) TREE_OPERAND (RETURN_STMT_CHECK (NODE), 0)
979
980/* EXPR_STMT accessor. This gives the expression associated with an
981 expression statement. */
982#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
983
984/* FOR_STMT accessors. These give access to the init statement,
985 condition, update expression, and body of the for statement,
986 respectively. */
--- 113 unchanged lines hidden (view full) ---
1100 (IDENTIFIER_POINTER (FILE_STMT_FILENAME_NODE (NODE)))
1101
1102/* The line-number at which a statement began. But if
1103 STMT_LINENO_FOR_FN_P does holds, then this macro gives the
1104 line number for the end of the current function instead. */
1105#define STMT_LINENO(NODE) \
1106 (TREE_COMPLEXITY ((NODE)))
1107
1108/* If nonzero, the STMT_LINENO for NODE is the line at which the
1109 function ended. */
1110#define STMT_LINENO_FOR_FN_P(NODE) \
1111 (TREE_LANG_FLAG_2 ((NODE)))
1112
1113/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
1114 initialization variables. */
1115#define NEW_FOR_SCOPE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
1116
--- 6 unchanged lines hidden (view full) ---
1123enum c_tree_code {
1124 C_DUMMY_TREE_CODE = LAST_AND_UNUSED_TREE_CODE,
1125#include "c-common.def"
1126 LAST_C_TREE_CODE
1127};
1128
1129#undef DEFTREECODE
1130
1131extern void genrtl_do_pushlevel PARAMS ((void));
1132extern void genrtl_goto_stmt PARAMS ((tree));
1133extern void genrtl_expr_stmt PARAMS ((tree));
1134extern void genrtl_expr_stmt_value PARAMS ((tree, int, int));
1135extern void genrtl_decl_stmt PARAMS ((tree));
1136extern void genrtl_if_stmt PARAMS ((tree));
1137extern void genrtl_while_stmt PARAMS ((tree));
1138extern void genrtl_do_stmt PARAMS ((tree));
--- 69 unchanged lines hidden (view full) ---
1208/* Handle increment and decrement of boolean types. */
1209extern tree boolean_increment PARAMS ((enum tree_code,
1210 tree));
1211
1212/* Hook currently used only by the C++ front end to reset internal state
1213 after entering or leaving a header file. */
1214extern void extract_interface_info PARAMS ((void));
1215
1216extern int case_compare PARAMS ((splay_tree_key,
1217 splay_tree_key));
1218
1219extern tree c_add_case_label PARAMS ((splay_tree,
1220 tree, tree,
1221 tree));
1222
1223extern tree build_function_call PARAMS ((tree, tree));
1224
1225extern tree finish_label_address_expr PARAMS ((tree));
1226
1227/* Same function prototype, but the C and C++ front ends have
1228 different implementations. Used in c-common.c. */
1229extern tree lookup_label PARAMS ((tree));
1230
1231extern rtx c_expand_expr PARAMS ((tree, rtx,
1232 enum machine_mode,
1233 int));
1234
1235extern int c_safe_from_p PARAMS ((rtx, tree));
1236
1237extern int c_staticp PARAMS ((tree));
1238
1239extern int c_common_unsafe_for_reeval PARAMS ((tree));
1240
1241extern const char *init_c_lex PARAMS ((const char *));
1242
1243extern void cb_register_builtins PARAMS ((cpp_reader *));
1244
1245/* Information recorded about each file examined during compilation. */
1246
1247struct c_fileinfo
1248{
1249 int time; /* Time spent in the file. */
1250 short interface_only; /* Flags - used only by C++ */
1251 short interface_unknown;
1252};
1253
1254struct c_fileinfo *get_fileinfo PARAMS ((const char *));
1255extern void dump_time_statistics PARAMS ((void));
1256
1257extern int c_dump_tree PARAMS ((void *, tree));
1258
1259#endif /* ! GCC_C_COMMON_H */