/* Definitions for CPP library. Copyright (C) 1995-2022 Free Software Foundation, Inc. Written by Per Bothner, 1994-95. This program is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation; either version 3, or (at your option) anylater version. This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details. You should have received a copy of the GNU General Public Licensealong with this program; see the file COPYING3. If not see<http://www.gnu.org/licenses/>. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */#ifndef LIBCPP_CPPLIB_H#define LIBCPP_CPPLIB_H #include <sys/types.h>#include "symtab.h"#include "line-map.h" typedef struct cpp_reader cpp_reader;typedef struct cpp_buffer cpp_buffer;typedef struct cpp_options cpp_options;typedef struct cpp_token cpp_token;typedef struct cpp_string cpp_string;typedef struct cpp_hashnode cpp_hashnode;typedef struct cpp_macro cpp_macro;typedef struct cpp_callbacks cpp_callbacks;typedef struct cpp_dir cpp_dir; struct _cpp_file; /* The first three groups, apart from '=', can appear in preprocessor expressions (+= and -= are used to indicate unary + and - resp.). This allows a lookup table to be implemented in _cpp_parse_expr. The first group, to CPP_LAST_EQ, can be immediately followed by an '='. The lexer needs operators ending in '=', like ">>=", to be in the same order as their counterparts without the '=', like ">>". See the cpp_operator table optab in expr.cc if you change the order or add or remove anything in the first group. */ #define TTYPE_TABLE \ OP(EQ, "=") \ OP(NOT, "!") \ OP(GREATER, ">") /* compare */ \ OP(LESS, "<") \ OP(PLUS, "+") /* math */ \ OP(MINUS, "-") \ OP(MULT, "*") \ OP(DIV, "/") \ OP(MOD, "%") \ OP(AND, "&") /* bit ops */ \ OP(OR, "|") \ OP(XOR, "^") \ OP(RSHIFT, ">>") \ OP(LSHIFT, "<<") \ \ OP(COMPL, "~") \ OP(AND_AND, "&&") /* logical */ \ OP(OR_OR, "||") \ OP(QUERY, "?") \ OP(COLON, ":") \ OP(COMMA, ",") /* grouping */ \ OP(OPEN_PAREN, "(") \ OP(CLOSE_PAREN, ")") \ TK(EOF, NONE) \ OP(EQ_EQ, "==") /* compare */ \ OP(NOT_EQ, "!=") \ OP(GREATER_EQ, ">=") \ OP(LESS_EQ, "<=") \ OP(SPACESHIP, "<=>") \ \ /* These two are unary + / - in preprocessor expressions. */ \ OP(PLUS_EQ, "+=") /* math */ \ OP(MINUS_EQ, "-=") \ \ OP(MULT_EQ, "*=") \ OP(DIV_EQ, "/=") \ OP(MOD_EQ, "%=") \ OP(AND_EQ, "&=") /* bit ops */ \ OP(OR_EQ, "|=") \ OP(XOR_EQ, "^=") \ OP(RSHIFT_EQ, ">>=") \ OP(LSHIFT_EQ, "<<=") \ /* Digraphs together, beginning with CPP_FIRST_DIGRAPH. */ \ OP(HASH, "#") /* digraphs */ \ OP(PASTE, "##") \ OP(OPEN_SQUARE, "[") \ OP(CLOSE_SQUARE, "]") \ OP(OPEN_BRACE, "{") \ OP(CLOSE_BRACE, "}") \ /* The remainder of the punctuation. Order is not significant. */ \ OP(SEMICOLON, ";") /* structure */ \ OP(ELLIPSIS, "...") \ OP(PLUS_PLUS, "++") /* increment */ \ OP(MINUS_MINUS, "--") \ OP(DEREF, "->") /* accessors */ \ OP(DOT, ".") \ OP(SCOPE, "::") \ OP(DEREF_STAR, "->*") \ OP(DOT_STAR, ".*") \ OP(ATSIGN, "@") /* used in Objective-C */ \ \ TK(NAME, IDENT) /* word */ \ TK(AT_NAME, IDENT) /* @word - Objective-C */ \ TK(NUMBER, LITERAL) /* 34_be+ta */ \ \ TK(CHAR, LITERAL) /* 'char' */ \ TK(WCHAR, LITERAL) /* L'char' */ \ TK(CHAR16, LITERAL) /* u'char' */ \ TK(CHAR32, LITERAL) /* U'char' */ \ TK(UTF8CHAR, LITERAL) /* u8'char' */ \ TK(OTHER, LITERAL) /* stray punctuation */ \ \ TK(STRING, LITERAL) /* "string" */ \ TK(WSTRING, LITERAL) /* L"string" */ \ TK(STRING16, LITERAL) /* u"string" */ \ TK(STRING32, LITERAL) /* U"string" */ \ TK(UTF8STRING, LITERAL) /* u8"string" */ \ TK(OBJC_STRING, LITERAL) /* @"string" - Objective-C */ \ TK(HEADER_NAME, LITERAL) /* <stdio.h> in #include */ \ \ TK(CHAR_USERDEF, LITERAL) /* 'char'_suffix - C++-0x */ \ TK(WCHAR_USERDEF, LITERAL) /* L'char'_suffix - C++-0x */ \ TK(CHAR16_USERDEF, LITERAL) /* u'char'_suffix - C++-0x */ \ TK(CHAR32_USERDEF, LITERAL) /* U'char'_suffix - C++-0x */ \ TK(UTF8CHAR_USERDEF, LITERAL) /* u8'char'_suffix - C++-0x */ \ TK(STRING_USERDEF, LITERAL) /* "string"_suffix - C++-0x */ \ TK(WSTRING_USERDEF, LITERAL) /* L"string"_suffix - C++-0x */ \ TK(STRING16_USERDEF, LITERAL) /* u"string"_suffix - C++-0x */ \ TK(STRING32_USERDEF, LITERAL) /* U"string"_suffix - C++-0x */ \ TK(UTF8STRING_USERDEF,LITERAL) /* u8"string"_suffix - C++-0x */ \ \ TK(COMMENT, LITERAL) /* Only if output comments. */ \ /* SPELL_LITERAL happens to DTRT. */ \ TK(MACRO_ARG, NONE) /* Macro argument. */ \ TK(PRAGMA, NONE) /* Only for deferred pragmas. */ \ TK(PRAGMA_EOL, NONE) /* End-of-line for deferred pragmas. */ \ TK(PADDING, NONE) /* Whitespace for -E. */ #define OP(e, s) CPP_ ## e,#define TK(e, s) CPP_ ## e,enum cpp_ttype{ TTYPE_TABLE N_TTYPES, /* A token type for keywords, as opposed to ordinary identifiers. */ CPP_KEYWORD, /* Positions in the table. */ CPP_LAST_EQ = CPP_LSHIFT, CPP_FIRST_DIGRAPH = CPP_HASH, CPP_LAST_PUNCTUATOR= CPP_ATSIGN, CPP_LAST_CPP_OP = CPP_LESS_EQ};#undef OP#undef TK /* C language kind, used when calling cpp_create_reader. */enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, CLK_GNUC17, CLK_GNUC2X, CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11, CLK_STDC17, CLK_STDC2X, CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17, CLK_GNUCXX20, CLK_CXX20, CLK_GNUCXX23, CLK_CXX23, CLK_ASM}; /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */struct GTY(()) cpp_string { unsigned int len; const unsigned char *text;}; /* Flags for the cpp_token structure. */#define PREV_WHITE (1 << 0) /* If whitespace before this token. */#define DIGRAPH (1 << 1) /* If it was a digraph. */#define STRINGIFY_ARG (1 << 2) /* If macro argument to be stringified. */#define PASTE_LEFT (1 << 3) /* If on LHS of a ## operator. */#define NAMED_OP (1 << 4) /* C++ named operators. */#define PREV_FALLTHROUGH (1 << 5) /* On a token preceeded by FALLTHROUGH comment. */#define BOL (1 << 6) /* Token at beginning of line. */#define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend, set in c-lex.cc. */#define SP_DIGRAPH (1 << 8) /* # or ## token was a digraph. */#define SP_PREV_WHITE (1 << 9) /* If whitespace before a ## operator, or before this token after a # operator. */#define NO_EXPAND (1 << 10) /* Do not macro-expand this token. */#define PRAGMA_OP (1 << 11) /* _Pragma token. */ /* Specify which field, if any, of the cpp_token union is used. */ enum cpp_token_fld_kind { CPP_TOKEN_FLD_NODE, CPP_TOKEN_FLD_SOURCE, CPP_TOKEN_FLD_STR, CPP_TOKEN_FLD_ARG_NO, CPP_TOKEN_FLD_TOKEN_NO, CPP_TOKEN_FLD_PRAGMA, CPP_TOKEN_FLD_NONE}; /* A macro argument in the cpp_token union. */struct GTY(()) cpp_macro_arg { /* Argument number. */ unsigned int arg_no; /* The original spelling of the macro argument token. */ cpp_hashnode * GTY ((nested_ptr (union tree_node, "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) spelling;}; /* An identifier in the cpp_token union. */struct GTY(()) cpp_identifier { /* The canonical (UTF-8) spelling of the identifier. */ cpp_hashnode * GTY ((nested_ptr (union tree_node, "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) node; /* The original spelling of the identifier. */ cpp_hashnode * GTY ((nested_ptr (union tree_node, "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) spelling;}; /* A preprocessing token. This has been carefully packed and should occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */struct GTY(()) cpp_token { /* Location of first char of token, together with range of full token. */ location_t src_loc; ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */ unsigned short flags; /* flags - see above */ union cpp_token_u { /* An identifier. */ struct cpp_identifier GTY ((tag ("CPP_TOKEN_FLD_NODE"))) node; /* Inherit padding from this token. */ cpp_token * GTY ((tag ("CPP_TOKEN_FLD_SOURCE"))) source; /* A string, or number. */ struct cpp_string GTY ((tag ("CPP_TOKEN_FLD_STR"))) str; /* Argument no. (and original spelling) for a CPP_MACRO_ARG. */ struct cpp_macro_arg GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) macro_arg; /* Original token no. for a CPP_PASTE (from a sequence of consecutive paste tokens in a macro expansion). */ unsigned int GTY ((tag ("CPP_TOKEN_FLD_TOKEN_NO"))) token_no; /* Caller-supplied identifier for a CPP_PRAGMA. */ unsigned int GTY ((tag ("CPP_TOKEN_FLD_PRAGMA"))) pragma; } GTY ((desc ("cpp_token_val_index (&%1)"))) val;}; /* Say which field is in use. */extern enum cpp_token_fld_kind cpp_token_val_index (const cpp_token *tok); /* A type wide enough to hold any multibyte source character. cpplib's character constant interpreter requires an unsigned type. Also, a typedef for the signed equivalent. The width of this type is capped at 32 bits; there do exist targets where wchar_t is 64 bits, but only in a non-default mode, and there would be no meaningful interpretation for a wchar_t value greater than 2^32 anyway -- the widest wide-character encoding around is ISO 10646, which stops at 2^31. */#if CHAR_BIT * SIZEOF_INT >= 32# define CPPCHAR_SIGNED_T int#elif CHAR_BIT * SIZEOF_LONG >= 32# define CPPCHAR_SIGNED_T long#else# error "Cannot find a least-32-bit signed integer type"#endiftypedef unsigned CPPCHAR_SIGNED_T cppchar_t;typedef CPPCHAR_SIGNED_T cppchar_signed_t; /* Style of header dependencies to generate. */enum cpp_deps_style { DEPS_NONE = 0, DEPS_USER, DEPS_SYSTEM }; /* The possible normalization levels, from most restrictive to least. */enum cpp_normalize_level { /* In NFKC. */ normalized_KC = 0, /* In NFC. */ normalized_C, /* In NFC, except for subsequences where being in NFC would make the identifier invalid. */ normalized_identifier_C, /* Not normalized at all. */ normalized_none}; enum cpp_main_search { CMS_none, /* A regular source file. */ CMS_header, /* Is a directly-specified header file (eg PCH or header-unit). */ CMS_user, /* Search the user INCLUDE path. */ CMS_system, /* Search the system INCLUDE path. */}; /* The possible bidirectional control characters checking levels. */enum cpp_bidirectional_level { /* No checking. */ bidirectional_none = 0, /* Only detect unpaired uses of bidirectional control characters. */ bidirectional_unpaired = 1, /* Detect any use of bidirectional control characters. */ bidirectional_any = 2, /* Also warn about UCNs. */ bidirectional_ucn = 4}; /* This structure is nested inside struct cpp_reader, and carries all the options visible to the command line. */struct cpp_options{ /* The language we're preprocessing. */ enum c_lang lang; /* Nonzero means use extra default include directories for C++. */ unsigned char cplusplus; /* Nonzero means handle cplusplus style comments. */ unsigned char cplusplus_comments; /* Nonzero means define __OBJC__, treat @ as a special token, use the OBJC[PLUS]_INCLUDE_PATH environment variable, and allow "#import". */ unsigned char objc; /* Nonzero means don't copy comments into the output file. */ unsigned char discard_comments; /* Nonzero means don't copy comments into the output file during macro expansion. */ unsigned char discard_comments_in_macro_exp; /* Nonzero means process the ISO trigraph sequences. */ unsigned char trigraphs; /* Nonzero means process the ISO digraph sequences. */ unsigned char digraphs; /* Nonzero means to allow hexadecimal floats and LL suffixes. */ unsigned char extended_numbers; /* Nonzero means process u/U prefix literals (UTF-16/32). */ unsigned char uliterals; /* Nonzero means process u8 prefixed character literals (UTF-8). */ unsigned char utf8_char_literals; /* Nonzero means process r/R raw strings. If this is set, uliterals must be set as well. */ unsigned char rliterals; /* Nonzero means print names of header files (-H). */ unsigned char print_include_names; /* Nonzero means complain about deprecated features. */ unsigned char cpp_warn_deprecated; /* Nonzero means warn if slash-star appears in a comment. */ unsigned char warn_comments; /* Nonzero means to warn about __DATA__, __TIME__ and __TIMESTAMP__ usage. */ unsigned char warn_date_time; /* Nonzero means warn if a user-supplied include directory does not exist. */ unsigned char warn_missing_include_dirs; /* Nonzero means warn if there are any trigraphs. */ unsigned char warn_trigraphs; /* Nonzero means warn about multicharacter charconsts. */ unsigned char warn_multichar; /* Nonzero means warn about various incompatibilities with traditional C. */ unsigned char cpp_warn_traditional; /* Nonzero means warn about long long numeric constants. */ unsigned char cpp_warn_long_long; /* Nonzero means warn about text after an #endif (or #else). */ unsigned char warn_endif_labels; /* Nonzero means warn about implicit sign changes owing to integer promotions. */ unsigned char warn_num_sign_change; /* Zero means don't warn about __VA_ARGS__ usage in c89 pedantic mode. Presumably the usage is protected by the appropriate #ifdef. */ unsigned char warn_variadic_macros; /* Nonzero means warn about builtin macros that are redefined or explicitly undefined. */ unsigned char warn_builtin_macro_redefined; /* Different -Wimplicit-fallthrough= levels. */ unsigned char cpp_warn_implicit_fallthrough; /* Nonzero means we should look for header.gcc files that remap file names. */ unsigned char remap; /* Zero means dollar signs are punctuation. */ unsigned char dollars_in_ident; /* Nonzero means UCNs are accepted in identifiers. */ unsigned char extended_identifiers; /* True if we should warn about dollars in identifiers or numbers for this translation unit. */ unsigned char warn_dollars; /* Nonzero means warn if undefined identifiers are evaluated in an #if. */ unsigned char warn_undef; /* Nonzero means warn if "defined" is encountered in a place other than an #if. */ unsigned char warn_expansion_to_defined; /* Nonzero means warn of unused macros from the main file. */ unsigned char warn_unused_macros; /* Nonzero for the 1999 C Standard, including corrigenda and amendments. */ unsigned char c99; /* Nonzero if we are conforming to a specific C or C++ standard. */ unsigned char std; /* Nonzero means give all the error messages the ANSI standard requires. */ unsigned char cpp_pedantic; /* Nonzero means we're looking at already preprocessed code, so don't bother trying to do macro expansion and whatnot. */ unsigned char preprocessed; /* Nonzero means we are going to emit debugging logs during preprocessing. */ unsigned char debug; /* Nonzero means we are tracking locations of tokens involved in macro expansion. 1 Means we track the location in degraded mode where we do not track locations of tokens resulting from the expansion of arguments of function-like macro. 2 Means we do track all macro expansions. This last option is the one that consumes the highest amount of memory. */ unsigned char track_macro_expansion; /* Nonzero means handle C++ alternate operator names. */ unsigned char operator_names; /* Nonzero means warn about use of C++ alternate operator names. */ unsigned char warn_cxx_operator_names; /* True for traditional preprocessing. */ unsigned char traditional; /* Nonzero for C++ 2011 Standard user-defined literals. */ unsigned char user_literals; /* Nonzero means warn when a string or character literal is followed by a ud-suffix which does not beging with an underscore. */ unsigned char warn_literal_suffix; /* Nonzero means interpret imaginary, fixed-point, or other gnu extension literal number suffixes as user-defined literal number suffixes. */ unsigned char ext_numeric_literals; /* Nonzero means extended identifiers allow the characters specified in C11. */ unsigned char c11_identifiers; /* Nonzero for C++ 2014 Standard binary constants. */ unsigned char binary_constants; Lines 1–500 of 1568. Load more
/* Definitions for CPP library. Copyright (C) 1995-2022 Free Software Foundation, Inc. Written by Per Bothner, 1994-95. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ #ifndef LIBCPP_CPPLIB_H #define LIBCPP_CPPLIB_H #include <sys/types.h> #include "symtab.h" #include "line-map.h" typedef struct cpp_reader cpp_reader; typedef struct cpp_buffer cpp_buffer; typedef struct cpp_options cpp_options; typedef struct cpp_token cpp_token; typedef struct cpp_string cpp_string; typedef struct cpp_hashnode cpp_hashnode; typedef struct cpp_macro cpp_macro; typedef struct cpp_callbacks cpp_callbacks; typedef struct cpp_dir cpp_dir; struct _cpp_file; /* The first three groups, apart from '=', can appear in preprocessor expressions (+= and -= are used to indicate unary + and - resp.). This allows a lookup table to be implemented in _cpp_parse_expr. The first group, to CPP_LAST_EQ, can be immediately followed by an '='. The lexer needs operators ending in '=', like ">>=", to be in the same order as their counterparts without the '=', like ">>". See the cpp_operator table optab in expr.cc if you change the order or add or remove anything in the first group. */ #define TTYPE_TABLE \ OP(EQ, "=") \ OP(NOT, "!") \ OP(GREATER, ">") /* compare */ \ OP(LESS, "<") \ OP(PLUS, "+") /* math */ \ OP(MINUS, "-") \ OP(MULT, "*") \ OP(DIV, "/") \ OP(MOD, "%") \ OP(AND, "&") /* bit ops */ \ OP(OR, "|") \ OP(XOR, "^") \ OP(RSHIFT, ">>") \ OP(LSHIFT, "<<") \ \ OP(COMPL, "~") \ OP(AND_AND, "&&") /* logical */ \ OP(OR_OR, "||") \ OP(QUERY, "?") \ OP(COLON, ":") \ OP(COMMA, ",") /* grouping */ \ OP(OPEN_PAREN, "(") \ OP(CLOSE_PAREN, ")") \ TK(EOF, NONE) \ OP(EQ_EQ, "==") /* compare */ \ OP(NOT_EQ, "!=") \ OP(GREATER_EQ, ">=") \ OP(LESS_EQ, "<=") \ OP(SPACESHIP, "<=>") \ \ /* These two are unary + / - in preprocessor expressions. */ \ OP(PLUS_EQ, "+=") /* math */ \ OP(MINUS_EQ, "-=") \ \ OP(MULT_EQ, "*=") \ OP(DIV_EQ, "/=") \ OP(MOD_EQ, "%=") \ OP(AND_EQ, "&=") /* bit ops */ \ OP(OR_EQ, "|=") \ OP(XOR_EQ, "^=") \ OP(RSHIFT_EQ, ">>=") \ OP(LSHIFT_EQ, "<<=") \ /* Digraphs together, beginning with CPP_FIRST_DIGRAPH. */ \ OP(HASH, "#") /* digraphs */ \ OP(PASTE, "##") \ OP(OPEN_SQUARE, "[") \ OP(CLOSE_SQUARE, "]") \ OP(OPEN_BRACE, "{") \ OP(CLOSE_BRACE, "}") \ /* The remainder of the punctuation. Order is not significant. */ \ OP(SEMICOLON, ";") /* structure */ \ OP(ELLIPSIS, "...") \ OP(PLUS_PLUS, "++") /* increment */ \ OP(MINUS_MINUS, "--") \ OP(DEREF, "->") /* accessors */ \ OP(DOT, ".") \ OP(SCOPE, "::") \ OP(DEREF_STAR, "->*") \ OP(DOT_STAR, ".*") \ OP(ATSIGN, "@") /* used in Objective-C */ \ \ TK(NAME, IDENT) /* word */ \ TK(AT_NAME, IDENT) /* @word - Objective-C */ \ TK(NUMBER, LITERAL) /* 34_be+ta */ \ \ TK(CHAR, LITERAL) /* 'char' */ \ TK(WCHAR, LITERAL) /* L'char' */ \ TK(CHAR16, LITERAL) /* u'char' */ \ TK(CHAR32, LITERAL) /* U'char' */ \ TK(UTF8CHAR, LITERAL) /* u8'char' */ \ TK(OTHER, LITERAL) /* stray punctuation */ \ \ TK(STRING, LITERAL) /* "string" */ \ TK(WSTRING, LITERAL) /* L"string" */ \ TK(STRING16, LITERAL) /* u"string" */ \ TK(STRING32, LITERAL) /* U"string" */ \ TK(UTF8STRING, LITERAL) /* u8"string" */ \ TK(OBJC_STRING, LITERAL) /* @"string" - Objective-C */ \ TK(HEADER_NAME, LITERAL) /* <stdio.h> in #include */ \ \ TK(CHAR_USERDEF, LITERAL) /* 'char'_suffix - C++-0x */ \ TK(WCHAR_USERDEF, LITERAL) /* L'char'_suffix - C++-0x */ \ TK(CHAR16_USERDEF, LITERAL) /* u'char'_suffix - C++-0x */ \ TK(CHAR32_USERDEF, LITERAL) /* U'char'_suffix - C++-0x */ \ TK(UTF8CHAR_USERDEF, LITERAL) /* u8'char'_suffix - C++-0x */ \ TK(STRING_USERDEF, LITERAL) /* "string"_suffix - C++-0x */ \ TK(WSTRING_USERDEF, LITERAL) /* L"string"_suffix - C++-0x */ \ TK(STRING16_USERDEF, LITERAL) /* u"string"_suffix - C++-0x */ \ TK(STRING32_USERDEF, LITERAL) /* U"string"_suffix - C++-0x */ \ TK(UTF8STRING_USERDEF,LITERAL) /* u8"string"_suffix - C++-0x */ \ \ TK(COMMENT, LITERAL) /* Only if output comments. */ \ /* SPELL_LITERAL happens to DTRT. */ \ TK(MACRO_ARG, NONE) /* Macro argument. */ \ TK(PRAGMA, NONE) /* Only for deferred pragmas. */ \ TK(PRAGMA_EOL, NONE) /* End-of-line for deferred pragmas. */ \ TK(PADDING, NONE) /* Whitespace for -E. */ #define OP(e, s) CPP_ ## e, #define TK(e, s) CPP_ ## e, enum cpp_ttype { TTYPE_TABLE N_TTYPES, /* A token type for keywords, as opposed to ordinary identifiers. */ CPP_KEYWORD, /* Positions in the table. */ CPP_LAST_EQ = CPP_LSHIFT, CPP_FIRST_DIGRAPH = CPP_HASH, CPP_LAST_PUNCTUATOR= CPP_ATSIGN, CPP_LAST_CPP_OP = CPP_LESS_EQ }; #undef OP #undef TK /* C language kind, used when calling cpp_create_reader. */ enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, CLK_GNUC17, CLK_GNUC2X, CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11, CLK_STDC17, CLK_STDC2X, CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17, CLK_GNUCXX20, CLK_CXX20, CLK_GNUCXX23, CLK_CXX23, CLK_ASM}; /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ struct GTY(()) cpp_string { unsigned int len; const unsigned char *text; }; /* Flags for the cpp_token structure. */ #define PREV_WHITE (1 << 0) /* If whitespace before this token. */ #define DIGRAPH (1 << 1) /* If it was a digraph. */ #define STRINGIFY_ARG (1 << 2) /* If macro argument to be stringified. */ #define PASTE_LEFT (1 << 3) /* If on LHS of a ## operator. */ #define NAMED_OP (1 << 4) /* C++ named operators. */ #define PREV_FALLTHROUGH (1 << 5) /* On a token preceeded by FALLTHROUGH comment. */ #define BOL (1 << 6) /* Token at beginning of line. */ #define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend, set in c-lex.cc. */ #define SP_DIGRAPH (1 << 8) /* # or ## token was a digraph. */ #define SP_PREV_WHITE (1 << 9) /* If whitespace before a ## operator, or before this token after a # operator. */ #define NO_EXPAND (1 << 10) /* Do not macro-expand this token. */ #define PRAGMA_OP (1 << 11) /* _Pragma token. */ /* Specify which field, if any, of the cpp_token union is used. */ enum cpp_token_fld_kind { CPP_TOKEN_FLD_NODE, CPP_TOKEN_FLD_SOURCE, CPP_TOKEN_FLD_STR, CPP_TOKEN_FLD_ARG_NO, CPP_TOKEN_FLD_TOKEN_NO, CPP_TOKEN_FLD_PRAGMA, CPP_TOKEN_FLD_NONE }; /* A macro argument in the cpp_token union. */ struct GTY(()) cpp_macro_arg { /* Argument number. */ unsigned int arg_no; /* The original spelling of the macro argument token. */ cpp_hashnode * GTY ((nested_ptr (union tree_node, "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) spelling; }; /* An identifier in the cpp_token union. */ struct GTY(()) cpp_identifier { /* The canonical (UTF-8) spelling of the identifier. */ cpp_hashnode * GTY ((nested_ptr (union tree_node, "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) node; /* The original spelling of the identifier. */ cpp_hashnode * GTY ((nested_ptr (union tree_node, "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) spelling; }; /* A preprocessing token. This has been carefully packed and should occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */ struct GTY(()) cpp_token { /* Location of first char of token, together with range of full token. */ location_t src_loc; ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */ unsigned short flags; /* flags - see above */ union cpp_token_u { /* An identifier. */ struct cpp_identifier GTY ((tag ("CPP_TOKEN_FLD_NODE"))) node; /* Inherit padding from this token. */ cpp_token * GTY ((tag ("CPP_TOKEN_FLD_SOURCE"))) source; /* A string, or number. */ struct cpp_string GTY ((tag ("CPP_TOKEN_FLD_STR"))) str; /* Argument no. (and original spelling) for a CPP_MACRO_ARG. */ struct cpp_macro_arg GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) macro_arg; /* Original token no. for a CPP_PASTE (from a sequence of consecutive paste tokens in a macro expansion). */ unsigned int GTY ((tag ("CPP_TOKEN_FLD_TOKEN_NO"))) token_no; /* Caller-supplied identifier for a CPP_PRAGMA. */ unsigned int GTY ((tag ("CPP_TOKEN_FLD_PRAGMA"))) pragma; } GTY ((desc ("cpp_token_val_index (&%1)"))) val; }; /* Say which field is in use. */ extern enum cpp_token_fld_kind cpp_token_val_index (const cpp_token *tok); /* A type wide enough to hold any multibyte source character. cpplib's character constant interpreter requires an unsigned type. Also, a typedef for the signed equivalent. The width of this type is capped at 32 bits; there do exist targets where wchar_t is 64 bits, but only in a non-default mode, and there would be no meaningful interpretation for a wchar_t value greater than 2^32 anyway -- the widest wide-character encoding around is ISO 10646, which stops at 2^31. */ #if CHAR_BIT * SIZEOF_INT >= 32 # define CPPCHAR_SIGNED_T int #elif CHAR_BIT * SIZEOF_LONG >= 32 # define CPPCHAR_SIGNED_T long #else # error "Cannot find a least-32-bit signed integer type" #endif typedef unsigned CPPCHAR_SIGNED_T cppchar_t; typedef CPPCHAR_SIGNED_T cppchar_signed_t; /* Style of header dependencies to generate. */ enum cpp_deps_style { DEPS_NONE = 0, DEPS_USER, DEPS_SYSTEM }; /* The possible normalization levels, from most restrictive to least. */ enum cpp_normalize_level { /* In NFKC. */ normalized_KC = 0, /* In NFC. */ normalized_C, /* In NFC, except for subsequences where being in NFC would make the identifier invalid. */ normalized_identifier_C, /* Not normalized at all. */ normalized_none }; enum cpp_main_search { CMS_none, /* A regular source file. */ CMS_header, /* Is a directly-specified header file (eg PCH or header-unit). */ CMS_user, /* Search the user INCLUDE path. */ CMS_system, /* Search the system INCLUDE path. */ }; /* The possible bidirectional control characters checking levels. */ enum cpp_bidirectional_level { /* No checking. */ bidirectional_none = 0, /* Only detect unpaired uses of bidirectional control characters. */ bidirectional_unpaired = 1, /* Detect any use of bidirectional control characters. */ bidirectional_any = 2, /* Also warn about UCNs. */ bidirectional_ucn = 4 }; /* This structure is nested inside struct cpp_reader, and carries all the options visible to the command line. */ struct cpp_options { /* The language we're preprocessing. */ enum c_lang lang; /* Nonzero means use extra default include directories for C++. */ unsigned char cplusplus; /* Nonzero means handle cplusplus style comments. */ unsigned char cplusplus_comments; /* Nonzero means define __OBJC__, treat @ as a special token, use the OBJC[PLUS]_INCLUDE_PATH environment variable, and allow "#import". */ unsigned char objc; /* Nonzero means don't copy comments into the output file. */ unsigned char discard_comments; /* Nonzero means don't copy comments into the output file during macro expansion. */ unsigned char discard_comments_in_macro_exp; /* Nonzero means process the ISO trigraph sequences. */ unsigned char trigraphs; /* Nonzero means process the ISO digraph sequences. */ unsigned char digraphs; /* Nonzero means to allow hexadecimal floats and LL suffixes. */ unsigned char extended_numbers; /* Nonzero means process u/U prefix literals (UTF-16/32). */ unsigned char uliterals; /* Nonzero means process u8 prefixed character literals (UTF-8). */ unsigned char utf8_char_literals; /* Nonzero means process r/R raw strings. If this is set, uliterals must be set as well. */ unsigned char rliterals; /* Nonzero means print names of header files (-H). */ unsigned char print_include_names; /* Nonzero means complain about deprecated features. */ unsigned char cpp_warn_deprecated; /* Nonzero means warn if slash-star appears in a comment. */ unsigned char warn_comments; /* Nonzero means to warn about __DATA__, __TIME__ and __TIMESTAMP__ usage. */ unsigned char warn_date_time; /* Nonzero means warn if a user-supplied include directory does not exist. */ unsigned char warn_missing_include_dirs; /* Nonzero means warn if there are any trigraphs. */ unsigned char warn_trigraphs; /* Nonzero means warn about multicharacter charconsts. */ unsigned char warn_multichar; /* Nonzero means warn about various incompatibilities with traditional C. */ unsigned char cpp_warn_traditional; /* Nonzero means warn about long long numeric constants. */ unsigned char cpp_warn_long_long; /* Nonzero means warn about text after an #endif (or #else). */ unsigned char warn_endif_labels; /* Nonzero means warn about implicit sign changes owing to integer promotions. */ unsigned char warn_num_sign_change; /* Zero means don't warn about __VA_ARGS__ usage in c89 pedantic mode. Presumably the usage is protected by the appropriate #ifdef. */ unsigned char warn_variadic_macros; /* Nonzero means warn about builtin macros that are redefined or explicitly undefined. */ unsigned char warn_builtin_macro_redefined; /* Different -Wimplicit-fallthrough= levels. */ unsigned char cpp_warn_implicit_fallthrough; /* Nonzero means we should look for header.gcc files that remap file names. */ unsigned char remap; /* Zero means dollar signs are punctuation. */ unsigned char dollars_in_ident; /* Nonzero means UCNs are accepted in identifiers. */ unsigned char extended_identifiers; /* True if we should warn about dollars in identifiers or numbers for this translation unit. */ unsigned char warn_dollars; /* Nonzero means warn if undefined identifiers are evaluated in an #if. */ unsigned char warn_undef; /* Nonzero means warn if "defined" is encountered in a place other than an #if. */ unsigned char warn_expansion_to_defined; /* Nonzero means warn of unused macros from the main file. */ unsigned char warn_unused_macros; /* Nonzero for the 1999 C Standard, including corrigenda and amendments. */ unsigned char c99; /* Nonzero if we are conforming to a specific C or C++ standard. */ unsigned char std; /* Nonzero means give all the error messages the ANSI standard requires. */ unsigned char cpp_pedantic; /* Nonzero means we're looking at already preprocessed code, so don't bother trying to do macro expansion and whatnot. */ unsigned char preprocessed; /* Nonzero means we are going to emit debugging logs during preprocessing. */ unsigned char debug; /* Nonzero means we are tracking locations of tokens involved in macro expansion. 1 Means we track the location in degraded mode where we do not track locations of tokens resulting from the expansion of arguments of function-like macro. 2 Means we do track all macro expansions. This last option is the one that consumes the highest amount of memory. */ unsigned char track_macro_expansion; /* Nonzero means handle C++ alternate operator names. */ unsigned char operator_names; /* Nonzero means warn about use of C++ alternate operator names. */ unsigned char warn_cxx_operator_names; /* True for traditional preprocessing. */ unsigned char traditional; /* Nonzero for C++ 2011 Standard user-defined literals. */ unsigned char user_literals; /* Nonzero means warn when a string or character literal is followed by a ud-suffix which does not beging with an underscore. */ unsigned char warn_literal_suffix; /* Nonzero means interpret imaginary, fixed-point, or other gnu extension literal number suffixes as user-defined literal number suffixes. */ unsigned char ext_numeric_literals; /* Nonzero means extended identifiers allow the characters specified in C11. */ unsigned char c11_identifiers; /* Nonzero for C++ 2014 Standard binary constants. */ unsigned char binary_constants;