xref: /dflybsd-src/contrib/gcc-8.0/gcc/c-family/c-common.h (revision 95059079af47f9a66a175f374f2da1a5020e3255)
138fd1498Szrj /* Definitions for c-common.c.
238fd1498Szrj    Copyright (C) 1987-2018 Free Software Foundation, Inc.
338fd1498Szrj 
438fd1498Szrj This file is part of GCC.
538fd1498Szrj 
638fd1498Szrj GCC is free software; you can redistribute it and/or modify it under
738fd1498Szrj the terms of the GNU General Public License as published by the Free
838fd1498Szrj Software Foundation; either version 3, or (at your option) any later
938fd1498Szrj version.
1038fd1498Szrj 
1138fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1238fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or
1338fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1438fd1498Szrj for more details.
1538fd1498Szrj 
1638fd1498Szrj You should have received a copy of the GNU General Public License
1738fd1498Szrj along with GCC; see the file COPYING3.  If not see
1838fd1498Szrj <http://www.gnu.org/licenses/>.  */
1938fd1498Szrj 
2038fd1498Szrj #ifndef GCC_C_COMMON_H
2138fd1498Szrj #define GCC_C_COMMON_H
2238fd1498Szrj 
2338fd1498Szrj #include "splay-tree.h"
2438fd1498Szrj #include "cpplib.h"
2538fd1498Szrj #include "alias.h"
2638fd1498Szrj #include "tree.h"
2738fd1498Szrj #include "fold-const.h"
2838fd1498Szrj #include "wide-int-bitmask.h"
2938fd1498Szrj 
3038fd1498Szrj /* In order for the format checking to accept the C frontend
3138fd1498Szrj    diagnostic framework extensions, you must include this file before
3238fd1498Szrj    diagnostic-core.h, not after.  The C front end formats are a subset of those
3338fd1498Szrj    for C++, so they are the appropriate set to use in common code;
3438fd1498Szrj    cp-tree.h overrides this for C++.  */
3538fd1498Szrj #if defined(GCC_DIAGNOSTIC_CORE_H)
3638fd1498Szrj #error \
3738fd1498Szrj In order for the format checking to accept the C front end diagnostic \
3838fd1498Szrj framework extensions, you must include this file before diagnostic-core.h \
3938fd1498Szrj never after.
4038fd1498Szrj #endif
4138fd1498Szrj #ifndef GCC_DIAG_STYLE
4238fd1498Szrj #define GCC_DIAG_STYLE __gcc_cdiag__
4338fd1498Szrj #endif
4438fd1498Szrj #include "diagnostic-core.h"
4538fd1498Szrj 
4638fd1498Szrj /* Usage of TREE_LANG_FLAG_?:
4738fd1498Szrj    0: IDENTIFIER_MARKED (used by search routines).
4838fd1498Szrj       C_MAYBE_CONST_EXPR_INT_OPERANDS (in C_MAYBE_CONST_EXPR, for C)
4938fd1498Szrj    1: C_DECLARED_LABEL_FLAG (in LABEL_DECL)
5038fd1498Szrj       STATEMENT_LIST_STMT_EXPR (in STATEMENT_LIST)
5138fd1498Szrj       C_MAYBE_CONST_EXPR_NON_CONST (in C_MAYBE_CONST_EXPR, for C)
5238fd1498Szrj    2: unused
5338fd1498Szrj    3: STATEMENT_LIST_HAS_LABEL (in STATEMENT_LIST)
5438fd1498Szrj    4: unused
5538fd1498Szrj */
5638fd1498Szrj 
5738fd1498Szrj /* Reserved identifiers.  This is the union of all the keywords for C,
5838fd1498Szrj    C++, and Objective-C.  All the type modifiers have to be in one
5938fd1498Szrj    block at the beginning, because they are used as mask bits.  There
6038fd1498Szrj    are 28 type modifiers; if we add many more we will have to redesign
6138fd1498Szrj    the mask mechanism.  */
6238fd1498Szrj 
6338fd1498Szrj enum rid
6438fd1498Szrj {
6538fd1498Szrj   /* Modifiers: */
6638fd1498Szrj   /* C, in empirical order of frequency.  */
6738fd1498Szrj   RID_STATIC = 0,
6838fd1498Szrj   RID_UNSIGNED, RID_LONG,    RID_CONST, RID_EXTERN,
6938fd1498Szrj   RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
7038fd1498Szrj   RID_VOLATILE, RID_SIGNED,  RID_AUTO,  RID_RESTRICT,
7138fd1498Szrj   RID_NORETURN, RID_ATOMIC,
7238fd1498Szrj 
7338fd1498Szrj   /* C extensions */
7438fd1498Szrj   RID_COMPLEX, RID_THREAD, RID_SAT,
7538fd1498Szrj 
7638fd1498Szrj   /* C++ */
7738fd1498Szrj   RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
7838fd1498Szrj 
7938fd1498Szrj   /* ObjC ("PQ" reserved words - they do not appear after a '@' and
8038fd1498Szrj      are keywords only in specific contexts)  */
8138fd1498Szrj   RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
8238fd1498Szrj 
8338fd1498Szrj   /* ObjC ("PATTR" reserved words - they do not appear after a '@'
8438fd1498Szrj      and are keywords only as property attributes)  */
8538fd1498Szrj   RID_GETTER, RID_SETTER,
8638fd1498Szrj   RID_READONLY, RID_READWRITE,
8738fd1498Szrj   RID_ASSIGN, RID_RETAIN, RID_COPY,
8838fd1498Szrj   RID_NONATOMIC,
8938fd1498Szrj 
9038fd1498Szrj   /* C (reserved and imaginary types not implemented, so any use is a
9138fd1498Szrj      syntax error) */
9238fd1498Szrj   RID_IMAGINARY,
9338fd1498Szrj 
9438fd1498Szrj   /* C */
9538fd1498Szrj   RID_INT,     RID_CHAR,   RID_FLOAT,    RID_DOUBLE, RID_VOID,
9638fd1498Szrj   RID_ENUM,    RID_STRUCT, RID_UNION,    RID_IF,     RID_ELSE,
9738fd1498Szrj   RID_WHILE,   RID_DO,     RID_FOR,      RID_SWITCH, RID_CASE,
9838fd1498Szrj   RID_DEFAULT, RID_BREAK,  RID_CONTINUE, RID_RETURN, RID_GOTO,
9938fd1498Szrj   RID_SIZEOF,
10038fd1498Szrj 
10138fd1498Szrj   /* C extensions */
10238fd1498Szrj   RID_ASM,       RID_TYPEOF,   RID_ALIGNOF,  RID_ATTRIBUTE,  RID_VA_ARG,
10338fd1498Szrj   RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL,      RID_CHOOSE_EXPR,
10438fd1498Szrj   RID_TYPES_COMPATIBLE_P,      RID_BUILTIN_COMPLEX,	     RID_BUILTIN_SHUFFLE,
10538fd1498Szrj   RID_BUILTIN_TGMATH,
10638fd1498Szrj   RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
10738fd1498Szrj 
10838fd1498Szrj   /* TS 18661-3 keywords, in the same sequence as the TI_* values.  */
10938fd1498Szrj   RID_FLOAT16,
11038fd1498Szrj   RID_FLOATN_NX_FIRST = RID_FLOAT16,
11138fd1498Szrj   RID_FLOAT32,
11238fd1498Szrj   RID_FLOAT64,
11338fd1498Szrj   RID_FLOAT128,
11438fd1498Szrj   RID_FLOAT32X,
11538fd1498Szrj   RID_FLOAT64X,
11638fd1498Szrj   RID_FLOAT128X,
11738fd1498Szrj #define CASE_RID_FLOATN_NX						\
11838fd1498Szrj   case RID_FLOAT16: case RID_FLOAT32: case RID_FLOAT64: case RID_FLOAT128: \
11938fd1498Szrj   case RID_FLOAT32X: case RID_FLOAT64X: case RID_FLOAT128X
12038fd1498Szrj 
12138fd1498Szrj   RID_FRACT, RID_ACCUM, RID_AUTO_TYPE, RID_BUILTIN_CALL_WITH_STATIC_CHAIN,
12238fd1498Szrj 
12338fd1498Szrj   /* "__GIMPLE", for the GIMPLE-parsing extension to the C frontend. */
12438fd1498Szrj   RID_GIMPLE,
12538fd1498Szrj 
12638fd1498Szrj   /* "__PHI", for parsing PHI function in GIMPLE FE.  */
12738fd1498Szrj   RID_PHI,
12838fd1498Szrj 
12938fd1498Szrj   /* "__RTL", for the RTL-parsing extension to the C frontend.  */
13038fd1498Szrj   RID_RTL,
13138fd1498Szrj 
13238fd1498Szrj   /* C11 */
13338fd1498Szrj   RID_ALIGNAS, RID_GENERIC,
13438fd1498Szrj 
13538fd1498Szrj   /* This means to warn that this is a C++ keyword, and then treat it
13638fd1498Szrj      as a normal identifier.  */
13738fd1498Szrj   RID_CXX_COMPAT_WARN,
13838fd1498Szrj 
13938fd1498Szrj   /* GNU transactional memory extension */
14038fd1498Szrj   RID_TRANSACTION_ATOMIC, RID_TRANSACTION_RELAXED, RID_TRANSACTION_CANCEL,
14138fd1498Szrj 
14238fd1498Szrj   /* Too many ways of getting the name of a function as a string */
14338fd1498Szrj   RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME,
14438fd1498Szrj 
14538fd1498Szrj   /* C++ (some of these are keywords in Objective-C as well, but only
14638fd1498Szrj      if they appear after a '@') */
14738fd1498Szrj   RID_BOOL,     RID_WCHAR,    RID_CLASS,
14838fd1498Szrj   RID_PUBLIC,   RID_PRIVATE,  RID_PROTECTED,
14938fd1498Szrj   RID_TEMPLATE, RID_NULL,     RID_CATCH,
15038fd1498Szrj   RID_DELETE,   RID_FALSE,    RID_NAMESPACE,
15138fd1498Szrj   RID_NEW,      RID_OFFSETOF, RID_OPERATOR,
15238fd1498Szrj   RID_THIS,     RID_THROW,    RID_TRUE,
15338fd1498Szrj   RID_TRY,      RID_TYPENAME, RID_TYPEID,
15438fd1498Szrj   RID_USING,    RID_CHAR16,   RID_CHAR32,
15538fd1498Szrj 
15638fd1498Szrj   /* casts */
15738fd1498Szrj   RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
15838fd1498Szrj 
15938fd1498Szrj   /* C++ extensions */
16038fd1498Szrj   RID_ADDRESSOF,               RID_BASES,
16138fd1498Szrj   RID_BUILTIN_LAUNDER,         RID_DIRECT_BASES,
16238fd1498Szrj   RID_HAS_NOTHROW_ASSIGN,      RID_HAS_NOTHROW_CONSTRUCTOR,
16338fd1498Szrj   RID_HAS_NOTHROW_COPY,        RID_HAS_TRIVIAL_ASSIGN,
16438fd1498Szrj   RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY,
16538fd1498Szrj   RID_HAS_TRIVIAL_DESTRUCTOR,  RID_HAS_UNIQUE_OBJ_REPRESENTATIONS,
16638fd1498Szrj   RID_HAS_VIRTUAL_DESTRUCTOR,
16738fd1498Szrj   RID_IS_ABSTRACT,             RID_IS_AGGREGATE,
16838fd1498Szrj   RID_IS_BASE_OF,              RID_IS_CLASS,
16938fd1498Szrj   RID_IS_EMPTY,                RID_IS_ENUM,
17038fd1498Szrj   RID_IS_FINAL,                RID_IS_LITERAL_TYPE,
17138fd1498Szrj   RID_IS_POD,                  RID_IS_POLYMORPHIC,
17238fd1498Szrj   RID_IS_SAME_AS,
17338fd1498Szrj   RID_IS_STD_LAYOUT,           RID_IS_TRIVIAL,
17438fd1498Szrj   RID_IS_TRIVIALLY_ASSIGNABLE, RID_IS_TRIVIALLY_CONSTRUCTIBLE,
17538fd1498Szrj   RID_IS_TRIVIALLY_COPYABLE,
17638fd1498Szrj   RID_IS_UNION,                RID_UNDERLYING_TYPE,
17738fd1498Szrj   RID_IS_ASSIGNABLE,           RID_IS_CONSTRUCTIBLE,
17838fd1498Szrj 
17938fd1498Szrj   /* C++11 */
18038fd1498Szrj   RID_CONSTEXPR, RID_DECLTYPE, RID_NOEXCEPT, RID_NULLPTR, RID_STATIC_ASSERT,
18138fd1498Szrj 
18238fd1498Szrj   /* C++ concepts */
18338fd1498Szrj   RID_CONCEPT, RID_REQUIRES,
18438fd1498Szrj 
18538fd1498Szrj   /* C++ transactional memory.  */
18638fd1498Szrj   RID_ATOMIC_NOEXCEPT, RID_ATOMIC_CANCEL, RID_SYNCHRONIZED,
18738fd1498Szrj 
18838fd1498Szrj   /* Objective-C ("AT" reserved words - they are only keywords when
18938fd1498Szrj      they follow '@')  */
19038fd1498Szrj   RID_AT_ENCODE,   RID_AT_END,
19138fd1498Szrj   RID_AT_CLASS,    RID_AT_ALIAS,     RID_AT_DEFS,
19238fd1498Szrj   RID_AT_PRIVATE,  RID_AT_PROTECTED, RID_AT_PUBLIC,  RID_AT_PACKAGE,
19338fd1498Szrj   RID_AT_PROTOCOL, RID_AT_SELECTOR,
19438fd1498Szrj   RID_AT_THROW,	   RID_AT_TRY,       RID_AT_CATCH,
19538fd1498Szrj   RID_AT_FINALLY,  RID_AT_SYNCHRONIZED,
19638fd1498Szrj   RID_AT_OPTIONAL, RID_AT_REQUIRED, RID_AT_PROPERTY,
19738fd1498Szrj   RID_AT_SYNTHESIZE, RID_AT_DYNAMIC,
19838fd1498Szrj   RID_AT_INTERFACE,
19938fd1498Szrj   RID_AT_IMPLEMENTATION,
20038fd1498Szrj 
20138fd1498Szrj   /* Named address support, mapping the keyword to a particular named address
20238fd1498Szrj      number.  Named address space 0 is reserved for the generic address.  If
20338fd1498Szrj      there are more than 254 named addresses, the addr_space_t type will need
20438fd1498Szrj      to be grown from an unsigned char to unsigned short.  */
20538fd1498Szrj   RID_ADDR_SPACE_0,		/* generic address */
20638fd1498Szrj   RID_ADDR_SPACE_1,
20738fd1498Szrj   RID_ADDR_SPACE_2,
20838fd1498Szrj   RID_ADDR_SPACE_3,
20938fd1498Szrj   RID_ADDR_SPACE_4,
21038fd1498Szrj   RID_ADDR_SPACE_5,
21138fd1498Szrj   RID_ADDR_SPACE_6,
21238fd1498Szrj   RID_ADDR_SPACE_7,
21338fd1498Szrj   RID_ADDR_SPACE_8,
21438fd1498Szrj   RID_ADDR_SPACE_9,
21538fd1498Szrj   RID_ADDR_SPACE_10,
21638fd1498Szrj   RID_ADDR_SPACE_11,
21738fd1498Szrj   RID_ADDR_SPACE_12,
21838fd1498Szrj   RID_ADDR_SPACE_13,
21938fd1498Szrj   RID_ADDR_SPACE_14,
22038fd1498Szrj   RID_ADDR_SPACE_15,
22138fd1498Szrj 
22238fd1498Szrj   RID_FIRST_ADDR_SPACE = RID_ADDR_SPACE_0,
22338fd1498Szrj   RID_LAST_ADDR_SPACE = RID_ADDR_SPACE_15,
22438fd1498Szrj 
22538fd1498Szrj   /* __intN keywords.  The _N_M here doesn't correspond to the intN
22638fd1498Szrj      in the keyword; use the bitsize in int_n_t_data_t[M] for that.
22738fd1498Szrj      For example, if int_n_t_data_t[0].bitsize is 13, then RID_INT_N_0
22838fd1498Szrj      is for __int13.  */
22938fd1498Szrj 
23038fd1498Szrj   /* Note that the range to use is RID_FIRST_INT_N through
23138fd1498Szrj      RID_FIRST_INT_N + NUM_INT_N_ENTS - 1 and c-parser.c has a list of
23238fd1498Szrj      all RID_INT_N_* in a case statement.  */
23338fd1498Szrj 
23438fd1498Szrj   RID_INT_N_0,
23538fd1498Szrj   RID_INT_N_1,
23638fd1498Szrj   RID_INT_N_2,
23738fd1498Szrj   RID_INT_N_3,
23838fd1498Szrj 
23938fd1498Szrj   RID_FIRST_INT_N = RID_INT_N_0,
24038fd1498Szrj   RID_LAST_INT_N = RID_INT_N_3,
24138fd1498Szrj 
24238fd1498Szrj   RID_MAX,
24338fd1498Szrj 
24438fd1498Szrj   RID_FIRST_MODIFIER = RID_STATIC,
24538fd1498Szrj   RID_LAST_MODIFIER = RID_ONEWAY,
24638fd1498Szrj 
24738fd1498Szrj   RID_FIRST_CXX11 = RID_CONSTEXPR,
24838fd1498Szrj   RID_LAST_CXX11 = RID_STATIC_ASSERT,
24938fd1498Szrj   RID_FIRST_AT = RID_AT_ENCODE,
25038fd1498Szrj   RID_LAST_AT = RID_AT_IMPLEMENTATION,
25138fd1498Szrj   RID_FIRST_PQ = RID_IN,
25238fd1498Szrj   RID_LAST_PQ = RID_ONEWAY,
25338fd1498Szrj   RID_FIRST_PATTR = RID_GETTER,
25438fd1498Szrj   RID_LAST_PATTR = RID_NONATOMIC
25538fd1498Szrj };
25638fd1498Szrj 
25738fd1498Szrj #define OBJC_IS_AT_KEYWORD(rid) \
25838fd1498Szrj   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_AT && \
25938fd1498Szrj    (unsigned int) (rid) <= (unsigned int) RID_LAST_AT)
26038fd1498Szrj 
26138fd1498Szrj #define OBJC_IS_PQ_KEYWORD(rid) \
26238fd1498Szrj   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PQ && \
26338fd1498Szrj    (unsigned int) (rid) <= (unsigned int) RID_LAST_PQ)
26438fd1498Szrj 
26538fd1498Szrj #define OBJC_IS_PATTR_KEYWORD(rid) \
26638fd1498Szrj   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PATTR && \
26738fd1498Szrj    (unsigned int) (rid) <= (unsigned int) RID_LAST_PATTR)
26838fd1498Szrj 
26938fd1498Szrj /* OBJC_IS_CXX_KEYWORD recognizes the 'CXX_OBJC' keywords (such as
27038fd1498Szrj    'class') which are shared in a subtle way between Objective-C and
27138fd1498Szrj    C++.  When the lexer is lexing in Objective-C/Objective-C++, if it
27238fd1498Szrj    finds '@' followed by one of these identifiers (eg, '@class'), it
27338fd1498Szrj    recognizes the whole as an Objective-C keyword.  If the identifier
27438fd1498Szrj    is found elsewhere, it follows the rules of the C/C++ language.
27538fd1498Szrj  */
27638fd1498Szrj #define OBJC_IS_CXX_KEYWORD(rid) \
27738fd1498Szrj   (rid == RID_CLASS || rid == RID_SYNCHRONIZED			\
27838fd1498Szrj    || rid == RID_PUBLIC || rid == RID_PROTECTED || rid == RID_PRIVATE	\
27938fd1498Szrj    || rid == RID_TRY || rid == RID_THROW || rid == RID_CATCH)
28038fd1498Szrj 
28138fd1498Szrj /* The elements of `ridpointers' are identifier nodes for the reserved
28238fd1498Szrj    type names and storage classes.  It is indexed by a RID_... value.  */
28338fd1498Szrj extern GTY ((length ("(int) RID_MAX"))) tree *ridpointers;
28438fd1498Szrj 
28538fd1498Szrj /* Standard named or nameless data types of the C compiler.  */
28638fd1498Szrj 
28738fd1498Szrj enum c_tree_index
28838fd1498Szrj {
28938fd1498Szrj     CTI_CHAR16_TYPE,
29038fd1498Szrj     CTI_CHAR32_TYPE,
29138fd1498Szrj     CTI_WCHAR_TYPE,
29238fd1498Szrj     CTI_UNDERLYING_WCHAR_TYPE,
29338fd1498Szrj     CTI_WINT_TYPE,
29438fd1498Szrj     CTI_SIGNED_SIZE_TYPE, /* For format checking only.  */
29538fd1498Szrj     CTI_UNSIGNED_PTRDIFF_TYPE, /* For format checking only.  */
29638fd1498Szrj     CTI_INTMAX_TYPE,
29738fd1498Szrj     CTI_UINTMAX_TYPE,
29838fd1498Szrj     CTI_WIDEST_INT_LIT_TYPE,
29938fd1498Szrj     CTI_WIDEST_UINT_LIT_TYPE,
30038fd1498Szrj 
30138fd1498Szrj     /* Types for <stdint.h>, that may not be defined on all
30238fd1498Szrj        targets.  */
30338fd1498Szrj     CTI_SIG_ATOMIC_TYPE,
30438fd1498Szrj     CTI_INT8_TYPE,
30538fd1498Szrj     CTI_INT16_TYPE,
30638fd1498Szrj     CTI_INT32_TYPE,
30738fd1498Szrj     CTI_INT64_TYPE,
30838fd1498Szrj     CTI_UINT8_TYPE,
30938fd1498Szrj     CTI_UINT16_TYPE,
31038fd1498Szrj     CTI_UINT32_TYPE,
31138fd1498Szrj     CTI_UINT64_TYPE,
31238fd1498Szrj     CTI_INT_LEAST8_TYPE,
31338fd1498Szrj     CTI_INT_LEAST16_TYPE,
31438fd1498Szrj     CTI_INT_LEAST32_TYPE,
31538fd1498Szrj     CTI_INT_LEAST64_TYPE,
31638fd1498Szrj     CTI_UINT_LEAST8_TYPE,
31738fd1498Szrj     CTI_UINT_LEAST16_TYPE,
31838fd1498Szrj     CTI_UINT_LEAST32_TYPE,
31938fd1498Szrj     CTI_UINT_LEAST64_TYPE,
32038fd1498Szrj     CTI_INT_FAST8_TYPE,
32138fd1498Szrj     CTI_INT_FAST16_TYPE,
32238fd1498Szrj     CTI_INT_FAST32_TYPE,
32338fd1498Szrj     CTI_INT_FAST64_TYPE,
32438fd1498Szrj     CTI_UINT_FAST8_TYPE,
32538fd1498Szrj     CTI_UINT_FAST16_TYPE,
32638fd1498Szrj     CTI_UINT_FAST32_TYPE,
32738fd1498Szrj     CTI_UINT_FAST64_TYPE,
32838fd1498Szrj     CTI_INTPTR_TYPE,
32938fd1498Szrj     CTI_UINTPTR_TYPE,
33038fd1498Szrj 
33138fd1498Szrj     CTI_CHAR_ARRAY_TYPE,
33238fd1498Szrj     CTI_CHAR16_ARRAY_TYPE,
33338fd1498Szrj     CTI_CHAR32_ARRAY_TYPE,
33438fd1498Szrj     CTI_WCHAR_ARRAY_TYPE,
33538fd1498Szrj     CTI_STRING_TYPE,
33638fd1498Szrj     CTI_CONST_STRING_TYPE,
33738fd1498Szrj 
33838fd1498Szrj     /* Type for boolean expressions (bool in C++, int in C).  */
33938fd1498Szrj     CTI_TRUTHVALUE_TYPE,
34038fd1498Szrj     CTI_TRUTHVALUE_TRUE,
34138fd1498Szrj     CTI_TRUTHVALUE_FALSE,
34238fd1498Szrj 
34338fd1498Szrj     CTI_DEFAULT_FUNCTION_TYPE,
34438fd1498Szrj 
34538fd1498Szrj     /* These are not types, but we have to look them up all the time.  */
34638fd1498Szrj     CTI_FUNCTION_NAME_DECL,
34738fd1498Szrj     CTI_PRETTY_FUNCTION_NAME_DECL,
34838fd1498Szrj     CTI_C99_FUNCTION_NAME_DECL,
34938fd1498Szrj     CTI_SAVED_FUNCTION_NAME_DECLS,
35038fd1498Szrj 
35138fd1498Szrj     CTI_NULL,
35238fd1498Szrj 
35338fd1498Szrj     CTI_MAX
35438fd1498Szrj };
35538fd1498Szrj 
35638fd1498Szrj #define C_CPP_HASHNODE(id) \
35738fd1498Szrj   (&(((struct c_common_identifier *) (id))->node))
35838fd1498Szrj #define C_RID_CODE(id) \
35938fd1498Szrj   ((enum rid) (((struct c_common_identifier *) (id))->node.rid_code))
36038fd1498Szrj #define C_SET_RID_CODE(id, code) \
36138fd1498Szrj   (((struct c_common_identifier *) (id))->node.rid_code = (unsigned char) code)
36238fd1498Szrj 
36338fd1498Szrj /* Identifier part common to the C front ends.  Inherits from
36438fd1498Szrj    tree_identifier, despite appearances.  */
36538fd1498Szrj struct GTY(()) c_common_identifier {
36638fd1498Szrj   struct tree_common common;
36738fd1498Szrj   struct cpp_hashnode node;
36838fd1498Szrj };
36938fd1498Szrj 
37038fd1498Szrj /* An entry in the reserved keyword table.  */
37138fd1498Szrj 
37238fd1498Szrj struct c_common_resword
37338fd1498Szrj {
37438fd1498Szrj   const char *const word;
37538fd1498Szrj   ENUM_BITFIELD(rid) const rid : 16;
37638fd1498Szrj   const unsigned int disable   : 16;
37738fd1498Szrj };
37838fd1498Szrj 
37938fd1498Szrj /* Mode used to build pointers (VOIDmode means ptr_mode).  */
38038fd1498Szrj 
38138fd1498Szrj extern machine_mode c_default_pointer_mode;
38238fd1498Szrj 
38338fd1498Szrj /* Extra cpp_ttype values for C++.  */
38438fd1498Szrj 
38538fd1498Szrj /* A token type for template-ids.  If a template-id is processed while
38638fd1498Szrj    parsing tentatively, it is replaced with a CPP_TEMPLATE_ID token;
38738fd1498Szrj    the value of the CPP_TEMPLATE_ID is whatever was returned by
38838fd1498Szrj    cp_parser_template_id.  */
38938fd1498Szrj #define CPP_TEMPLATE_ID ((enum cpp_ttype) (CPP_KEYWORD + 1))
39038fd1498Szrj 
39138fd1498Szrj /* A token type for nested-name-specifiers.  If a
39238fd1498Szrj    nested-name-specifier is processed while parsing tentatively, it is
39338fd1498Szrj    replaced with a CPP_NESTED_NAME_SPECIFIER token; the value of the
39438fd1498Szrj    CPP_NESTED_NAME_SPECIFIER is whatever was returned by
39538fd1498Szrj    cp_parser_nested_name_specifier_opt.  */
39638fd1498Szrj #define CPP_NESTED_NAME_SPECIFIER ((enum cpp_ttype) (CPP_TEMPLATE_ID + 1))
39738fd1498Szrj 
39838fd1498Szrj /* A token type for pre-parsed C++0x decltype.  */
39938fd1498Szrj #define CPP_DECLTYPE ((enum cpp_ttype) (CPP_NESTED_NAME_SPECIFIER + 1))
40038fd1498Szrj 
40138fd1498Szrj /* A token type for pre-parsed primary-expression (lambda- or statement-).  */
40238fd1498Szrj #define CPP_PREPARSED_EXPR ((enum cpp_ttype) (CPP_DECLTYPE + 1))
40338fd1498Szrj 
40438fd1498Szrj /* The number of token types, including C++-specific ones.  */
40538fd1498Szrj #define N_CP_TTYPES ((int) (CPP_PREPARSED_EXPR + 1))
40638fd1498Szrj 
40738fd1498Szrj /* Disable mask.  Keywords are disabled if (reswords[i].disable &
40838fd1498Szrj    mask) is _true_.  Thus for keywords which are present in all
40938fd1498Szrj    languages the disable field is zero.  */
41038fd1498Szrj 
41138fd1498Szrj #define D_CONLY		0x001	/* C only (not in C++).  */
41238fd1498Szrj #define D_CXXONLY	0x002	/* C++ only (not in C).  */
41338fd1498Szrj #define D_C99		0x004	/* In C, C99 only.  */
41438fd1498Szrj #define D_CXX11         0x008	/* In C++, C++11 only.  */
41538fd1498Szrj #define D_EXT		0x010	/* GCC extension.  */
41638fd1498Szrj #define D_EXT89		0x020	/* GCC extension incorporated in C99.  */
41738fd1498Szrj #define D_ASM		0x040	/* Disabled by -fno-asm.  */
41838fd1498Szrj #define D_OBJC		0x080	/* In Objective C and neither C nor C++.  */
41938fd1498Szrj #define D_CXX_OBJC	0x100	/* In Objective C, and C++, but not C.  */
42038fd1498Szrj #define D_CXXWARN	0x200	/* In C warn with -Wcxx-compat.  */
42138fd1498Szrj #define D_CXX_CONCEPTS  0x400   /* In C++, only with concepts. */
42238fd1498Szrj #define D_TRANSMEM	0X800   /* C++ transactional memory TS.  */
42338fd1498Szrj 
42438fd1498Szrj #define D_CXX_CONCEPTS_FLAGS D_CXXONLY | D_CXX_CONCEPTS
42538fd1498Szrj 
42638fd1498Szrj /* The reserved keyword table.  */
42738fd1498Szrj extern const struct c_common_resword c_common_reswords[];
42838fd1498Szrj 
42938fd1498Szrj /* The number of items in the reserved keyword table.  */
43038fd1498Szrj extern const unsigned int num_c_common_reswords;
43138fd1498Szrj 
43238fd1498Szrj #define char16_type_node		c_global_trees[CTI_CHAR16_TYPE]
43338fd1498Szrj #define char32_type_node		c_global_trees[CTI_CHAR32_TYPE]
43438fd1498Szrj #define wchar_type_node			c_global_trees[CTI_WCHAR_TYPE]
43538fd1498Szrj #define underlying_wchar_type_node	c_global_trees[CTI_UNDERLYING_WCHAR_TYPE]
43638fd1498Szrj #define wint_type_node			c_global_trees[CTI_WINT_TYPE]
43738fd1498Szrj #define signed_size_type_node		c_global_trees[CTI_SIGNED_SIZE_TYPE]
43838fd1498Szrj #define unsigned_ptrdiff_type_node	c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
43938fd1498Szrj #define intmax_type_node		c_global_trees[CTI_INTMAX_TYPE]
44038fd1498Szrj #define uintmax_type_node		c_global_trees[CTI_UINTMAX_TYPE]
44138fd1498Szrj #define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE]
44238fd1498Szrj #define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE]
44338fd1498Szrj 
44438fd1498Szrj #define sig_atomic_type_node		c_global_trees[CTI_SIG_ATOMIC_TYPE]
44538fd1498Szrj #define int8_type_node			c_global_trees[CTI_INT8_TYPE]
44638fd1498Szrj #define int16_type_node			c_global_trees[CTI_INT16_TYPE]
44738fd1498Szrj #define int32_type_node			c_global_trees[CTI_INT32_TYPE]
44838fd1498Szrj #define int64_type_node			c_global_trees[CTI_INT64_TYPE]
44938fd1498Szrj #define uint8_type_node			c_global_trees[CTI_UINT8_TYPE]
45038fd1498Szrj #define c_uint16_type_node		c_global_trees[CTI_UINT16_TYPE]
45138fd1498Szrj #define c_uint32_type_node		c_global_trees[CTI_UINT32_TYPE]
45238fd1498Szrj #define c_uint64_type_node		c_global_trees[CTI_UINT64_TYPE]
45338fd1498Szrj #define int_least8_type_node		c_global_trees[CTI_INT_LEAST8_TYPE]
45438fd1498Szrj #define int_least16_type_node		c_global_trees[CTI_INT_LEAST16_TYPE]
45538fd1498Szrj #define int_least32_type_node		c_global_trees[CTI_INT_LEAST32_TYPE]
45638fd1498Szrj #define int_least64_type_node		c_global_trees[CTI_INT_LEAST64_TYPE]
45738fd1498Szrj #define uint_least8_type_node		c_global_trees[CTI_UINT_LEAST8_TYPE]
45838fd1498Szrj #define uint_least16_type_node		c_global_trees[CTI_UINT_LEAST16_TYPE]
45938fd1498Szrj #define uint_least32_type_node		c_global_trees[CTI_UINT_LEAST32_TYPE]
46038fd1498Szrj #define uint_least64_type_node		c_global_trees[CTI_UINT_LEAST64_TYPE]
46138fd1498Szrj #define int_fast8_type_node		c_global_trees[CTI_INT_FAST8_TYPE]
46238fd1498Szrj #define int_fast16_type_node		c_global_trees[CTI_INT_FAST16_TYPE]
46338fd1498Szrj #define int_fast32_type_node		c_global_trees[CTI_INT_FAST32_TYPE]
46438fd1498Szrj #define int_fast64_type_node		c_global_trees[CTI_INT_FAST64_TYPE]
46538fd1498Szrj #define uint_fast8_type_node		c_global_trees[CTI_UINT_FAST8_TYPE]
46638fd1498Szrj #define uint_fast16_type_node		c_global_trees[CTI_UINT_FAST16_TYPE]
46738fd1498Szrj #define uint_fast32_type_node		c_global_trees[CTI_UINT_FAST32_TYPE]
46838fd1498Szrj #define uint_fast64_type_node		c_global_trees[CTI_UINT_FAST64_TYPE]
46938fd1498Szrj #define intptr_type_node		c_global_trees[CTI_INTPTR_TYPE]
47038fd1498Szrj #define uintptr_type_node		c_global_trees[CTI_UINTPTR_TYPE]
47138fd1498Szrj 
47238fd1498Szrj #define truthvalue_type_node		c_global_trees[CTI_TRUTHVALUE_TYPE]
47338fd1498Szrj #define truthvalue_true_node		c_global_trees[CTI_TRUTHVALUE_TRUE]
47438fd1498Szrj #define truthvalue_false_node		c_global_trees[CTI_TRUTHVALUE_FALSE]
47538fd1498Szrj 
47638fd1498Szrj #define char_array_type_node		c_global_trees[CTI_CHAR_ARRAY_TYPE]
47738fd1498Szrj #define char16_array_type_node		c_global_trees[CTI_CHAR16_ARRAY_TYPE]
47838fd1498Szrj #define char32_array_type_node		c_global_trees[CTI_CHAR32_ARRAY_TYPE]
47938fd1498Szrj #define wchar_array_type_node		c_global_trees[CTI_WCHAR_ARRAY_TYPE]
48038fd1498Szrj #define string_type_node		c_global_trees[CTI_STRING_TYPE]
48138fd1498Szrj #define const_string_type_node		c_global_trees[CTI_CONST_STRING_TYPE]
48238fd1498Szrj 
48338fd1498Szrj #define default_function_type		c_global_trees[CTI_DEFAULT_FUNCTION_TYPE]
48438fd1498Szrj 
48538fd1498Szrj #define function_name_decl_node		c_global_trees[CTI_FUNCTION_NAME_DECL]
48638fd1498Szrj #define pretty_function_name_decl_node	c_global_trees[CTI_PRETTY_FUNCTION_NAME_DECL]
48738fd1498Szrj #define c99_function_name_decl_node		c_global_trees[CTI_C99_FUNCTION_NAME_DECL]
48838fd1498Szrj #define saved_function_name_decls	c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS]
48938fd1498Szrj 
49038fd1498Szrj /* The node for C++ `__null'.  */
49138fd1498Szrj #define null_node                       c_global_trees[CTI_NULL]
49238fd1498Szrj 
49338fd1498Szrj extern GTY(()) tree c_global_trees[CTI_MAX];
49438fd1498Szrj 
49538fd1498Szrj /* Mark which labels are explicitly declared.
49638fd1498Szrj    These may be shadowed, and may be referenced from nested functions.  */
49738fd1498Szrj #define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
49838fd1498Szrj 
49938fd1498Szrj enum c_language_kind
50038fd1498Szrj {
50138fd1498Szrj   clk_c		= 0,		/* C90, C94, C99 or C11 */
50238fd1498Szrj   clk_objc	= 1,		/* clk_c with ObjC features.  */
50338fd1498Szrj   clk_cxx	= 2,		/* ANSI/ISO C++ */
50438fd1498Szrj   clk_objcxx	= 3		/* clk_cxx with ObjC features.  */
50538fd1498Szrj };
50638fd1498Szrj 
50738fd1498Szrj /* To test for a specific language use c_language, defined by each
50838fd1498Szrj    front end.  For "ObjC features" or "not C++" use the macros.  */
50938fd1498Szrj extern c_language_kind c_language;
51038fd1498Szrj 
51138fd1498Szrj #define c_dialect_cxx()		((c_language & clk_cxx) != 0)
51238fd1498Szrj #define c_dialect_objc()	((c_language & clk_objc) != 0)
51338fd1498Szrj 
51438fd1498Szrj /* The various name of operator that appears in error messages. */
51538fd1498Szrj enum ref_operator {
51638fd1498Szrj   /* NULL */
51738fd1498Szrj   RO_NULL,
51838fd1498Szrj   /* array indexing */
51938fd1498Szrj   RO_ARRAY_INDEXING,
52038fd1498Szrj   /* unary * */
52138fd1498Szrj   RO_UNARY_STAR,
52238fd1498Szrj   /* -> */
52338fd1498Szrj   RO_ARROW,
52438fd1498Szrj   /* implicit conversion */
52538fd1498Szrj   RO_IMPLICIT_CONVERSION,
52638fd1498Szrj   /* ->* */
52738fd1498Szrj   RO_ARROW_STAR
52838fd1498Szrj };
52938fd1498Szrj 
53038fd1498Szrj /* Information about a statement tree.  */
53138fd1498Szrj 
53238fd1498Szrj struct GTY(()) stmt_tree_s {
53338fd1498Szrj   /* A stack of statement lists being collected.  */
53438fd1498Szrj   vec<tree, va_gc> *x_cur_stmt_list;
53538fd1498Szrj 
53638fd1498Szrj   /* In C++, Nonzero if we should treat statements as full
53738fd1498Szrj      expressions.  In particular, this variable is non-zero if at the
53838fd1498Szrj      end of a statement we should destroy any temporaries created
53938fd1498Szrj      during that statement.  Similarly, if, at the end of a block, we
54038fd1498Szrj      should destroy any local variables in this block.  Normally, this
54138fd1498Szrj      variable is nonzero, since those are the normal semantics of
54238fd1498Szrj      C++.
54338fd1498Szrj 
54438fd1498Szrj      This flag has no effect in C.  */
54538fd1498Szrj   int stmts_are_full_exprs_p;
54638fd1498Szrj };
54738fd1498Szrj 
54838fd1498Szrj typedef struct stmt_tree_s *stmt_tree;
54938fd1498Szrj 
55038fd1498Szrj /* Global state pertinent to the current function.  Some C dialects
55138fd1498Szrj    extend this structure with additional fields.  */
55238fd1498Szrj 
55338fd1498Szrj struct GTY(()) c_language_function {
55438fd1498Szrj   /* While we are parsing the function, this contains information
55538fd1498Szrj      about the statement-tree that we are building.  */
55638fd1498Szrj   struct stmt_tree_s x_stmt_tree;
55738fd1498Szrj 
55838fd1498Szrj   /* Vector of locally defined typedefs, for
55938fd1498Szrj      -Wunused-local-typedefs.  */
56038fd1498Szrj   vec<tree, va_gc> *local_typedefs;
56138fd1498Szrj };
56238fd1498Szrj 
56338fd1498Szrj #define stmt_list_stack (current_stmt_tree ()->x_cur_stmt_list)
56438fd1498Szrj 
56538fd1498Szrj /* When building a statement-tree, this is the current statement list
56638fd1498Szrj    being collected.  */
56738fd1498Szrj #define cur_stmt_list	(stmt_list_stack->last ())
56838fd1498Szrj 
56938fd1498Szrj #define building_stmt_list_p() (stmt_list_stack && !stmt_list_stack->is_empty())
57038fd1498Szrj 
57138fd1498Szrj /* Language-specific hooks.  */
57238fd1498Szrj 
57338fd1498Szrj /* If non-NULL, this function is called after a precompile header file
57438fd1498Szrj    is loaded.  */
57538fd1498Szrj extern void (*lang_post_pch_load) (void);
57638fd1498Szrj 
57738fd1498Szrj extern void push_file_scope (void);
57838fd1498Szrj extern void pop_file_scope (void);
57938fd1498Szrj extern stmt_tree current_stmt_tree (void);
58038fd1498Szrj extern tree push_stmt_list (void);
58138fd1498Szrj extern tree pop_stmt_list (tree);
58238fd1498Szrj extern tree add_stmt (tree);
58338fd1498Szrj extern void push_cleanup (tree, tree, bool);
58438fd1498Szrj 
58538fd1498Szrj extern tree build_modify_expr (location_t, tree, tree, enum tree_code,
58638fd1498Szrj 			       location_t, tree, tree);
58738fd1498Szrj extern tree build_indirect_ref (location_t, tree, ref_operator);
58838fd1498Szrj 
58938fd1498Szrj extern bool has_c_linkage (const_tree decl);
59038fd1498Szrj extern bool c_decl_implicit (const_tree);
59138fd1498Szrj 
59238fd1498Szrj /* Switches common to the C front ends.  */
59338fd1498Szrj 
59438fd1498Szrj /* Nonzero means don't output line number information.  */
59538fd1498Szrj 
59638fd1498Szrj extern char flag_no_line_commands;
59738fd1498Szrj 
59838fd1498Szrj /* Nonzero causes -E output not to be done, but directives such as
59938fd1498Szrj    #define that have side effects are still obeyed.  */
60038fd1498Szrj 
60138fd1498Szrj extern char flag_no_output;
60238fd1498Szrj 
60338fd1498Szrj /* Nonzero means dump macros in some fashion; contains the 'D', 'M',
60438fd1498Szrj    'N' or 'U' of the command line switch.  */
60538fd1498Szrj 
60638fd1498Szrj extern char flag_dump_macros;
60738fd1498Szrj 
60838fd1498Szrj /* Nonzero means pass #include lines through to the output.  */
60938fd1498Szrj 
61038fd1498Szrj extern char flag_dump_includes;
61138fd1498Szrj 
61238fd1498Szrj /* Nonzero means process PCH files while preprocessing.  */
61338fd1498Szrj 
61438fd1498Szrj extern bool flag_pch_preprocess;
61538fd1498Szrj 
61638fd1498Szrj /* The file name to which we should write a precompiled header, or
61738fd1498Szrj    NULL if no header will be written in this compile.  */
61838fd1498Szrj 
61938fd1498Szrj extern const char *pch_file;
62038fd1498Szrj 
62138fd1498Szrj /* Nonzero if an ISO standard was selected.  It rejects macros in the
62238fd1498Szrj    user's namespace.  */
62338fd1498Szrj 
62438fd1498Szrj extern int flag_iso;
62538fd1498Szrj 
62638fd1498Szrj /* C/ObjC language option variables.  */
62738fd1498Szrj 
62838fd1498Szrj 
62938fd1498Szrj /* Nonzero means allow type mismatches in conditional expressions;
63038fd1498Szrj    just make their values `void'.  */
63138fd1498Szrj 
63238fd1498Szrj extern int flag_cond_mismatch;
63338fd1498Szrj 
63438fd1498Szrj /* Nonzero means enable C89 Amendment 1 features.  */
63538fd1498Szrj 
63638fd1498Szrj extern int flag_isoc94;
63738fd1498Szrj 
63838fd1498Szrj /* Nonzero means use the ISO C99 (or C11) dialect of C.  */
63938fd1498Szrj 
64038fd1498Szrj extern int flag_isoc99;
64138fd1498Szrj 
64238fd1498Szrj /* Nonzero means use the ISO C11 dialect of C.  */
64338fd1498Szrj 
64438fd1498Szrj extern int flag_isoc11;
64538fd1498Szrj 
64638fd1498Szrj /* Nonzero means that we have builtin functions, and main is an int.  */
64738fd1498Szrj 
64838fd1498Szrj extern int flag_hosted;
64938fd1498Szrj 
65038fd1498Szrj /* ObjC language option variables.  */
65138fd1498Szrj 
65238fd1498Szrj 
65338fd1498Szrj /* Tells the compiler that this is a special run.  Do not perform any
65438fd1498Szrj    compiling, instead we are to test some platform dependent features
65538fd1498Szrj    and output a C header file with appropriate definitions.  */
65638fd1498Szrj 
65738fd1498Szrj extern int print_struct_values;
65838fd1498Szrj 
65938fd1498Szrj /* Tells the compiler what is the constant string class for ObjC.  */
66038fd1498Szrj 
66138fd1498Szrj extern const char *constant_string_class_name;
66238fd1498Szrj 
66338fd1498Szrj 
66438fd1498Szrj /* C++ language option variables.  */
66538fd1498Szrj 
66638fd1498Szrj /* The reference version of the ABI for -Wabi.  */
66738fd1498Szrj 
66838fd1498Szrj extern int warn_abi_version;
66938fd1498Szrj 
67038fd1498Szrj /* Return TRUE if one of {flag_abi_version,flag_abi_compat_version} is
67138fd1498Szrj    less than N and the other is at least N.  */
67238fd1498Szrj #define abi_compat_version_crosses(N)		\
67338fd1498Szrj   (abi_version_at_least(N)			\
67438fd1498Szrj    != (flag_abi_compat_version == 0		\
67538fd1498Szrj        || flag_abi_compat_version >= (N)))
67638fd1498Szrj 
67738fd1498Szrj /* Return TRUE if one of {flag_abi_version,warn_abi_version} is
67838fd1498Szrj    less than N and the other is at least N, for use by -Wabi.  */
67938fd1498Szrj #define abi_version_crosses(N)			\
68038fd1498Szrj   (abi_version_at_least(N)			\
68138fd1498Szrj    != (warn_abi_version == 0			\
68238fd1498Szrj        || warn_abi_version >= (N)))
68338fd1498Szrj 
68438fd1498Szrj /* Nonzero means generate separate instantiation control files and
68538fd1498Szrj    juggle them at link time.  */
68638fd1498Szrj 
68738fd1498Szrj extern int flag_use_repository;
68838fd1498Szrj 
68938fd1498Szrj /* The supported C++ dialects.  */
69038fd1498Szrj 
69138fd1498Szrj enum cxx_dialect {
69238fd1498Szrj   cxx_unset,
69338fd1498Szrj   /* C++98 with TC1  */
69438fd1498Szrj   cxx98,
69538fd1498Szrj   cxx03 = cxx98,
69638fd1498Szrj   /* C++11  */
69738fd1498Szrj   cxx0x,
69838fd1498Szrj   cxx11 = cxx0x,
69938fd1498Szrj   /* C++14 */
70038fd1498Szrj   cxx14,
70138fd1498Szrj   /* C++17 */
70238fd1498Szrj   cxx17,
70338fd1498Szrj   /* C++2a (C++20?) */
70438fd1498Szrj   cxx2a
70538fd1498Szrj };
70638fd1498Szrj 
70738fd1498Szrj /* The C++ dialect being used. C++98 is the default.  */
70838fd1498Szrj extern enum cxx_dialect cxx_dialect;
70938fd1498Szrj 
71038fd1498Szrj /* Maximum template instantiation depth.  This limit is rather
71138fd1498Szrj    arbitrary, but it exists to limit the time it takes to notice
71238fd1498Szrj    excessively recursive template instantiations.  */
71338fd1498Szrj 
71438fd1498Szrj extern int max_tinst_depth;
71538fd1498Szrj 
71638fd1498Szrj /* Nonzero means that we should not issue warnings about problems that
71738fd1498Szrj    occur when the code is executed, because the code being processed
71838fd1498Szrj    is not expected to be executed.  This is set during parsing.  This
71938fd1498Szrj    is used for cases like sizeof() and "0 ? a : b".  This is a count,
72038fd1498Szrj    not a bool, because unexecuted expressions can nest.  */
72138fd1498Szrj 
72238fd1498Szrj extern int c_inhibit_evaluation_warnings;
72338fd1498Szrj 
72438fd1498Szrj /* Whether lexing has been completed, so subsequent preprocessor
72538fd1498Szrj    errors should use the compiler's input_location.  */
72638fd1498Szrj 
72738fd1498Szrj extern bool done_lexing;
72838fd1498Szrj 
72938fd1498Szrj /* C types are partitioned into three subsets: object, function, and
73038fd1498Szrj    incomplete types.  */
73138fd1498Szrj #define C_TYPE_OBJECT_P(type) \
73238fd1498Szrj   (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type))
73338fd1498Szrj 
73438fd1498Szrj #define C_TYPE_INCOMPLETE_P(type) \
73538fd1498Szrj   (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type) == 0)
73638fd1498Szrj 
73738fd1498Szrj #define C_TYPE_FUNCTION_P(type) \
73838fd1498Szrj   (TREE_CODE (type) == FUNCTION_TYPE)
73938fd1498Szrj 
74038fd1498Szrj /* For convenience we define a single macro to identify the class of
74138fd1498Szrj    object or incomplete types.  */
74238fd1498Szrj #define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
74338fd1498Szrj   (!C_TYPE_FUNCTION_P (type))
74438fd1498Szrj 
74538fd1498Szrj struct visibility_flags
74638fd1498Szrj {
74738fd1498Szrj   unsigned inpragma : 1;	/* True when in #pragma GCC visibility.  */
74838fd1498Szrj   unsigned inlines_hidden : 1;	/* True when -finlineshidden in effect.  */
74938fd1498Szrj };
75038fd1498Szrj 
75138fd1498Szrj /* These enumerators are possible types of unsafe conversions.  */
75238fd1498Szrj enum conversion_safety {
75338fd1498Szrj   /* The conversion is safe.  */
75438fd1498Szrj   SAFE_CONVERSION = 0,
75538fd1498Szrj   /* Another type of conversion with problems.  */
75638fd1498Szrj   UNSAFE_OTHER,
75738fd1498Szrj   /* Conversion between signed and unsigned integers
75838fd1498Szrj      which are all warned about immediately, so this is unused.  */
75938fd1498Szrj   UNSAFE_SIGN,
76038fd1498Szrj   /* Conversions that reduce the precision of reals including conversions
76138fd1498Szrj      from reals to integers.  */
76238fd1498Szrj   UNSAFE_REAL,
76338fd1498Szrj   /* Conversions from complex to reals or integers, that discard imaginary
76438fd1498Szrj      component.  */
76538fd1498Szrj   UNSAFE_IMAGINARY
76638fd1498Szrj };
76738fd1498Szrj 
76838fd1498Szrj /* Global visibility options.  */
76938fd1498Szrj extern struct visibility_flags visibility_options;
77038fd1498Szrj 
77138fd1498Szrj /* Attribute table common to the C front ends.  */
77238fd1498Szrj extern const struct attribute_spec c_common_attribute_table[];
77338fd1498Szrj extern const struct attribute_spec c_common_format_attribute_table[];
77438fd1498Szrj 
77538fd1498Szrj /* Pointer to function to lazily generate the VAR_DECL for __FUNCTION__ etc.
77638fd1498Szrj    ID is the identifier to use, NAME is the string.
77738fd1498Szrj    TYPE_DEP indicates whether it depends on type of the function or not
77838fd1498Szrj    (i.e. __PRETTY_FUNCTION__).  */
77938fd1498Szrj 
78038fd1498Szrj extern tree (*make_fname_decl) (location_t, tree, int);
78138fd1498Szrj 
78238fd1498Szrj /* In c-decl.c and cp/tree.c.  FIXME.  */
78338fd1498Szrj extern void c_register_addr_space (const char *str, addr_space_t as);
78438fd1498Szrj 
78538fd1498Szrj /* In c-common.c.  */
78638fd1498Szrj extern bool in_late_binary_op;
78738fd1498Szrj extern const char *c_addr_space_name (addr_space_t as);
78838fd1498Szrj extern tree identifier_global_value (tree);
78938fd1498Szrj extern tree c_linkage_bindings (tree);
79038fd1498Szrj extern void record_builtin_type (enum rid, const char *, tree);
79138fd1498Szrj extern tree build_void_list_node (void);
79238fd1498Szrj extern void start_fname_decls (void);
79338fd1498Szrj extern void finish_fname_decls (void);
79438fd1498Szrj extern const char *fname_as_string (int);
79538fd1498Szrj extern tree fname_decl (location_t, unsigned, tree);
79638fd1498Szrj 
79738fd1498Szrj extern int check_user_alignment (const_tree, bool);
79838fd1498Szrj extern bool check_function_arguments (location_t loc, const_tree, const_tree,
79938fd1498Szrj 				      int, tree *, vec<location_t> *);
80038fd1498Szrj extern void check_function_arguments_recurse (void (*)
80138fd1498Szrj 					      (void *, tree,
80238fd1498Szrj 					       unsigned HOST_WIDE_INT),
80338fd1498Szrj 					      void *, tree,
80438fd1498Szrj 					      unsigned HOST_WIDE_INT);
80538fd1498Szrj extern bool check_builtin_function_arguments (location_t, vec<location_t>,
80638fd1498Szrj 					      tree, int, tree *);
80738fd1498Szrj extern void check_function_format (tree, int, tree *, vec<location_t> *);
80838fd1498Szrj extern bool attribute_fallthrough_p (tree);
80938fd1498Szrj extern tree handle_format_attribute (tree *, tree, tree, int, bool *);
81038fd1498Szrj extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
81138fd1498Szrj extern bool c_common_handle_option (size_t, const char *, int, int, location_t,
81238fd1498Szrj 				    const struct cl_option_handlers *);
81338fd1498Szrj extern bool default_handle_c_option (size_t, const char *, int);
81438fd1498Szrj extern tree c_common_type_for_mode (machine_mode, int);
81538fd1498Szrj extern tree c_common_type_for_size (unsigned int, int);
81638fd1498Szrj extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int,
81738fd1498Szrj 						int, int);
81838fd1498Szrj extern tree c_common_unsigned_type (tree);
81938fd1498Szrj extern tree c_common_signed_type (tree);
82038fd1498Szrj extern tree c_common_signed_or_unsigned_type (int, tree);
82138fd1498Szrj extern void c_common_init_ts (void);
82238fd1498Szrj extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int);
82338fd1498Szrj extern enum conversion_safety unsafe_conversion_p (location_t, tree, tree, tree,
82438fd1498Szrj 						   bool);
82538fd1498Szrj extern bool decl_with_nonnull_addr_p (const_tree);
82638fd1498Szrj extern tree c_fully_fold (tree, bool, bool *, bool = false);
82738fd1498Szrj extern tree c_wrap_maybe_const (tree, bool);
82838fd1498Szrj extern tree c_common_truthvalue_conversion (location_t, tree);
82938fd1498Szrj extern void c_apply_type_quals_to_decl (int, tree);
83038fd1498Szrj extern tree c_sizeof_or_alignof_type (location_t, tree, bool, bool, int);
83138fd1498Szrj extern tree c_alignof_expr (location_t, tree);
83238fd1498Szrj /* Print an error message for invalid operands to arith operation CODE.
83338fd1498Szrj    NOP_EXPR is used as a special case (see truthvalue_conversion).  */
83438fd1498Szrj extern void binary_op_error (rich_location *, enum tree_code, tree, tree);
83538fd1498Szrj extern tree fix_string_type (tree);
83638fd1498Szrj extern tree convert_and_check (location_t, tree, tree);
83738fd1498Szrj extern bool c_determine_visibility (tree);
83838fd1498Szrj extern bool vector_types_compatible_elements_p (tree, tree);
83938fd1498Szrj extern void mark_valid_location_for_stdc_pragma (bool);
84038fd1498Szrj extern bool valid_location_for_stdc_pragma_p (void);
84138fd1498Szrj extern void set_float_const_decimal64 (void);
84238fd1498Szrj extern void clear_float_const_decimal64 (void);
84338fd1498Szrj extern bool float_const_decimal64_p (void);
84438fd1498Szrj 
84538fd1498Szrj extern bool keyword_begins_type_specifier (enum rid);
84638fd1498Szrj extern bool keyword_is_storage_class_specifier (enum rid);
84738fd1498Szrj extern bool keyword_is_type_qualifier (enum rid);
84838fd1498Szrj extern bool keyword_is_decl_specifier (enum rid);
84938fd1498Szrj extern unsigned max_align_t_align (void);
85038fd1498Szrj extern bool cxx_fundamental_alignment_p (unsigned);
85138fd1498Szrj extern bool pointer_to_zero_sized_aggr_p (tree);
85238fd1498Szrj extern bool bool_promoted_to_int_p (tree);
85338fd1498Szrj extern tree fold_for_warn (tree);
85438fd1498Szrj extern tree c_common_get_narrower (tree, int *);
85538fd1498Szrj extern bool get_nonnull_operand (tree, unsigned HOST_WIDE_INT *);
85638fd1498Szrj 
85738fd1498Szrj #define c_sizeof(LOC, T)  c_sizeof_or_alignof_type (LOC, T, true, false, 1)
85838fd1498Szrj #define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, false, 1)
85938fd1498Szrj 
86038fd1498Szrj /* Subroutine of build_binary_op, used for certain operations.  */
86138fd1498Szrj extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise);
86238fd1498Szrj 
86338fd1498Szrj /* Subroutine of build_binary_op, used for comparison operations.
86438fd1498Szrj    See if the operands have both been converted from subword integer types
86538fd1498Szrj    and, if so, perhaps change them both back to their original type.  */
86638fd1498Szrj extern tree shorten_compare (location_t, tree *, tree *, tree *,
86738fd1498Szrj 			     enum tree_code *);
86838fd1498Szrj 
86938fd1498Szrj extern tree pointer_int_sum (location_t, enum tree_code, tree, tree,
87038fd1498Szrj 			     bool = true);
87138fd1498Szrj 
87238fd1498Szrj /* Add qualifiers to a type, in the fashion for C.  */
87338fd1498Szrj extern tree c_build_qualified_type (tree, int, tree = NULL_TREE, size_t = 0);
87438fd1498Szrj 
87538fd1498Szrj /* Build tree nodes and builtin functions common to both C and C++ language
87638fd1498Szrj    frontends.  */
87738fd1498Szrj extern void c_common_nodes_and_builtins (void);
87838fd1498Szrj 
87938fd1498Szrj extern void disable_builtin_function (const char *);
88038fd1498Szrj 
88138fd1498Szrj extern void set_compound_literal_name (tree decl);
88238fd1498Szrj 
88338fd1498Szrj extern tree build_va_arg (location_t, tree, tree);
88438fd1498Szrj 
88538fd1498Szrj extern const unsigned int c_family_lang_mask;
88638fd1498Szrj extern unsigned int c_common_option_lang_mask (void);
88738fd1498Szrj extern void c_common_diagnostics_set_defaults (diagnostic_context *);
88838fd1498Szrj extern bool c_common_complain_wrong_lang_p (const struct cl_option *);
88938fd1498Szrj extern void c_common_init_options_struct (struct gcc_options *);
89038fd1498Szrj extern void c_common_init_options (unsigned int, struct cl_decoded_option *);
89138fd1498Szrj extern bool c_common_post_options (const char **);
89238fd1498Szrj extern bool c_common_init (void);
89338fd1498Szrj extern void c_common_finish (void);
89438fd1498Szrj extern void c_common_parse_file (void);
89538fd1498Szrj extern FILE *get_dump_info (int, dump_flags_t *);
89638fd1498Szrj extern alias_set_type c_common_get_alias_set (tree);
89738fd1498Szrj extern void c_register_builtin_type (tree, const char*);
89838fd1498Szrj extern bool c_promoting_integer_type_p (const_tree);
89938fd1498Szrj extern bool self_promoting_args_p (const_tree);
90038fd1498Szrj extern tree strip_pointer_operator (tree);
90138fd1498Szrj extern tree strip_pointer_or_array_types (tree);
90238fd1498Szrj extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);
90338fd1498Szrj 
90438fd1498Szrj /* This is the basic parsing function.  */
90538fd1498Szrj extern void c_parse_file (void);
90638fd1498Szrj 
90738fd1498Szrj extern void c_parse_final_cleanups (void);
90838fd1498Szrj 
90938fd1498Szrj /* These macros provide convenient access to the various _STMT nodes.  */
91038fd1498Szrj 
91138fd1498Szrj /* Nonzero if a given STATEMENT_LIST represents the outermost binding
91238fd1498Szrj    if a statement expression.  */
91338fd1498Szrj #define STATEMENT_LIST_STMT_EXPR(NODE) \
91438fd1498Szrj   TREE_LANG_FLAG_1 (STATEMENT_LIST_CHECK (NODE))
91538fd1498Szrj 
91638fd1498Szrj /* Nonzero if a label has been added to the statement list.  */
91738fd1498Szrj #define STATEMENT_LIST_HAS_LABEL(NODE) \
91838fd1498Szrj   TREE_LANG_FLAG_3 (STATEMENT_LIST_CHECK (NODE))
91938fd1498Szrj 
92038fd1498Szrj /* C_MAYBE_CONST_EXPR accessors.  */
92138fd1498Szrj #define C_MAYBE_CONST_EXPR_PRE(NODE)			\
92238fd1498Szrj   TREE_OPERAND (C_MAYBE_CONST_EXPR_CHECK (NODE), 0)
92338fd1498Szrj #define C_MAYBE_CONST_EXPR_EXPR(NODE)			\
92438fd1498Szrj   TREE_OPERAND (C_MAYBE_CONST_EXPR_CHECK (NODE), 1)
92538fd1498Szrj #define C_MAYBE_CONST_EXPR_INT_OPERANDS(NODE)		\
92638fd1498Szrj   TREE_LANG_FLAG_0 (C_MAYBE_CONST_EXPR_CHECK (NODE))
92738fd1498Szrj #define C_MAYBE_CONST_EXPR_NON_CONST(NODE)		\
92838fd1498Szrj   TREE_LANG_FLAG_1 (C_MAYBE_CONST_EXPR_CHECK (NODE))
92938fd1498Szrj #define EXPR_INT_CONST_OPERANDS(EXPR)			\
93038fd1498Szrj   (INTEGRAL_TYPE_P (TREE_TYPE (EXPR))			\
93138fd1498Szrj    && (TREE_CODE (EXPR) == INTEGER_CST			\
93238fd1498Szrj        || (TREE_CODE (EXPR) == C_MAYBE_CONST_EXPR	\
93338fd1498Szrj 	   && C_MAYBE_CONST_EXPR_INT_OPERANDS (EXPR))))
93438fd1498Szrj 
93538fd1498Szrj /* In a FIELD_DECL, nonzero if the decl was originally a bitfield.  */
93638fd1498Szrj #define DECL_C_BIT_FIELD(NODE) \
93738fd1498Szrj   (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) == 1)
93838fd1498Szrj #define SET_DECL_C_BIT_FIELD(NODE) \
93938fd1498Szrj   (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 1)
94038fd1498Szrj #define CLEAR_DECL_C_BIT_FIELD(NODE) \
94138fd1498Szrj   (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 0)
94238fd1498Szrj 
94338fd1498Szrj /* True if the decl was an unnamed bitfield.  */
94438fd1498Szrj #define DECL_UNNAMED_BIT_FIELD(NODE) \
94538fd1498Szrj   (DECL_C_BIT_FIELD (NODE) && !DECL_NAME (NODE))
94638fd1498Szrj 
94738fd1498Szrj extern tree do_case (location_t, tree, tree);
94838fd1498Szrj extern tree build_stmt (location_t, enum tree_code, ...);
94938fd1498Szrj extern tree build_real_imag_expr (location_t, enum tree_code, tree);
95038fd1498Szrj 
95138fd1498Szrj /* These functions must be defined by each front-end which implements
95238fd1498Szrj    a variant of the C language.  They are used in c-common.c.  */
95338fd1498Szrj 
95438fd1498Szrj extern tree build_unary_op (location_t, enum tree_code, tree, bool);
95538fd1498Szrj extern tree build_binary_op (location_t, enum tree_code, tree, tree, bool);
95638fd1498Szrj extern tree perform_integral_promotions (tree);
95738fd1498Szrj 
95838fd1498Szrj /* These functions must be defined by each front-end which implements
95938fd1498Szrj    a variant of the C language.  They are used by port files.  */
96038fd1498Szrj 
96138fd1498Szrj extern tree default_conversion (tree);
96238fd1498Szrj 
96338fd1498Szrj /* Given two integer or real types, return the type for their sum.
96438fd1498Szrj    Given two compatible ANSI C types, returns the merged type.  */
96538fd1498Szrj 
96638fd1498Szrj extern tree common_type (tree, tree);
96738fd1498Szrj 
96838fd1498Szrj extern tree decl_constant_value (tree);
96938fd1498Szrj 
97038fd1498Szrj /* Handle increment and decrement of boolean types.  */
97138fd1498Szrj extern tree boolean_increment (enum tree_code, tree);
97238fd1498Szrj 
97338fd1498Szrj extern int case_compare (splay_tree_key, splay_tree_key);
97438fd1498Szrj 
97538fd1498Szrj extern tree c_add_case_label (location_t, splay_tree, tree, tree, tree, tree,
97638fd1498Szrj 			      bool *);
97738fd1498Szrj extern bool c_switch_covers_all_cases_p (splay_tree, tree);
97838fd1498Szrj 
97938fd1498Szrj extern tree build_function_call (location_t, tree, tree);
98038fd1498Szrj 
98138fd1498Szrj extern tree build_function_call_vec (location_t, vec<location_t>, tree,
98238fd1498Szrj 				     vec<tree, va_gc> *, vec<tree, va_gc> *);
98338fd1498Szrj 
98438fd1498Szrj extern tree resolve_overloaded_builtin (location_t, tree, vec<tree, va_gc> *);
98538fd1498Szrj 
98638fd1498Szrj extern tree finish_label_address_expr (tree, location_t);
98738fd1498Szrj 
98838fd1498Szrj /* Same function prototype, but the C and C++ front ends have
98938fd1498Szrj    different implementations.  Used in c-common.c.  */
99038fd1498Szrj extern tree lookup_label (tree);
99138fd1498Szrj extern tree lookup_name (tree);
99238fd1498Szrj extern bool lvalue_p (const_tree);
99338fd1498Szrj 
99438fd1498Szrj extern bool vector_targets_convertible_p (const_tree t1, const_tree t2);
99538fd1498Szrj extern bool vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note);
99638fd1498Szrj extern tree c_build_vec_perm_expr (location_t, tree, tree, tree, bool = true);
99738fd1498Szrj 
99838fd1498Szrj extern void init_c_lex (void);
99938fd1498Szrj 
100038fd1498Szrj extern void c_cpp_builtins (cpp_reader *);
100138fd1498Szrj extern void c_cpp_builtins_optimize_pragma (cpp_reader *, tree, tree);
100238fd1498Szrj extern bool c_cpp_error (cpp_reader *, int, int, rich_location *,
100338fd1498Szrj 			 const char *, va_list *)
100438fd1498Szrj      ATTRIBUTE_GCC_DIAG(5,0);
100538fd1498Szrj extern int c_common_has_attribute (cpp_reader *);
100638fd1498Szrj 
100738fd1498Szrj extern bool parse_optimize_options (tree, bool);
100838fd1498Szrj 
100938fd1498Szrj /* Positive if an implicit `extern "C"' scope has just been entered;
101038fd1498Szrj    negative if such a scope has just been exited.  */
101138fd1498Szrj extern GTY(()) int pending_lang_change;
101238fd1498Szrj 
101338fd1498Szrj /* Information recorded about each file examined during compilation.  */
101438fd1498Szrj 
101538fd1498Szrj struct c_fileinfo
101638fd1498Szrj {
101738fd1498Szrj   int time;	/* Time spent in the file.  */
101838fd1498Szrj 
101938fd1498Szrj   /* Flags used only by C++.
102038fd1498Szrj      INTERFACE_ONLY nonzero means that we are in an "interface" section
102138fd1498Szrj      of the compiler.  INTERFACE_UNKNOWN nonzero means we cannot trust
102238fd1498Szrj      the value of INTERFACE_ONLY.  If INTERFACE_UNKNOWN is zero and
102338fd1498Szrj      INTERFACE_ONLY is zero, it means that we are responsible for
102438fd1498Szrj      exporting definitions that others might need.  */
102538fd1498Szrj   short interface_only;
102638fd1498Szrj   short interface_unknown;
102738fd1498Szrj };
102838fd1498Szrj 
102938fd1498Szrj struct c_fileinfo *get_fileinfo (const char *);
103038fd1498Szrj extern void dump_time_statistics (void);
103138fd1498Szrj 
103238fd1498Szrj extern bool c_dump_tree (void *, tree);
103338fd1498Szrj 
103438fd1498Szrj extern void verify_sequence_points (tree);
103538fd1498Szrj 
1036*58e805e6Szrj extern tree fold_offsetof (tree, tree = size_type_node,
1037*58e805e6Szrj 			   tree_code ctx = ERROR_MARK);
103838fd1498Szrj 
103938fd1498Szrj extern int complete_array_type (tree *, tree, bool);
104038fd1498Szrj 
104138fd1498Szrj extern tree builtin_type_for_size (int, bool);
104238fd1498Szrj 
104338fd1498Szrj extern void c_common_mark_addressable_vec (tree);
104438fd1498Szrj 
104538fd1498Szrj extern void set_underlying_type (tree);
104638fd1498Szrj extern void record_types_used_by_current_var_decl (tree);
104738fd1498Szrj extern vec<tree, va_gc> *make_tree_vector (void);
104838fd1498Szrj extern void release_tree_vector (vec<tree, va_gc> *);
104938fd1498Szrj extern vec<tree, va_gc> *make_tree_vector_single (tree);
105038fd1498Szrj extern vec<tree, va_gc> *make_tree_vector_from_list (tree);
105138fd1498Szrj extern vec<tree, va_gc> *make_tree_vector_from_ctor (tree);
105238fd1498Szrj extern vec<tree, va_gc> *make_tree_vector_copy (const vec<tree, va_gc> *);
105338fd1498Szrj 
105438fd1498Szrj /* Used for communication between c_common_type_for_mode and
105538fd1498Szrj    c_register_builtin_type.  */
105638fd1498Szrj extern GTY(()) tree registered_builtin_types;
105738fd1498Szrj 
105838fd1498Szrj /* Read SOURCE_DATE_EPOCH from environment to have a deterministic
105938fd1498Szrj    timestamp to replace embedded current dates to get reproducible
106038fd1498Szrj    results.  Returns -1 if SOURCE_DATE_EPOCH is not defined.  */
106138fd1498Szrj extern time_t cb_get_source_date_epoch (cpp_reader *pfile);
106238fd1498Szrj 
106338fd1498Szrj /* The value (as a unix timestamp) corresponds to date
106438fd1498Szrj    "Dec 31 9999 23:59:59 UTC", which is the latest date that __DATE__ and
106538fd1498Szrj    __TIME__ can store.  */
106638fd1498Szrj #define MAX_SOURCE_DATE_EPOCH HOST_WIDE_INT_C (253402300799)
106738fd1498Szrj 
106838fd1498Szrj /* Callback for libcpp for offering spelling suggestions for misspelled
106938fd1498Szrj    directives.  */
107038fd1498Szrj extern const char *cb_get_suggestion (cpp_reader *, const char *,
107138fd1498Szrj 				      const char *const *);
107238fd1498Szrj 
107338fd1498Szrj extern GTY(()) string_concat_db *g_string_concat_db;
107438fd1498Szrj 
107538fd1498Szrj class substring_loc;
107638fd1498Szrj extern const char *c_get_substring_location (const substring_loc &substr_loc,
107738fd1498Szrj 					     location_t *out_loc);
107838fd1498Szrj 
107938fd1498Szrj /* In c-gimplify.c  */
108038fd1498Szrj extern void c_genericize (tree);
108138fd1498Szrj extern int c_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
108238fd1498Szrj extern tree c_build_bind_expr (location_t, tree, tree);
108338fd1498Szrj 
108438fd1498Szrj /* In c-lex.c.  */
108538fd1498Szrj extern enum cpp_ttype
108638fd1498Szrj conflict_marker_get_final_tok_kind (enum cpp_ttype tok1_kind);
108738fd1498Szrj 
108838fd1498Szrj /* In c-pch.c  */
108938fd1498Szrj extern void pch_init (void);
109038fd1498Szrj extern void pch_cpp_save_state (void);
109138fd1498Szrj extern int c_common_valid_pch (cpp_reader *pfile, const char *name, int fd);
109238fd1498Szrj extern void c_common_read_pch (cpp_reader *pfile, const char *name, int fd,
109338fd1498Szrj 			       const char *orig);
109438fd1498Szrj extern void c_common_write_pch (void);
109538fd1498Szrj extern void c_common_no_more_pch (void);
109638fd1498Szrj extern void c_common_pch_pragma (cpp_reader *pfile, const char *);
109738fd1498Szrj 
109838fd1498Szrj /* In *-checksum.c */
109938fd1498Szrj extern const unsigned char executable_checksum[16];
110038fd1498Szrj 
110138fd1498Szrj /* In c-cppbuiltin.c  */
110238fd1498Szrj extern void builtin_define_std (const char *macro);
110338fd1498Szrj extern void builtin_define_with_value (const char *, const char *, int);
110438fd1498Szrj extern void builtin_define_with_int_value (const char *, HOST_WIDE_INT);
110538fd1498Szrj extern void builtin_define_type_sizeof (const char *, tree);
110638fd1498Szrj extern void c_stddef_cpp_builtins (void);
110738fd1498Szrj extern void fe_file_change (const line_map_ordinary *);
110838fd1498Szrj extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char,
110938fd1498Szrj 			   rich_location *richloc);
111038fd1498Szrj 
111138fd1498Szrj /* In c-ppoutput.c  */
111238fd1498Szrj extern void init_pp_output (FILE *);
111338fd1498Szrj extern void preprocess_file (cpp_reader *);
111438fd1498Szrj extern void pp_file_change (const line_map_ordinary *);
111538fd1498Szrj extern void pp_dir_change (cpp_reader *, const char *);
111638fd1498Szrj extern bool check_missing_format_attribute (tree, tree);
111738fd1498Szrj 
111838fd1498Szrj /* In c-omp.c  */
111938fd1498Szrj typedef wide_int_bitmask omp_clause_mask;
112038fd1498Szrj 
112138fd1498Szrj #define OMP_CLAUSE_MASK_1 omp_clause_mask (1)
112238fd1498Szrj 
112338fd1498Szrj enum c_omp_clause_split
112438fd1498Szrj {
112538fd1498Szrj   C_OMP_CLAUSE_SPLIT_TARGET = 0,
112638fd1498Szrj   C_OMP_CLAUSE_SPLIT_TEAMS,
112738fd1498Szrj   C_OMP_CLAUSE_SPLIT_DISTRIBUTE,
112838fd1498Szrj   C_OMP_CLAUSE_SPLIT_PARALLEL,
112938fd1498Szrj   C_OMP_CLAUSE_SPLIT_FOR,
113038fd1498Szrj   C_OMP_CLAUSE_SPLIT_SIMD,
113138fd1498Szrj   C_OMP_CLAUSE_SPLIT_COUNT,
113238fd1498Szrj   C_OMP_CLAUSE_SPLIT_SECTIONS = C_OMP_CLAUSE_SPLIT_FOR,
113338fd1498Szrj   C_OMP_CLAUSE_SPLIT_TASKLOOP = C_OMP_CLAUSE_SPLIT_FOR
113438fd1498Szrj };
113538fd1498Szrj 
113638fd1498Szrj enum c_omp_region_type
113738fd1498Szrj {
113838fd1498Szrj   C_ORT_OMP			= 1 << 0,
113938fd1498Szrj   C_ORT_ACC			= 1 << 1,
114038fd1498Szrj   C_ORT_DECLARE_SIMD		= 1 << 2,
114138fd1498Szrj   C_ORT_OMP_DECLARE_SIMD	= C_ORT_OMP | C_ORT_DECLARE_SIMD
114238fd1498Szrj };
114338fd1498Szrj 
114438fd1498Szrj extern tree c_finish_omp_master (location_t, tree);
114538fd1498Szrj extern tree c_finish_omp_taskgroup (location_t, tree);
114638fd1498Szrj extern tree c_finish_omp_critical (location_t, tree, tree, tree);
114738fd1498Szrj extern tree c_finish_omp_ordered (location_t, tree, tree);
114838fd1498Szrj extern void c_finish_omp_barrier (location_t);
114938fd1498Szrj extern tree c_finish_omp_atomic (location_t, enum tree_code, enum tree_code,
115038fd1498Szrj 				 tree, tree, tree, tree, tree, bool, bool,
115138fd1498Szrj 				 bool = false);
115238fd1498Szrj extern void c_finish_omp_flush (location_t);
115338fd1498Szrj extern void c_finish_omp_taskwait (location_t);
115438fd1498Szrj extern void c_finish_omp_taskyield (location_t);
115538fd1498Szrj extern tree c_finish_omp_for (location_t, enum tree_code, tree, tree, tree,
115638fd1498Szrj 			      tree, tree, tree, tree);
115738fd1498Szrj extern bool c_omp_check_loop_iv (tree, tree, walk_tree_lh);
115838fd1498Szrj extern bool c_omp_check_loop_iv_exprs (location_t, tree, tree, tree, tree,
115938fd1498Szrj 				       walk_tree_lh);
116038fd1498Szrj extern tree c_finish_oacc_wait (location_t, tree, tree);
116138fd1498Szrj extern tree c_oacc_split_loop_clauses (tree, tree *, bool);
116238fd1498Szrj extern void c_omp_split_clauses (location_t, enum tree_code, omp_clause_mask,
116338fd1498Szrj 				 tree, tree *);
116438fd1498Szrj extern tree c_omp_declare_simd_clauses_to_numbers (tree, tree);
116538fd1498Szrj extern void c_omp_declare_simd_clauses_to_decls (tree, tree);
116638fd1498Szrj extern enum omp_clause_default_kind c_omp_predetermined_sharing (tree);
116738fd1498Szrj 
116838fd1498Szrj /* Return next tree in the chain for chain_next walking of tree nodes.  */
116938fd1498Szrj static inline tree
c_tree_chain_next(tree t)117038fd1498Szrj c_tree_chain_next (tree t)
117138fd1498Szrj {
117238fd1498Szrj   /* TREE_CHAIN of a type is TYPE_STUB_DECL, which is different
117338fd1498Szrj      kind of object, never a long chain of nodes.  Prefer
117438fd1498Szrj      TYPE_NEXT_VARIANT for types.  */
117538fd1498Szrj   if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_TYPE_COMMON))
117638fd1498Szrj     return TYPE_NEXT_VARIANT (t);
117738fd1498Szrj   /* Otherwise, if there is TREE_CHAIN, return it.  */
117838fd1498Szrj   if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_COMMON))
117938fd1498Szrj     return TREE_CHAIN (t);
118038fd1498Szrj   return NULL;
118138fd1498Szrj }
118238fd1498Szrj 
118338fd1498Szrj /* Mask used by tm_stmt_attr.  */
118438fd1498Szrj #define TM_STMT_ATTR_OUTER	2
118538fd1498Szrj #define TM_STMT_ATTR_ATOMIC	4
118638fd1498Szrj #define TM_STMT_ATTR_RELAXED	8
118738fd1498Szrj 
118838fd1498Szrj /* Mask used by tm_attr_to_mask and tm_mask_to_attr.  Note that these
118938fd1498Szrj    are ordered specifically such that more restrictive attributes are
119038fd1498Szrj    at lower bit positions.  This fact is known by the C++ tm attribute
119138fd1498Szrj    inheritance code such that least bit extraction (mask & -mask) results
119238fd1498Szrj    in the most restrictive attribute.  */
119338fd1498Szrj #define TM_ATTR_SAFE			1
119438fd1498Szrj #define TM_ATTR_CALLABLE		2
119538fd1498Szrj #define TM_ATTR_PURE			4
119638fd1498Szrj #define TM_ATTR_IRREVOCABLE		8
119738fd1498Szrj #define TM_ATTR_MAY_CANCEL_OUTER	16
119838fd1498Szrj 
119938fd1498Szrj /* A suffix-identifier value doublet that represents user-defined literals
120038fd1498Szrj    for C++-0x.  */
120138fd1498Szrj enum overflow_type {
120238fd1498Szrj   OT_UNDERFLOW = -1,
120338fd1498Szrj   OT_NONE,
120438fd1498Szrj   OT_OVERFLOW
120538fd1498Szrj };
120638fd1498Szrj 
120738fd1498Szrj struct GTY(()) tree_userdef_literal {
120838fd1498Szrj   struct tree_base base;
120938fd1498Szrj   tree suffix_id;
121038fd1498Szrj   tree value;
121138fd1498Szrj   tree num_string;
121238fd1498Szrj   enum overflow_type overflow;
121338fd1498Szrj };
121438fd1498Szrj 
121538fd1498Szrj #define USERDEF_LITERAL_SUFFIX_ID(NODE) \
121638fd1498Szrj   (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->suffix_id)
121738fd1498Szrj 
121838fd1498Szrj #define USERDEF_LITERAL_VALUE(NODE) \
121938fd1498Szrj   (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->value)
122038fd1498Szrj 
122138fd1498Szrj #define USERDEF_LITERAL_OVERFLOW(NODE) \
122238fd1498Szrj   (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->overflow)
122338fd1498Szrj 
122438fd1498Szrj #define USERDEF_LITERAL_NUM_STRING(NODE) \
122538fd1498Szrj   (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->num_string)
122638fd1498Szrj 
122738fd1498Szrj #define USERDEF_LITERAL_TYPE(NODE) \
122838fd1498Szrj   (TREE_TYPE (USERDEF_LITERAL_VALUE (NODE)))
122938fd1498Szrj 
123038fd1498Szrj extern tree build_userdef_literal (tree suffix_id, tree value,
123138fd1498Szrj 				   enum overflow_type overflow,
123238fd1498Szrj 				   tree num_string);
123338fd1498Szrj 
123438fd1498Szrj extern bool convert_vector_to_array_for_subscript (location_t, tree *, tree);
123538fd1498Szrj 
123638fd1498Szrj /* Possibe cases of scalar_to_vector conversion.  */
123738fd1498Szrj enum stv_conv {
123838fd1498Szrj   stv_error,        /* Error occurred.  */
123938fd1498Szrj   stv_nothing,      /* Nothing happened.  */
124038fd1498Szrj   stv_firstarg,     /* First argument must be expanded.  */
124138fd1498Szrj   stv_secondarg     /* Second argument must be expanded.  */
124238fd1498Szrj };
124338fd1498Szrj 
124438fd1498Szrj extern enum stv_conv scalar_to_vector (location_t loc, enum tree_code code,
124538fd1498Szrj 				       tree op0, tree op1, bool);
124638fd1498Szrj 
124738fd1498Szrj extern tree find_inv_trees (tree *, int *, void *);
124838fd1498Szrj extern tree replace_inv_trees (tree *, int *, void *);
124938fd1498Szrj 
125038fd1498Szrj extern bool reject_gcc_builtin (const_tree, location_t = UNKNOWN_LOCATION);
125138fd1498Szrj extern bool valid_array_size_p (location_t, tree, tree);
125238fd1498Szrj 
125338fd1498Szrj /* In c-warn.c.  */
125438fd1498Szrj extern void constant_expression_warning (tree);
125538fd1498Szrj extern void constant_expression_error (tree);
125638fd1498Szrj extern void overflow_warning (location_t, tree, tree = NULL_TREE);
125738fd1498Szrj extern void warn_logical_operator (location_t, enum tree_code, tree,
125838fd1498Szrj 				   enum tree_code, tree, enum tree_code, tree);
125938fd1498Szrj extern void warn_tautological_cmp (location_t, enum tree_code, tree, tree);
126038fd1498Szrj extern void warn_logical_not_parentheses (location_t, enum tree_code, tree,
126138fd1498Szrj 					  tree);
126238fd1498Szrj extern bool warn_if_unused_value (const_tree, location_t);
126338fd1498Szrj extern bool strict_aliasing_warning (location_t, tree, tree);
126438fd1498Szrj extern void sizeof_pointer_memaccess_warning (location_t *, tree,
126538fd1498Szrj 					      vec<tree, va_gc> *, tree *,
126638fd1498Szrj 					      bool (*) (tree, tree));
126738fd1498Szrj extern void check_main_parameter_types (tree decl);
126838fd1498Szrj extern void warnings_for_convert_and_check (location_t, tree, tree, tree);
126938fd1498Szrj extern void c_do_switch_warnings (splay_tree, location_t, tree, tree, bool,
127038fd1498Szrj 				  bool);
127138fd1498Szrj extern void warn_for_omitted_condop (location_t, tree);
127238fd1498Szrj extern bool warn_for_restrict (unsigned, tree *, unsigned);
127338fd1498Szrj 
127438fd1498Szrj /* Places where an lvalue, or modifiable lvalue, may be required.
127538fd1498Szrj    Used to select diagnostic messages in lvalue_error and
127638fd1498Szrj    readonly_error.  */
127738fd1498Szrj enum lvalue_use {
127838fd1498Szrj   lv_assign,
127938fd1498Szrj   lv_increment,
128038fd1498Szrj   lv_decrement,
128138fd1498Szrj   lv_addressof,
128238fd1498Szrj   lv_asm
128338fd1498Szrj };
128438fd1498Szrj 
128538fd1498Szrj extern void lvalue_error (location_t, enum lvalue_use);
128638fd1498Szrj extern void invalid_indirection_error (location_t, tree, ref_operator);
128738fd1498Szrj extern void readonly_error (location_t, tree, enum lvalue_use);
128838fd1498Szrj extern void warn_array_subscript_with_type_char (location_t, tree);
128938fd1498Szrj extern void warn_about_parentheses (location_t,
129038fd1498Szrj 				    enum tree_code,
129138fd1498Szrj 				    enum tree_code, tree,
129238fd1498Szrj 				    enum tree_code, tree);
129338fd1498Szrj extern void warn_for_unused_label (tree label);
129438fd1498Szrj extern void warn_for_div_by_zero (location_t, tree divisor);
129538fd1498Szrj extern void warn_for_memset (location_t, tree, tree, int);
129638fd1498Szrj extern void warn_for_sign_compare (location_t,
129738fd1498Szrj 				   tree orig_op0, tree orig_op1,
129838fd1498Szrj 				   tree op0, tree op1,
129938fd1498Szrj 				   tree result_type,
130038fd1498Szrj 				   enum tree_code resultcode);
130138fd1498Szrj extern void do_warn_double_promotion (tree, tree, tree, const char *,
130238fd1498Szrj 				      location_t);
130338fd1498Szrj extern void do_warn_unused_parameter (tree);
130438fd1498Szrj extern void record_locally_defined_typedef (tree);
130538fd1498Szrj extern void maybe_record_typedef_use (tree);
130638fd1498Szrj extern void maybe_warn_unused_local_typedefs (void);
130738fd1498Szrj extern void maybe_warn_bool_compare (location_t, enum tree_code, tree, tree);
130838fd1498Szrj extern bool maybe_warn_shift_overflow (location_t, tree, tree);
130938fd1498Szrj extern void warn_duplicated_cond_add_or_warn (location_t, tree, vec<tree> **);
131038fd1498Szrj extern bool diagnose_mismatched_attributes (tree, tree);
131138fd1498Szrj extern tree do_warn_duplicated_branches_r (tree *, int *, void *);
131238fd1498Szrj extern void warn_for_multistatement_macros (location_t, location_t,
131338fd1498Szrj 					    location_t, enum rid);
131438fd1498Szrj 
131538fd1498Szrj /* In c-attribs.c.  */
131638fd1498Szrj extern bool attribute_takes_identifier_p (const_tree);
131738fd1498Szrj extern tree handle_unused_attribute (tree *, tree, tree, int, bool *);
131838fd1498Szrj extern int parse_tm_stmt_attr (tree, int);
131938fd1498Szrj extern int tm_attr_to_mask (tree);
132038fd1498Szrj extern tree tm_mask_to_attr (int);
132138fd1498Szrj extern tree find_tm_attribute (tree);
132238fd1498Szrj 
132338fd1498Szrj extern enum flt_eval_method
132438fd1498Szrj excess_precision_mode_join (enum flt_eval_method, enum flt_eval_method);
132538fd1498Szrj 
132638fd1498Szrj extern int c_flt_eval_method (bool ts18661_p);
132738fd1498Szrj extern void add_no_sanitize_value (tree node, unsigned int flags);
132838fd1498Szrj 
132938fd1498Szrj extern void maybe_add_include_fixit (rich_location *, const char *);
133038fd1498Szrj extern void maybe_suggest_missing_token_insertion (rich_location *richloc,
133138fd1498Szrj 						   enum cpp_ttype token_type,
133238fd1498Szrj 						   location_t prev_token_loc);
133338fd1498Szrj 
133438fd1498Szrj #if CHECKING_P
133538fd1498Szrj namespace selftest {
133638fd1498Szrj   /* Declarations for specific families of tests within c-family,
133738fd1498Szrj      by source file, in alphabetical order.  */
133838fd1498Szrj   extern void c_format_c_tests (void);
133938fd1498Szrj   extern void c_pretty_print_c_tests (void);
134038fd1498Szrj   extern void c_spellcheck_cc_tests (void);
134138fd1498Szrj 
134238fd1498Szrj   /* The entrypoint for running all of the above tests.  */
134338fd1498Szrj   extern void c_family_tests (void);
134438fd1498Szrj } // namespace selftest
134538fd1498Szrj #endif /* #if CHECKING_P */
134638fd1498Szrj 
134738fd1498Szrj #endif /* ! GCC_C_COMMON_H */
1348