1404b540aSrobert /* Definitions for CPP library. 2404b540aSrobert Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 3404b540aSrobert 2004, 2005 4404b540aSrobert Free Software Foundation, Inc. 5404b540aSrobert Written by Per Bothner, 1994-95. 6404b540aSrobert 7404b540aSrobert This program is free software; you can redistribute it and/or modify it 8404b540aSrobert under the terms of the GNU General Public License as published by the 9404b540aSrobert Free Software Foundation; either version 2, or (at your option) any 10404b540aSrobert later version. 11404b540aSrobert 12404b540aSrobert This program is distributed in the hope that it will be useful, 13404b540aSrobert but WITHOUT ANY WARRANTY; without even the implied warranty of 14404b540aSrobert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15404b540aSrobert GNU General Public License for more details. 16404b540aSrobert 17404b540aSrobert You should have received a copy of the GNU General Public License 18404b540aSrobert along with this program; if not, write to the Free Software 19404b540aSrobert Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20404b540aSrobert 21404b540aSrobert In other words, you are welcome to use, share and improve this program. 22404b540aSrobert You are forbidden to forbid anyone else to use, share and improve 23404b540aSrobert what you give them. Help stamp out software-hoarding! */ 24404b540aSrobert #ifndef LIBCPP_CPPLIB_H 25404b540aSrobert #define LIBCPP_CPPLIB_H 26404b540aSrobert 27404b540aSrobert #include <sys/types.h> 28404b540aSrobert #include "symtab.h" 29404b540aSrobert #include "line-map.h" 30404b540aSrobert 31404b540aSrobert #ifdef __cplusplus 32404b540aSrobert extern "C" { 33404b540aSrobert #endif 34404b540aSrobert 35404b540aSrobert typedef struct cpp_reader cpp_reader; 36404b540aSrobert typedef struct cpp_buffer cpp_buffer; 37404b540aSrobert typedef struct cpp_options cpp_options; 38404b540aSrobert typedef struct cpp_token cpp_token; 39404b540aSrobert typedef struct cpp_string cpp_string; 40404b540aSrobert typedef struct cpp_hashnode cpp_hashnode; 41404b540aSrobert typedef struct cpp_macro cpp_macro; 42404b540aSrobert typedef struct cpp_callbacks cpp_callbacks; 43404b540aSrobert typedef struct cpp_dir cpp_dir; 44404b540aSrobert 45404b540aSrobert struct answer; 46404b540aSrobert struct _cpp_file; 47404b540aSrobert 48404b540aSrobert /* The first three groups, apart from '=', can appear in preprocessor 49404b540aSrobert expressions (+= and -= are used to indicate unary + and - resp.). 50404b540aSrobert This allows a lookup table to be implemented in _cpp_parse_expr. 51404b540aSrobert 52404b540aSrobert The first group, to CPP_LAST_EQ, can be immediately followed by an 53404b540aSrobert '='. The lexer needs operators ending in '=', like ">>=", to be in 54404b540aSrobert the same order as their counterparts without the '=', like ">>". 55404b540aSrobert 56404b540aSrobert See the cpp_operator table optab in expr.c if you change the order or 57404b540aSrobert add or remove anything in the first group. */ 58404b540aSrobert 59404b540aSrobert #define TTYPE_TABLE \ 60404b540aSrobert OP(EQ, "=") \ 61404b540aSrobert OP(NOT, "!") \ 62404b540aSrobert OP(GREATER, ">") /* compare */ \ 63404b540aSrobert OP(LESS, "<") \ 64404b540aSrobert OP(PLUS, "+") /* math */ \ 65404b540aSrobert OP(MINUS, "-") \ 66404b540aSrobert OP(MULT, "*") \ 67404b540aSrobert OP(DIV, "/") \ 68404b540aSrobert OP(MOD, "%") \ 69404b540aSrobert OP(AND, "&") /* bit ops */ \ 70404b540aSrobert OP(OR, "|") \ 71404b540aSrobert OP(XOR, "^") \ 72404b540aSrobert OP(RSHIFT, ">>") \ 73404b540aSrobert OP(LSHIFT, "<<") \ 74404b540aSrobert \ 75404b540aSrobert OP(COMPL, "~") \ 76404b540aSrobert OP(AND_AND, "&&") /* logical */ \ 77404b540aSrobert OP(OR_OR, "||") \ 78404b540aSrobert OP(QUERY, "?") \ 79404b540aSrobert OP(COLON, ":") \ 80404b540aSrobert OP(COMMA, ",") /* grouping */ \ 81404b540aSrobert OP(OPEN_PAREN, "(") \ 82404b540aSrobert OP(CLOSE_PAREN, ")") \ 83404b540aSrobert TK(EOF, NONE) \ 84404b540aSrobert OP(EQ_EQ, "==") /* compare */ \ 85404b540aSrobert OP(NOT_EQ, "!=") \ 86404b540aSrobert OP(GREATER_EQ, ">=") \ 87404b540aSrobert OP(LESS_EQ, "<=") \ 88404b540aSrobert \ 89404b540aSrobert /* These two are unary + / - in preprocessor expressions. */ \ 90404b540aSrobert OP(PLUS_EQ, "+=") /* math */ \ 91404b540aSrobert OP(MINUS_EQ, "-=") \ 92404b540aSrobert \ 93404b540aSrobert OP(MULT_EQ, "*=") \ 94404b540aSrobert OP(DIV_EQ, "/=") \ 95404b540aSrobert OP(MOD_EQ, "%=") \ 96404b540aSrobert OP(AND_EQ, "&=") /* bit ops */ \ 97404b540aSrobert OP(OR_EQ, "|=") \ 98404b540aSrobert OP(XOR_EQ, "^=") \ 99404b540aSrobert OP(RSHIFT_EQ, ">>=") \ 100404b540aSrobert OP(LSHIFT_EQ, "<<=") \ 101404b540aSrobert /* Digraphs together, beginning with CPP_FIRST_DIGRAPH. */ \ 102404b540aSrobert OP(HASH, "#") /* digraphs */ \ 103404b540aSrobert OP(PASTE, "##") \ 104404b540aSrobert OP(OPEN_SQUARE, "[") \ 105404b540aSrobert OP(CLOSE_SQUARE, "]") \ 106404b540aSrobert OP(OPEN_BRACE, "{") \ 107404b540aSrobert OP(CLOSE_BRACE, "}") \ 108404b540aSrobert /* The remainder of the punctuation. Order is not significant. */ \ 109404b540aSrobert OP(SEMICOLON, ";") /* structure */ \ 110404b540aSrobert OP(ELLIPSIS, "...") \ 111404b540aSrobert OP(PLUS_PLUS, "++") /* increment */ \ 112404b540aSrobert OP(MINUS_MINUS, "--") \ 113404b540aSrobert OP(DEREF, "->") /* accessors */ \ 114404b540aSrobert OP(DOT, ".") \ 115404b540aSrobert OP(SCOPE, "::") \ 116404b540aSrobert OP(DEREF_STAR, "->*") \ 117404b540aSrobert OP(DOT_STAR, ".*") \ 118404b540aSrobert OP(ATSIGN, "@") /* used in Objective-C */ \ 119404b540aSrobert \ 120404b540aSrobert TK(NAME, IDENT) /* word */ \ 121404b540aSrobert TK(AT_NAME, IDENT) /* @word - Objective-C */ \ 122404b540aSrobert TK(NUMBER, LITERAL) /* 34_be+ta */ \ 123404b540aSrobert \ 124404b540aSrobert TK(CHAR, LITERAL) /* 'char' */ \ 125404b540aSrobert TK(WCHAR, LITERAL) /* L'char' */ \ 126404b540aSrobert TK(OTHER, LITERAL) /* stray punctuation */ \ 127404b540aSrobert \ 128404b540aSrobert TK(STRING, LITERAL) /* "string" */ \ 129404b540aSrobert TK(WSTRING, LITERAL) /* L"string" */ \ 130404b540aSrobert TK(OBJC_STRING, LITERAL) /* @"string" - Objective-C */ \ 131404b540aSrobert TK(HEADER_NAME, LITERAL) /* <stdio.h> in #include */ \ 132404b540aSrobert \ 133404b540aSrobert TK(COMMENT, LITERAL) /* Only if output comments. */ \ 134404b540aSrobert /* SPELL_LITERAL happens to DTRT. */ \ 135404b540aSrobert TK(MACRO_ARG, NONE) /* Macro argument. */ \ 136404b540aSrobert TK(PRAGMA, NONE) /* Only for deferred pragmas. */ \ 137404b540aSrobert TK(PRAGMA_EOL, NONE) /* End-of-line for deferred pragmas. */ \ 138404b540aSrobert TK(PADDING, NONE) /* Whitespace for -E. */ 139404b540aSrobert 140404b540aSrobert #define OP(e, s) CPP_ ## e, 141404b540aSrobert #define TK(e, s) CPP_ ## e, 142404b540aSrobert enum cpp_ttype 143404b540aSrobert { 144404b540aSrobert TTYPE_TABLE 145404b540aSrobert N_TTYPES, 146404b540aSrobert 147404b540aSrobert /* Positions in the table. */ 148404b540aSrobert CPP_LAST_EQ = CPP_LSHIFT, 149404b540aSrobert CPP_FIRST_DIGRAPH = CPP_HASH, 150404b540aSrobert CPP_LAST_PUNCTUATOR= CPP_ATSIGN, 151404b540aSrobert CPP_LAST_CPP_OP = CPP_LESS_EQ 152404b540aSrobert }; 153404b540aSrobert #undef OP 154404b540aSrobert #undef TK 155404b540aSrobert 156404b540aSrobert /* C language kind, used when calling cpp_create_reader. */ 157404b540aSrobert enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99, 158404b540aSrobert CLK_GNUCXX, CLK_CXX98, CLK_ASM}; 159404b540aSrobert 160404b540aSrobert /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ 161404b540aSrobert struct cpp_string GTY(()) 162404b540aSrobert { 163404b540aSrobert unsigned int len; 164404b540aSrobert const unsigned char *text; 165404b540aSrobert }; 166404b540aSrobert 167404b540aSrobert /* Flags for the cpp_token structure. */ 168404b540aSrobert #define PREV_WHITE (1 << 0) /* If whitespace before this token. */ 169404b540aSrobert #define DIGRAPH (1 << 1) /* If it was a digraph. */ 170404b540aSrobert #define STRINGIFY_ARG (1 << 2) /* If macro argument to be stringified. */ 171404b540aSrobert #define PASTE_LEFT (1 << 3) /* If on LHS of a ## operator. */ 172404b540aSrobert #define NAMED_OP (1 << 4) /* C++ named operators. */ 173404b540aSrobert #define NO_EXPAND (1 << 5) /* Do not macro-expand this token. */ 174404b540aSrobert #define BOL (1 << 6) /* Token at beginning of line. */ 175404b540aSrobert #define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend, 176404b540aSrobert set in c-lex.c. */ 177404b540aSrobert 178404b540aSrobert /* Specify which field, if any, of the cpp_token union is used. */ 179404b540aSrobert 180404b540aSrobert enum cpp_token_fld_kind { 181404b540aSrobert CPP_TOKEN_FLD_NODE, 182404b540aSrobert CPP_TOKEN_FLD_SOURCE, 183404b540aSrobert CPP_TOKEN_FLD_STR, 184404b540aSrobert CPP_TOKEN_FLD_ARG_NO, 185404b540aSrobert CPP_TOKEN_FLD_PRAGMA, 186404b540aSrobert CPP_TOKEN_FLD_NONE 187404b540aSrobert }; 188404b540aSrobert 189404b540aSrobert /* A preprocessing token. This has been carefully packed and should 190404b540aSrobert occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */ 191404b540aSrobert struct cpp_token GTY(()) 192404b540aSrobert { 193404b540aSrobert source_location src_loc; /* Location of first char of token. */ 194404b540aSrobert ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */ 195404b540aSrobert unsigned char flags; /* flags - see above */ 196404b540aSrobert 197404b540aSrobert union cpp_token_u 198404b540aSrobert { 199404b540aSrobert /* An identifier. */ 200404b540aSrobert cpp_hashnode * 201404b540aSrobert GTY ((nested_ptr (union tree_node, 202404b540aSrobert "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", 203404b540aSrobert "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"), 204404b540aSrobert tag ("CPP_TOKEN_FLD_NODE"))) 205404b540aSrobert node; 206404b540aSrobert 207404b540aSrobert /* Inherit padding from this token. */ 208404b540aSrobert cpp_token * GTY ((tag ("CPP_TOKEN_FLD_SOURCE"))) source; 209404b540aSrobert 210404b540aSrobert /* A string, or number. */ 211404b540aSrobert struct cpp_string GTY ((tag ("CPP_TOKEN_FLD_STR"))) str; 212404b540aSrobert 213404b540aSrobert /* Argument no. for a CPP_MACRO_ARG. */ 214404b540aSrobert unsigned int GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) arg_no; 215404b540aSrobert 216404b540aSrobert /* Caller-supplied identifier for a CPP_PRAGMA. */ 217404b540aSrobert unsigned int GTY ((tag ("CPP_TOKEN_FLD_PRAGMA"))) pragma; 218404b540aSrobert } GTY ((desc ("cpp_token_val_index (&%1)"))) val; 219404b540aSrobert }; 220404b540aSrobert 221404b540aSrobert /* Say which field is in use. */ 222404b540aSrobert extern enum cpp_token_fld_kind cpp_token_val_index (cpp_token *tok); 223404b540aSrobert 224404b540aSrobert /* A type wide enough to hold any multibyte source character. 225404b540aSrobert cpplib's character constant interpreter requires an unsigned type. 226404b540aSrobert Also, a typedef for the signed equivalent. 227404b540aSrobert The width of this type is capped at 32 bits; there do exist targets 228404b540aSrobert where wchar_t is 64 bits, but only in a non-default mode, and there 229404b540aSrobert would be no meaningful interpretation for a wchar_t value greater 230404b540aSrobert than 2^32 anyway -- the widest wide-character encoding around is 231404b540aSrobert ISO 10646, which stops at 2^31. */ 232404b540aSrobert #if CHAR_BIT * SIZEOF_INT >= 32 233404b540aSrobert # define CPPCHAR_SIGNED_T int 234404b540aSrobert #elif CHAR_BIT * SIZEOF_LONG >= 32 235404b540aSrobert # define CPPCHAR_SIGNED_T long 236404b540aSrobert #else 237404b540aSrobert # error "Cannot find a least-32-bit signed integer type" 238404b540aSrobert #endif 239404b540aSrobert typedef unsigned CPPCHAR_SIGNED_T cppchar_t; 240404b540aSrobert typedef CPPCHAR_SIGNED_T cppchar_signed_t; 241404b540aSrobert 242404b540aSrobert /* Style of header dependencies to generate. */ 243404b540aSrobert enum cpp_deps_style { DEPS_NONE = 0, DEPS_USER, DEPS_SYSTEM }; 244404b540aSrobert 245404b540aSrobert /* The possible normalization levels, from most restrictive to least. */ 246404b540aSrobert enum cpp_normalize_level { 247404b540aSrobert /* In NFKC. */ 248404b540aSrobert normalized_KC = 0, 249404b540aSrobert /* In NFC. */ 250404b540aSrobert normalized_C, 251404b540aSrobert /* In NFC, except for subsequences where being in NFC would make 252404b540aSrobert the identifier invalid. */ 253404b540aSrobert normalized_identifier_C, 254404b540aSrobert /* Not normalized at all. */ 255404b540aSrobert normalized_none 256404b540aSrobert }; 257404b540aSrobert 258404b540aSrobert /* This structure is nested inside struct cpp_reader, and 259404b540aSrobert carries all the options visible to the command line. */ 260404b540aSrobert struct cpp_options 261404b540aSrobert { 262404b540aSrobert /* Characters between tab stops. */ 263404b540aSrobert unsigned int tabstop; 264404b540aSrobert 265404b540aSrobert /* The language we're preprocessing. */ 266404b540aSrobert enum c_lang lang; 267404b540aSrobert 268404b540aSrobert /* Nonzero means use extra default include directories for C++. */ 269404b540aSrobert unsigned char cplusplus; 270404b540aSrobert 271404b540aSrobert /* Nonzero means handle cplusplus style comments. */ 272404b540aSrobert unsigned char cplusplus_comments; 273404b540aSrobert 274404b540aSrobert /* Nonzero means define __OBJC__, treat @ as a special token, and 275404b540aSrobert use the OBJC[PLUS]_INCLUDE_PATH environment variable. */ 276404b540aSrobert unsigned char objc; 277404b540aSrobert 278404b540aSrobert /* Nonzero means don't copy comments into the output file. */ 279404b540aSrobert unsigned char discard_comments; 280404b540aSrobert 281404b540aSrobert /* Nonzero means don't copy comments into the output file during 282404b540aSrobert macro expansion. */ 283404b540aSrobert unsigned char discard_comments_in_macro_exp; 284404b540aSrobert 285404b540aSrobert /* Nonzero means process the ISO trigraph sequences. */ 286404b540aSrobert unsigned char trigraphs; 287404b540aSrobert 288404b540aSrobert /* Nonzero means process the ISO digraph sequences. */ 289404b540aSrobert unsigned char digraphs; 290404b540aSrobert 291404b540aSrobert /* Nonzero means to allow hexadecimal floats and LL suffixes. */ 292404b540aSrobert unsigned char extended_numbers; 293404b540aSrobert 294404b540aSrobert /* Nonzero means print names of header files (-H). */ 295404b540aSrobert unsigned char print_include_names; 296404b540aSrobert 297404b540aSrobert /* Nonzero means cpp_pedwarn causes a hard error. */ 298404b540aSrobert unsigned char pedantic_errors; 299404b540aSrobert 300404b540aSrobert /* Nonzero means don't print warning messages. */ 301404b540aSrobert unsigned char inhibit_warnings; 302404b540aSrobert 303404b540aSrobert /* Nonzero means complain about deprecated features. */ 304404b540aSrobert unsigned char warn_deprecated; 305404b540aSrobert 306404b540aSrobert /* Nonzero means don't suppress warnings from system headers. */ 307404b540aSrobert unsigned char warn_system_headers; 308404b540aSrobert 309404b540aSrobert /* Nonzero means don't print error messages. Has no option to 310404b540aSrobert select it, but can be set by a user of cpplib (e.g. fix-header). */ 311404b540aSrobert unsigned char inhibit_errors; 312404b540aSrobert 313404b540aSrobert /* Nonzero means warn if slash-star appears in a comment. */ 314404b540aSrobert unsigned char warn_comments; 315404b540aSrobert 316404b540aSrobert /* Nonzero means warn if a user-supplied include directory does not 317404b540aSrobert exist. */ 318404b540aSrobert unsigned char warn_missing_include_dirs; 319404b540aSrobert 320404b540aSrobert /* Nonzero means warn if there are any trigraphs. */ 321404b540aSrobert unsigned char warn_trigraphs; 322404b540aSrobert 323404b540aSrobert /* Nonzero means warn about multicharacter charconsts. */ 324404b540aSrobert unsigned char warn_multichar; 325404b540aSrobert 326404b540aSrobert /* Nonzero means warn about various incompatibilities with 327404b540aSrobert traditional C. */ 328404b540aSrobert unsigned char warn_traditional; 329404b540aSrobert 330404b540aSrobert /* Nonzero means warn about long long numeric constants. */ 331404b540aSrobert unsigned char warn_long_long; 332404b540aSrobert 333404b540aSrobert /* Nonzero means warn about text after an #endif (or #else). */ 334404b540aSrobert unsigned char warn_endif_labels; 335404b540aSrobert 336404b540aSrobert /* Nonzero means warn about implicit sign changes owing to integer 337404b540aSrobert promotions. */ 338404b540aSrobert unsigned char warn_num_sign_change; 339404b540aSrobert 340404b540aSrobert /* Zero means don't warn about __VA_ARGS__ usage in c89 pedantic mode. 341404b540aSrobert Presumably the usage is protected by the appropriate #ifdef. */ 342404b540aSrobert unsigned char warn_variadic_macros; 343404b540aSrobert 344404b540aSrobert /* Nonzero means turn warnings into errors. */ 345404b540aSrobert unsigned char warnings_are_errors; 346404b540aSrobert 347404b540aSrobert /* Nonzero means we should look for header.gcc files that remap file 348404b540aSrobert names. */ 349404b540aSrobert unsigned char remap; 350404b540aSrobert 351404b540aSrobert /* Zero means dollar signs are punctuation. */ 352404b540aSrobert unsigned char dollars_in_ident; 353404b540aSrobert 354404b540aSrobert /* Nonzero means UCNs are accepted in identifiers. */ 355404b540aSrobert unsigned char extended_identifiers; 356404b540aSrobert 357404b540aSrobert /* True if we should warn about dollars in identifiers or numbers 358404b540aSrobert for this translation unit. */ 359404b540aSrobert unsigned char warn_dollars; 360404b540aSrobert 361404b540aSrobert /* Nonzero means warn if undefined identifiers are evaluated in an #if. */ 362404b540aSrobert unsigned char warn_undef; 363404b540aSrobert 364404b540aSrobert /* Nonzero means warn of unused macros from the main file. */ 365404b540aSrobert unsigned char warn_unused_macros; 366404b540aSrobert 367404b540aSrobert /* Nonzero for the 1999 C Standard, including corrigenda and amendments. */ 368404b540aSrobert unsigned char c99; 369404b540aSrobert 370404b540aSrobert /* Nonzero if we are conforming to a specific C or C++ standard. */ 371404b540aSrobert unsigned char std; 372404b540aSrobert 373404b540aSrobert /* Nonzero means give all the error messages the ANSI standard requires. */ 374404b540aSrobert unsigned char pedantic; 375404b540aSrobert 376404b540aSrobert /* Nonzero means we're looking at already preprocessed code, so don't 377404b540aSrobert bother trying to do macro expansion and whatnot. */ 378404b540aSrobert unsigned char preprocessed; 379404b540aSrobert 380404b540aSrobert /* Print column number in error messages. */ 381404b540aSrobert unsigned char show_column; 382404b540aSrobert 383404b540aSrobert /* Nonzero means handle C++ alternate operator names. */ 384404b540aSrobert unsigned char operator_names; 385404b540aSrobert 386404b540aSrobert /* True for traditional preprocessing. */ 387404b540aSrobert unsigned char traditional; 388404b540aSrobert 389404b540aSrobert /* Holds the name of the target (execution) character set. */ 390404b540aSrobert const char *narrow_charset; 391404b540aSrobert 392404b540aSrobert /* Holds the name of the target wide character set. */ 393404b540aSrobert const char *wide_charset; 394404b540aSrobert 395404b540aSrobert /* Holds the name of the input character set. */ 396404b540aSrobert const char *input_charset; 397404b540aSrobert 398404b540aSrobert /* The minimum permitted level of normalization before a warning 399404b540aSrobert is generated. */ 400404b540aSrobert enum cpp_normalize_level warn_normalize; 401404b540aSrobert 402404b540aSrobert /* True to warn about precompiled header files we couldn't use. */ 403404b540aSrobert bool warn_invalid_pch; 404404b540aSrobert 405404b540aSrobert /* True if dependencies should be restored from a precompiled header. */ 406404b540aSrobert bool restore_pch_deps; 407404b540aSrobert 408404b540aSrobert /* Dependency generation. */ 409404b540aSrobert struct 410404b540aSrobert { 411404b540aSrobert /* Style of header dependencies to generate. */ 412404b540aSrobert enum cpp_deps_style style; 413404b540aSrobert 414404b540aSrobert /* Assume missing files are generated files. */ 415404b540aSrobert bool missing_files; 416404b540aSrobert 417404b540aSrobert /* Generate phony targets for each dependency apart from the first 418404b540aSrobert one. */ 419404b540aSrobert bool phony_targets; 420404b540aSrobert 421404b540aSrobert /* If true, no dependency is generated on the main file. */ 422404b540aSrobert bool ignore_main_file; 423404b540aSrobert } deps; 424404b540aSrobert 425404b540aSrobert /* Target-specific features set by the front end or client. */ 426404b540aSrobert 427404b540aSrobert /* Precision for target CPP arithmetic, target characters, target 428404b540aSrobert ints and target wide characters, respectively. */ 429404b540aSrobert size_t precision, char_precision, int_precision, wchar_precision; 430404b540aSrobert 431404b540aSrobert /* True means chars (wide chars) are unsigned. */ 432404b540aSrobert bool unsigned_char, unsigned_wchar; 433404b540aSrobert 434404b540aSrobert /* True if the most significant byte in a word has the lowest 435404b540aSrobert address in memory. */ 436404b540aSrobert bool bytes_big_endian; 437404b540aSrobert 438404b540aSrobert /* Nonzero means __STDC__ should have the value 0 in system headers. */ 439404b540aSrobert unsigned char stdc_0_in_system_headers; 440404b540aSrobert 441404b540aSrobert /* True means error callback should be used for diagnostics. */ 442404b540aSrobert bool client_diagnostic; 443404b540aSrobert }; 444404b540aSrobert 445404b540aSrobert /* Callback for header lookup for HEADER, which is the name of a 446404b540aSrobert source file. It is used as a method of last resort to find headers 447404b540aSrobert that are not otherwise found during the normal include processing. 448404b540aSrobert The return value is the malloced name of a header to try and open, 449404b540aSrobert if any, or NULL otherwise. This callback is called only if the 450404b540aSrobert header is otherwise unfound. */ 451404b540aSrobert typedef const char *(*missing_header_cb)(cpp_reader *, const char *header, cpp_dir **); 452404b540aSrobert 453404b540aSrobert /* Call backs to cpplib client. */ 454404b540aSrobert struct cpp_callbacks 455404b540aSrobert { 456404b540aSrobert /* Called when a new line of preprocessed output is started. */ 457404b540aSrobert void (*line_change) (cpp_reader *, const cpp_token *, int); 458404b540aSrobert 459404b540aSrobert /* Called when switching to/from a new file. 460404b540aSrobert The line_map is for the new file. It is NULL if there is no new file. 461404b540aSrobert (In C this happens when done with <built-in>+<command line> and also 462404b540aSrobert when done with a main file.) This can be used for resource cleanup. */ 463404b540aSrobert void (*file_change) (cpp_reader *, const struct line_map *); 464404b540aSrobert 465404b540aSrobert void (*dir_change) (cpp_reader *, const char *); 466404b540aSrobert void (*include) (cpp_reader *, unsigned int, const unsigned char *, 467404b540aSrobert const char *, int, const cpp_token **); 468404b540aSrobert void (*define) (cpp_reader *, unsigned int, cpp_hashnode *); 469404b540aSrobert void (*undef) (cpp_reader *, unsigned int, cpp_hashnode *); 470404b540aSrobert void (*ident) (cpp_reader *, unsigned int, const cpp_string *); 471404b540aSrobert void (*def_pragma) (cpp_reader *, unsigned int); 472404b540aSrobert int (*valid_pch) (cpp_reader *, const char *, int); 473404b540aSrobert void (*read_pch) (cpp_reader *, const char *, int, const char *); 474404b540aSrobert missing_header_cb missing_header; 475404b540aSrobert 476404b540aSrobert /* Called to emit a diagnostic if client_diagnostic option is true. 477404b540aSrobert This callback receives the translated message. */ 478404b540aSrobert void (*error) (cpp_reader *, int, const char *, va_list *) 479404b540aSrobert ATTRIBUTE_FPTR_PRINTF(3,0); 480404b540aSrobert }; 481404b540aSrobert 482404b540aSrobert /* Chain of directories to look for include files in. */ 483404b540aSrobert struct cpp_dir 484404b540aSrobert { 485404b540aSrobert /* NULL-terminated singly-linked list. */ 486404b540aSrobert struct cpp_dir *next; 487404b540aSrobert 488404b540aSrobert /* NAME of the directory, NUL-terminated. */ 489404b540aSrobert char *name; 490404b540aSrobert unsigned int len; 491404b540aSrobert 492404b540aSrobert /* One if a system header, two if a system header that has extern 493404b540aSrobert "C" guards for C++. */ 494404b540aSrobert unsigned char sysp; 495404b540aSrobert 496404b540aSrobert /* Mapping of file names for this directory for MS-DOS and related 497404b540aSrobert platforms. A NULL-terminated array of (from, to) pairs. */ 498404b540aSrobert const char **name_map; 499404b540aSrobert 500404b540aSrobert /* Routine to construct pathname, given the search path name and the 501404b540aSrobert HEADER we are trying to find, return a constructed pathname to 502404b540aSrobert try and open. If this is NULL, the constructed pathname is as 503404b540aSrobert constructed by append_file_to_dir. */ 504404b540aSrobert char *(*construct) (const char *header, cpp_dir *dir); 505404b540aSrobert 506404b540aSrobert /* The C front end uses these to recognize duplicated 507404b540aSrobert directories in the search path. */ 508404b540aSrobert ino_t ino; 509404b540aSrobert dev_t dev; 510404b540aSrobert 511404b540aSrobert /* Is this a user-supplied directory? */ 512404b540aSrobert bool user_supplied_p; 513404b540aSrobert }; 514404b540aSrobert 515404b540aSrobert /* Name under which this program was invoked. */ 516404b540aSrobert extern const char *progname; 517404b540aSrobert 518404b540aSrobert /* The structure of a node in the hash table. The hash table has 519404b540aSrobert entries for all identifiers: either macros defined by #define 520404b540aSrobert commands (type NT_MACRO), assertions created with #assert 521404b540aSrobert (NT_ASSERTION), or neither of the above (NT_VOID). Builtin macros 522404b540aSrobert like __LINE__ are flagged NODE_BUILTIN. Poisoned identifiers are 523404b540aSrobert flagged NODE_POISONED. NODE_OPERATOR (C++ only) indicates an 524404b540aSrobert identifier that behaves like an operator such as "xor". 525404b540aSrobert NODE_DIAGNOSTIC is for speed in lex_token: it indicates a 526404b540aSrobert diagnostic may be required for this node. Currently this only 527404b540aSrobert applies to __VA_ARGS__ and poisoned identifiers. */ 528404b540aSrobert 529404b540aSrobert /* Hash node flags. */ 530404b540aSrobert #define NODE_OPERATOR (1 << 0) /* C++ named operator. */ 531404b540aSrobert #define NODE_POISONED (1 << 1) /* Poisoned identifier. */ 532404b540aSrobert #define NODE_BUILTIN (1 << 2) /* Builtin macro. */ 533404b540aSrobert #define NODE_DIAGNOSTIC (1 << 3) /* Possible diagnostic when lexed. */ 534404b540aSrobert #define NODE_WARN (1 << 4) /* Warn if redefined or undefined. */ 535404b540aSrobert #define NODE_DISABLED (1 << 5) /* A disabled macro. */ 536404b540aSrobert #define NODE_MACRO_ARG (1 << 6) /* Used during #define processing. */ 537404b540aSrobert 538404b540aSrobert /* Different flavors of hash node. */ 539404b540aSrobert enum node_type 540404b540aSrobert { 541404b540aSrobert NT_VOID = 0, /* No definition yet. */ 542404b540aSrobert NT_MACRO, /* A macro of some form. */ 543404b540aSrobert NT_ASSERTION /* Predicate for #assert. */ 544404b540aSrobert }; 545404b540aSrobert 546404b540aSrobert /* Different flavors of builtin macro. _Pragma is an operator, but we 547404b540aSrobert handle it with the builtin code for efficiency reasons. */ 548404b540aSrobert enum builtin_type 549404b540aSrobert { 550404b540aSrobert BT_SPECLINE = 0, /* `__LINE__' */ 551404b540aSrobert BT_DATE, /* `__DATE__' */ 552404b540aSrobert BT_FILE, /* `__FILE__' */ 553404b540aSrobert BT_BASE_FILE, /* `__BASE_FILE__' */ 554404b540aSrobert BT_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */ 555404b540aSrobert BT_TIME, /* `__TIME__' */ 556404b540aSrobert BT_STDC, /* `__STDC__' */ 557404b540aSrobert BT_PRAGMA, /* `_Pragma' operator */ 558404b540aSrobert BT_TIMESTAMP /* `__TIMESTAMP__' */ 559404b540aSrobert }; 560404b540aSrobert 561404b540aSrobert #define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE)) 562404b540aSrobert #define HT_NODE(NODE) ((ht_identifier *) (NODE)) 563404b540aSrobert #define NODE_LEN(NODE) HT_LEN (&(NODE)->ident) 564404b540aSrobert #define NODE_NAME(NODE) HT_STR (&(NODE)->ident) 565404b540aSrobert 566404b540aSrobert /* Specify which field, if any, of the union is used. */ 567404b540aSrobert 568404b540aSrobert enum { 569404b540aSrobert NTV_MACRO, 570404b540aSrobert NTV_ANSWER, 571404b540aSrobert NTV_BUILTIN, 572404b540aSrobert NTV_ARGUMENT, 573404b540aSrobert NTV_NONE 574404b540aSrobert }; 575404b540aSrobert 576404b540aSrobert #define CPP_HASHNODE_VALUE_IDX(HNODE) \ 577404b540aSrobert ((HNODE.flags & NODE_MACRO_ARG) ? NTV_ARGUMENT \ 578404b540aSrobert : HNODE.type == NT_MACRO ? ((HNODE.flags & NODE_BUILTIN) \ 579404b540aSrobert ? NTV_BUILTIN : NTV_MACRO) \ 580404b540aSrobert : HNODE.type == NT_ASSERTION ? NTV_ANSWER \ 581404b540aSrobert : NTV_NONE) 582404b540aSrobert 583404b540aSrobert /* The common part of an identifier node shared amongst all 3 C front 584404b540aSrobert ends. Also used to store CPP identifiers, which are a superset of 585404b540aSrobert identifiers in the grammatical sense. */ 586404b540aSrobert 587404b540aSrobert union _cpp_hashnode_value GTY(()) 588404b540aSrobert { 589404b540aSrobert /* If a macro. */ 590404b540aSrobert cpp_macro * GTY((tag ("NTV_MACRO"))) macro; 591404b540aSrobert /* Answers to an assertion. */ 592404b540aSrobert struct answer * GTY ((tag ("NTV_ANSWER"))) answers; 593404b540aSrobert /* Code for a builtin macro. */ 594404b540aSrobert enum builtin_type GTY ((tag ("NTV_BUILTIN"))) builtin; 595404b540aSrobert /* Macro argument index. */ 596404b540aSrobert unsigned short GTY ((tag ("NTV_ARGUMENT"))) arg_index; 597404b540aSrobert }; 598404b540aSrobert 599404b540aSrobert struct cpp_hashnode GTY(()) 600404b540aSrobert { 601404b540aSrobert struct ht_identifier ident; 602404b540aSrobert unsigned int is_directive : 1; 603404b540aSrobert unsigned int directive_index : 7; /* If is_directive, 604404b540aSrobert then index into directive table. 605404b540aSrobert Otherwise, a NODE_OPERATOR. */ 606404b540aSrobert unsigned char rid_code; /* Rid code - for front ends. */ 607404b540aSrobert ENUM_BITFIELD(node_type) type : 8; /* CPP node type. */ 608404b540aSrobert unsigned char flags; /* CPP flags. */ 609404b540aSrobert 610404b540aSrobert union _cpp_hashnode_value GTY ((desc ("CPP_HASHNODE_VALUE_IDX (%1)"))) value; 611404b540aSrobert }; 612404b540aSrobert 613404b540aSrobert /* Call this first to get a handle to pass to other functions. 614404b540aSrobert 615404b540aSrobert If you want cpplib to manage its own hashtable, pass in a NULL 616404b540aSrobert pointer. Otherwise you should pass in an initialized hash table 617404b540aSrobert that cpplib will share; this technique is used by the C front 618404b540aSrobert ends. */ 619404b540aSrobert extern cpp_reader *cpp_create_reader (enum c_lang, struct ht *, 620404b540aSrobert struct line_maps *); 621404b540aSrobert 622404b540aSrobert /* Call this to change the selected language standard (e.g. because of 623404b540aSrobert command line options). */ 624404b540aSrobert extern void cpp_set_lang (cpp_reader *, enum c_lang); 625404b540aSrobert 626404b540aSrobert /* Set the include paths. */ 627404b540aSrobert extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int); 628404b540aSrobert 629404b540aSrobert /* Call these to get pointers to the options, callback, and deps 630404b540aSrobert structures for a given reader. These pointers are good until you 631404b540aSrobert call cpp_finish on that reader. You can either edit the callbacks 632404b540aSrobert through the pointer returned from cpp_get_callbacks, or set them 633404b540aSrobert with cpp_set_callbacks. */ 634404b540aSrobert extern cpp_options *cpp_get_options (cpp_reader *); 635404b540aSrobert extern cpp_callbacks *cpp_get_callbacks (cpp_reader *); 636404b540aSrobert extern void cpp_set_callbacks (cpp_reader *, cpp_callbacks *); 637404b540aSrobert extern struct deps *cpp_get_deps (cpp_reader *); 638404b540aSrobert 639404b540aSrobert /* This function reads the file, but does not start preprocessing. It 640404b540aSrobert returns the name of the original file; this is the same as the 641404b540aSrobert input file, except for preprocessed input. This will generate at 642404b540aSrobert least one file change callback, and possibly a line change callback 643404b540aSrobert too. If there was an error opening the file, it returns NULL. */ 644404b540aSrobert extern const char *cpp_read_main_file (cpp_reader *, const char *); 645404b540aSrobert 646404b540aSrobert /* Set up built-ins like __FILE__. */ 647404b540aSrobert extern void cpp_init_builtins (cpp_reader *, int); 648404b540aSrobert 649404b540aSrobert /* This is called after options have been parsed, and partially 650404b540aSrobert processed. */ 651404b540aSrobert extern void cpp_post_options (cpp_reader *); 652404b540aSrobert 653404b540aSrobert /* Set up translation to the target character set. */ 654404b540aSrobert extern void cpp_init_iconv (cpp_reader *); 655404b540aSrobert 656404b540aSrobert /* Call this to finish preprocessing. If you requested dependency 657404b540aSrobert generation, pass an open stream to write the information to, 658404b540aSrobert otherwise NULL. It is your responsibility to close the stream. 659404b540aSrobert 660404b540aSrobert Returns cpp_errors (pfile). */ 661404b540aSrobert extern int cpp_finish (cpp_reader *, FILE *deps_stream); 662404b540aSrobert 663404b540aSrobert /* Call this to release the handle at the end of preprocessing. Any 664404b540aSrobert use of the handle after this function returns is invalid. Returns 665404b540aSrobert cpp_errors (pfile). */ 666404b540aSrobert extern void cpp_destroy (cpp_reader *); 667404b540aSrobert 668404b540aSrobert /* Error count. */ 669404b540aSrobert extern unsigned int cpp_errors (cpp_reader *); 670404b540aSrobert 671404b540aSrobert extern unsigned int cpp_token_len (const cpp_token *); 672404b540aSrobert extern unsigned char *cpp_token_as_text (cpp_reader *, const cpp_token *); 673404b540aSrobert extern unsigned char *cpp_spell_token (cpp_reader *, const cpp_token *, 674404b540aSrobert unsigned char *, bool); 675404b540aSrobert extern void cpp_register_pragma (cpp_reader *, const char *, const char *, 676404b540aSrobert void (*) (cpp_reader *), bool); 677404b540aSrobert extern void cpp_register_deferred_pragma (cpp_reader *, const char *, 678404b540aSrobert const char *, unsigned, bool, bool); 679404b540aSrobert extern int cpp_avoid_paste (cpp_reader *, const cpp_token *, 680404b540aSrobert const cpp_token *); 681404b540aSrobert extern const cpp_token *cpp_get_token (cpp_reader *); 682404b540aSrobert extern const unsigned char *cpp_macro_definition (cpp_reader *, 683404b540aSrobert const cpp_hashnode *); 684404b540aSrobert extern void _cpp_backup_tokens (cpp_reader *, unsigned int); 685404b540aSrobert 686404b540aSrobert /* Evaluate a CPP_CHAR or CPP_WCHAR token. */ 687404b540aSrobert extern cppchar_t cpp_interpret_charconst (cpp_reader *, const cpp_token *, 688404b540aSrobert unsigned int *, int *); 689404b540aSrobert /* Evaluate a vector of CPP_STRING or CPP_WSTRING tokens. */ 690404b540aSrobert extern bool cpp_interpret_string (cpp_reader *, 691404b540aSrobert const cpp_string *, size_t, 692404b540aSrobert cpp_string *, bool); 693404b540aSrobert extern bool cpp_interpret_string_notranslate (cpp_reader *, 694404b540aSrobert const cpp_string *, size_t, 695404b540aSrobert cpp_string *, bool); 696404b540aSrobert 697404b540aSrobert /* Convert a host character constant to the execution character set. */ 698404b540aSrobert extern cppchar_t cpp_host_to_exec_charset (cpp_reader *, cppchar_t); 699404b540aSrobert 700404b540aSrobert /* Used to register macros and assertions, perhaps from the command line. 701404b540aSrobert The text is the same as the command line argument. */ 702404b540aSrobert extern void cpp_define (cpp_reader *, const char *); 703404b540aSrobert extern void cpp_assert (cpp_reader *, const char *); 704404b540aSrobert extern void cpp_undef (cpp_reader *, const char *); 705404b540aSrobert extern void cpp_unassert (cpp_reader *, const char *); 706404b540aSrobert 707404b540aSrobert /* Undefine all macros and assertions. */ 708404b540aSrobert extern void cpp_undef_all (cpp_reader *); 709404b540aSrobert 710404b540aSrobert extern cpp_buffer *cpp_push_buffer (cpp_reader *, const unsigned char *, 711404b540aSrobert size_t, int); 712404b540aSrobert extern int cpp_defined (cpp_reader *, const unsigned char *, int); 713404b540aSrobert 714404b540aSrobert /* A preprocessing number. Code assumes that any unused high bits of 715404b540aSrobert the double integer are set to zero. */ 716404b540aSrobert typedef unsigned HOST_WIDE_INT cpp_num_part; 717404b540aSrobert typedef struct cpp_num cpp_num; 718404b540aSrobert struct cpp_num 719404b540aSrobert { 720404b540aSrobert cpp_num_part high; 721404b540aSrobert cpp_num_part low; 722404b540aSrobert bool unsignedp; /* True if value should be treated as unsigned. */ 723404b540aSrobert bool overflow; /* True if the most recent calculation overflowed. */ 724404b540aSrobert }; 725404b540aSrobert 726404b540aSrobert /* cpplib provides two interfaces for interpretation of preprocessing 727404b540aSrobert numbers. 728404b540aSrobert 729404b540aSrobert cpp_classify_number categorizes numeric constants according to 730404b540aSrobert their field (integer, floating point, or invalid), radix (decimal, 731404b540aSrobert octal, hexadecimal), and type suffixes. */ 732404b540aSrobert 733404b540aSrobert #define CPP_N_CATEGORY 0x000F 734404b540aSrobert #define CPP_N_INVALID 0x0000 735404b540aSrobert #define CPP_N_INTEGER 0x0001 736404b540aSrobert #define CPP_N_FLOATING 0x0002 737404b540aSrobert 738404b540aSrobert #define CPP_N_WIDTH 0x00F0 739404b540aSrobert #define CPP_N_SMALL 0x0010 /* int, float. */ 740404b540aSrobert #define CPP_N_MEDIUM 0x0020 /* long, double. */ 741404b540aSrobert #define CPP_N_LARGE 0x0040 /* long long, long double. */ 742404b540aSrobert 743404b540aSrobert #define CPP_N_RADIX 0x0F00 744404b540aSrobert #define CPP_N_DECIMAL 0x0100 745404b540aSrobert #define CPP_N_HEX 0x0200 746404b540aSrobert #define CPP_N_OCTAL 0x0400 747*9506a00bSjsg #define CPP_N_BINARY 0x0800 748404b540aSrobert 749404b540aSrobert #define CPP_N_UNSIGNED 0x1000 /* Properties. */ 750404b540aSrobert #define CPP_N_IMAGINARY 0x2000 751404b540aSrobert #define CPP_N_DFLOAT 0x4000 752341535f4Smartynas #define CPP_N_DEFAULT 0x8000 753404b540aSrobert 754404b540aSrobert /* Classify a CPP_NUMBER token. The return value is a combination of 755404b540aSrobert the flags from the above sets. */ 756404b540aSrobert extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *); 757404b540aSrobert 758404b540aSrobert /* Evaluate a token classified as category CPP_N_INTEGER. */ 759404b540aSrobert extern cpp_num cpp_interpret_integer (cpp_reader *, const cpp_token *, 760404b540aSrobert unsigned int type); 761404b540aSrobert 762404b540aSrobert /* Sign extend a number, with PRECISION significant bits and all 763404b540aSrobert others assumed clear, to fill out a cpp_num structure. */ 764404b540aSrobert cpp_num cpp_num_sign_extend (cpp_num, size_t); 765404b540aSrobert 766404b540aSrobert /* Diagnostic levels. To get a diagnostic without associating a 767404b540aSrobert position in the translation unit with it, use cpp_error_with_line 768404b540aSrobert with a line number of zero. */ 769404b540aSrobert 770404b540aSrobert /* Warning, an error with -Werror. */ 771404b540aSrobert #define CPP_DL_WARNING 0x00 772404b540aSrobert /* Same as CPP_DL_WARNING, except it is not suppressed in system headers. */ 773404b540aSrobert #define CPP_DL_WARNING_SYSHDR 0x01 774404b540aSrobert /* Warning, an error with -pedantic-errors or -Werror. */ 775404b540aSrobert #define CPP_DL_PEDWARN 0x02 776404b540aSrobert /* An error. */ 777404b540aSrobert #define CPP_DL_ERROR 0x03 778404b540aSrobert /* An internal consistency check failed. Prints "internal error: ", 779404b540aSrobert otherwise the same as CPP_DL_ERROR. */ 780404b540aSrobert #define CPP_DL_ICE 0x04 781404b540aSrobert /* Extracts a diagnostic level from an int. */ 782404b540aSrobert #define CPP_DL_EXTRACT(l) (l & 0xf) 783404b540aSrobert /* Nonzero if a diagnostic level is one of the warnings. */ 784404b540aSrobert #define CPP_DL_WARNING_P(l) (CPP_DL_EXTRACT (l) >= CPP_DL_WARNING \ 785404b540aSrobert && CPP_DL_EXTRACT (l) <= CPP_DL_PEDWARN) 786404b540aSrobert 787404b540aSrobert /* Output a diagnostic of some kind. */ 788404b540aSrobert extern void cpp_error (cpp_reader *, int, const char *msgid, ...) 789404b540aSrobert ATTRIBUTE_PRINTF_3; 790404b540aSrobert 791404b540aSrobert /* Output a diagnostic with "MSGID: " preceding the 792404b540aSrobert error string of errno. No location is printed. */ 793404b540aSrobert extern void cpp_errno (cpp_reader *, int, const char *msgid); 794404b540aSrobert 795404b540aSrobert /* Same as cpp_error, except additionally specifies a position as a 796404b540aSrobert (translation unit) physical line and physical column. If the line is 797404b540aSrobert zero, then no location is printed. */ 798404b540aSrobert extern void cpp_error_with_line (cpp_reader *, int, source_location, unsigned, 799404b540aSrobert const char *msgid, ...) ATTRIBUTE_PRINTF_5; 800404b540aSrobert 801404b540aSrobert /* In cpplex.c */ 802404b540aSrobert extern int cpp_ideq (const cpp_token *, const char *); 803404b540aSrobert extern void cpp_output_line (cpp_reader *, FILE *); 804404b540aSrobert extern void cpp_output_token (const cpp_token *, FILE *); 805404b540aSrobert extern const char *cpp_type2name (enum cpp_ttype); 806404b540aSrobert /* Returns the value of an escape sequence, truncated to the correct 807404b540aSrobert target precision. PSTR points to the input pointer, which is just 808404b540aSrobert after the backslash. LIMIT is how much text we have. WIDE is true 809404b540aSrobert if the escape sequence is part of a wide character constant or 810404b540aSrobert string literal. Handles all relevant diagnostics. */ 811404b540aSrobert extern cppchar_t cpp_parse_escape (cpp_reader *, const unsigned char ** pstr, 812404b540aSrobert const unsigned char *limit, int wide); 813404b540aSrobert 814404b540aSrobert /* In cpphash.c */ 815404b540aSrobert 816404b540aSrobert /* Lookup an identifier in the hashtable. Puts the identifier in the 817404b540aSrobert table if it is not already there. */ 818404b540aSrobert extern cpp_hashnode *cpp_lookup (cpp_reader *, const unsigned char *, 819404b540aSrobert unsigned int); 820404b540aSrobert 821404b540aSrobert typedef int (*cpp_cb) (cpp_reader *, cpp_hashnode *, void *); 822404b540aSrobert extern void cpp_forall_identifiers (cpp_reader *, cpp_cb, void *); 823404b540aSrobert 824404b540aSrobert /* In cppmacro.c */ 825404b540aSrobert extern void cpp_scan_nooutput (cpp_reader *); 826404b540aSrobert extern int cpp_sys_macro_p (cpp_reader *); 827404b540aSrobert extern unsigned char *cpp_quote_string (unsigned char *, const unsigned char *, 828404b540aSrobert unsigned int); 829404b540aSrobert 830404b540aSrobert /* In cppfiles.c */ 831404b540aSrobert extern bool cpp_included (cpp_reader *, const char *); 832404b540aSrobert extern void cpp_make_system_header (cpp_reader *, int, int); 833404b540aSrobert extern bool cpp_push_include (cpp_reader *, const char *); 834404b540aSrobert extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *); 835404b540aSrobert extern const char *cpp_get_path (struct _cpp_file *); 836404b540aSrobert extern cpp_dir *cpp_get_dir (struct _cpp_file *); 837404b540aSrobert extern cpp_buffer *cpp_get_buffer (cpp_reader *); 838404b540aSrobert extern struct _cpp_file *cpp_get_file (cpp_buffer *); 839404b540aSrobert extern cpp_buffer *cpp_get_prev (cpp_buffer *); 840404b540aSrobert 841404b540aSrobert /* In cpppch.c */ 842404b540aSrobert struct save_macro_data; 843404b540aSrobert extern int cpp_save_state (cpp_reader *, FILE *); 844404b540aSrobert extern int cpp_write_pch_deps (cpp_reader *, FILE *); 845404b540aSrobert extern int cpp_write_pch_state (cpp_reader *, FILE *); 846404b540aSrobert extern int cpp_valid_state (cpp_reader *, const char *, int); 847404b540aSrobert extern void cpp_prepare_state (cpp_reader *, struct save_macro_data **); 848404b540aSrobert extern int cpp_read_state (cpp_reader *, const char *, FILE *, 849404b540aSrobert struct save_macro_data *); 850404b540aSrobert 851404b540aSrobert #ifdef __cplusplus 852404b540aSrobert } 853404b540aSrobert #endif 854404b540aSrobert 855404b540aSrobert #endif /* ! LIBCPP_CPPLIB_H */ 856