History

gcc-9.1

Wolfgang Thaller committed 7 years ago

Commit 6fbf4221 parent ec13cc931387 files · +2442466 −1054331Browse files

Showing the changes to gcc/libcpp/include/cpplib.h (1 of 31387 files). Show all

Unified · Split

gcc/libcpp/include/cpplib.h+238−150
@@ -1,5 +1,5 @@
1/* Definitions for CPP library.1/* Definitions for CPP library.
2 Copyright (C) 1995-2018 Free Software Foundation, Inc.2 Copyright (C) 1995-2019 Free Software Foundation, Inc.
3 Written by Per Bothner, 1994-95.3 Written by Per Bothner, 1994-95.
4 4
5This program is free software; you can redistribute it and/or modify it5This program is free software; you can redistribute it and/or modify it
@@ -36,7 +36,6 @@ typedef struct cpp_macro cpp_macro; · 30 unmodified lines
36typedef struct cpp_callbacks cpp_callbacks;36typedef struct cpp_callbacks cpp_callbacks;
37typedef struct cpp_dir cpp_dir;37typedef struct cpp_dir cpp_dir;
38 38
39struct answer;
40struct _cpp_file;39struct _cpp_file;
41 40
42/* The first three groups, apart from '=', can appear in preprocessor41/* The first three groups, apart from '=', can appear in preprocessor
@@ -168,8 +167,9 @@ enum cpp_ttype · 125 unmodified lines
168#undef TK167#undef TK
169 168
170/* C language kind, used when calling cpp_create_reader. */169/* C language kind, used when calling cpp_create_reader. */
171enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, CLK_GNUC17,170enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, CLK_GNUC17, CLK_GNUC2X,
172 CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11, CLK_STDC17,171 CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11, CLK_STDC17,
172 CLK_STDC2X,
173 CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11,173 CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11,
174 CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17,174 CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17,
175 CLK_GNUCXX2A, CLK_CXX2A, CLK_ASM};175 CLK_GNUCXX2A, CLK_CXX2A, CLK_ASM};
@@ -240,8 +240,10 @@ struct GTY(()) cpp_identifier { · 64 unmodified lines
240/* A preprocessing token. This has been carefully packed and should240/* A preprocessing token. This has been carefully packed and should
241 occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */241 occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
242struct GTY(()) cpp_token {242struct GTY(()) cpp_token {
243 source_location src_loc; /* Location of first char of token,243
244 together with range of full token. */244 /* Location of first char of token, together with range of full token. */
245 location_t src_loc;
246
245 ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */247 ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */
246 unsigned short flags; /* flags - see above */248 unsigned short flags; /* flags - see above */
247 249
@@ -550,6 +552,59 @@ struct cpp_options · 302 unmodified lines
550 bool canonical_system_headers;552 bool canonical_system_headers;
551};553};
552 554
555/* Diagnostic levels. To get a diagnostic without associating a
556 position in the translation unit with it, use cpp_error_with_line
557 with a line number of zero. */
558
559enum cpp_diagnostic_level {
560 /* Warning, an error with -Werror. */
561 CPP_DL_WARNING = 0,
562 /* Same as CPP_DL_WARNING, except it is not suppressed in system headers. */
563 CPP_DL_WARNING_SYSHDR,
564 /* Warning, an error with -pedantic-errors or -Werror. */
565 CPP_DL_PEDWARN,
566 /* An error. */
567 CPP_DL_ERROR,
568 /* An internal consistency check failed. Prints "internal error: ",
569 otherwise the same as CPP_DL_ERROR. */
570 CPP_DL_ICE,
571 /* An informative note following a warning. */
572 CPP_DL_NOTE,
573 /* A fatal error. */
574 CPP_DL_FATAL
575};
576
577/* Warning reason codes. Use a reason code of CPP_W_NONE for unclassified
578 warnings and diagnostics that are not warnings. */
579
580enum cpp_warning_reason {
581 CPP_W_NONE = 0,
582 CPP_W_DEPRECATED,
583 CPP_W_COMMENTS,
584 CPP_W_MISSING_INCLUDE_DIRS,
585 CPP_W_TRIGRAPHS,
586 CPP_W_MULTICHAR,
587 CPP_W_TRADITIONAL,
588 CPP_W_LONG_LONG,
589 CPP_W_ENDIF_LABELS,
590 CPP_W_NUM_SIGN_CHANGE,
591 CPP_W_VARIADIC_MACROS,
592 CPP_W_BUILTIN_MACRO_REDEFINED,
593 CPP_W_DOLLARS,
594 CPP_W_UNDEF,
595 CPP_W_UNUSED_MACROS,
596 CPP_W_CXX_OPERATOR_NAMES,
597 CPP_W_NORMALIZE,
598 CPP_W_INVALID_PCH,
599 CPP_W_WARNING_DIRECTIVE,
600 CPP_W_LITERAL_SUFFIX,
601 CPP_W_DATE_TIME,
602 CPP_W_PEDANTIC,
603 CPP_W_C90_C99_COMPAT,
604 CPP_W_CXX11_COMPAT,
605 CPP_W_EXPANSION_TO_DEFINED
606};
607
553/* Callback for header lookup for HEADER, which is the name of a608/* Callback for header lookup for HEADER, which is the name of a
554 source file. It is used as a method of last resort to find headers609 source file. It is used as a method of last resort to find headers
555 that are not otherwise found during the normal include processing.610 that are not otherwise found during the normal include processing.
@@ -571,12 +626,12 @@ struct cpp_callbacks · 15 unmodified lines
571 void (*file_change) (cpp_reader *, const line_map_ordinary *);626 void (*file_change) (cpp_reader *, const line_map_ordinary *);
572 627
573 void (*dir_change) (cpp_reader *, const char *);628 void (*dir_change) (cpp_reader *, const char *);
574 void (*include) (cpp_reader *, source_location, const unsigned char *,629 void (*include) (cpp_reader *, location_t, const unsigned char *,
575 const char *, int, const cpp_token **);630 const char *, int, const cpp_token **);
576 void (*define) (cpp_reader *, source_location, cpp_hashnode *);631 void (*define) (cpp_reader *, location_t, cpp_hashnode *);
577 void (*undef) (cpp_reader *, source_location, cpp_hashnode *);632 void (*undef) (cpp_reader *, location_t, cpp_hashnode *);
578 void (*ident) (cpp_reader *, source_location, const cpp_string *);633 void (*ident) (cpp_reader *, location_t, const cpp_string *);
579 void (*def_pragma) (cpp_reader *, source_location);634 void (*def_pragma) (cpp_reader *, location_t);
580 int (*valid_pch) (cpp_reader *, const char *, int);635 int (*valid_pch) (cpp_reader *, const char *, int);
581 void (*read_pch) (cpp_reader *, const char *, int, const char *);636 void (*read_pch) (cpp_reader *, const char *, int, const char *);
582 missing_header_cb missing_header;637 missing_header_cb missing_header;
@@ -587,26 +642,29 @@ struct cpp_callbacks · 4 unmodified lines
587 642
588 /* Called to emit a diagnostic. This callback receives the643 /* Called to emit a diagnostic. This callback receives the
589 translated message. */644 translated message. */
590 bool (*error) (cpp_reader *, int, int, rich_location *,645 bool (*diagnostic) (cpp_reader *,
591 const char *, va_list *)646 enum cpp_diagnostic_level,
647 enum cpp_warning_reason,
648 rich_location *,
649 const char *, va_list *)
592 ATTRIBUTE_FPTR_PRINTF(5,0);650 ATTRIBUTE_FPTR_PRINTF(5,0);
593 651
594 /* Callbacks for when a macro is expanded, or tested (whether652 /* Callbacks for when a macro is expanded, or tested (whether
595 defined or not at the time) in #ifdef, #ifndef or "defined". */653 defined or not at the time) in #ifdef, #ifndef or "defined". */
596 void (*used_define) (cpp_reader *, source_location, cpp_hashnode *);654 void (*used_define) (cpp_reader *, location_t, cpp_hashnode *);
597 void (*used_undef) (cpp_reader *, source_location, cpp_hashnode *);655 void (*used_undef) (cpp_reader *, location_t, cpp_hashnode *);
598 /* Called before #define and #undef or other macro definition656 /* Called before #define and #undef or other macro definition
599 changes are processed. */657 changes are processed. */
600 void (*before_define) (cpp_reader *);658 void (*before_define) (cpp_reader *);
601 /* Called whenever a macro is expanded or tested.659 /* Called whenever a macro is expanded or tested.
602 Second argument is the location of the start of the current expansion. */660 Second argument is the location of the start of the current expansion. */
603 void (*used) (cpp_reader *, source_location, cpp_hashnode *);661 void (*used) (cpp_reader *, location_t, cpp_hashnode *);
604 662
605 /* Callback to identify whether an attribute exists. */663 /* Callback to identify whether an attribute exists. */
606 int (*has_attribute) (cpp_reader *);664 int (*has_attribute) (cpp_reader *);
607 665
608 /* Callback that can change a user builtin into normal macro. */666 /* Callback that can change a user lazy into normal macro. */
609 bool (*user_builtin_macro) (cpp_reader *, cpp_hashnode *);667 void (*user_lazy_macro) (cpp_reader *, cpp_macro *, unsigned);
610 668
611 /* Callback to parse SOURCE_DATE_EPOCH from environment. */669 /* Callback to parse SOURCE_DATE_EPOCH from environment. */
612 time_t (*get_source_date_epoch) (cpp_reader *);670 time_t (*get_source_date_epoch) (cpp_reader *);
@@ -620,7 +678,7 @@ struct cpp_callbacks · 7 unmodified lines
620 The content contains the opening slash-star (or slash-slash),678 The content contains the opening slash-star (or slash-slash),
621 and for C-style comments contains the closing star-slash. For679 and for C-style comments contains the closing star-slash. For
622 C++-style comments it does not include the terminating newline. */680 C++-style comments it does not include the terminating newline. */
623 void (*comment) (cpp_reader *, source_location, const unsigned char *,681 void (*comment) (cpp_reader *, location_t, const unsigned char *,
624 size_t);682 size_t);
625 683
626 /* Callback for filename remapping in __FILE__ and __BASE_FILE__ macro684 /* Callback for filename remapping in __FILE__ and __BASE_FILE__ macro
@@ -671,14 +729,81 @@ struct cpp_dir · 44 unmodified lines
671 dev_t dev;729 dev_t dev;
672};730};
673 731
674/* The structure of a node in the hash table. The hash table has732/* The kind of the cpp_macro. */
675 entries for all identifiers: either macros defined by #define733enum cpp_macro_kind {
676 commands (type NT_MACRO), assertions created with #assert734 cmk_macro, /* An ISO macro (token expansion). */
677 (NT_ASSERTION), or neither of the above (NT_VOID). Builtin macros735 cmk_assert, /* An assertion. */
678 like __LINE__ are flagged NODE_BUILTIN. Poisoned identifiers are736 cmk_traditional /* A traditional macro (text expansion). */
679 flagged NODE_POISONED. NODE_OPERATOR (C++ only) indicates an737};
680 identifier that behaves like an operator such as "xor".738
681 NODE_DIAGNOSTIC is for speed in lex_token: it indicates a739/* Each macro definition is recorded in a cpp_macro structure.
740 Variadic macros cannot occur with traditional cpp. */
741struct GTY(()) cpp_macro {
742 union cpp_parm_u
743 {
744 /* Parameters, if any. If parameter names use extended identifiers,
745 the original spelling of those identifiers, not the canonical
746 UTF-8 spelling, goes here. */
747 cpp_hashnode ** GTY ((tag ("false"),
748 nested_ptr (union tree_node,
749 "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL",
750 "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"),
751 length ("%1.paramc"))) params;
752
753 /* If this is an assertion, the next one in the chain. */
754 cpp_macro *GTY ((tag ("true"))) next;
755 } GTY ((desc ("%1.kind == cmk_assert"))) parm;
756
757 /* Definition line number. */
758 location_t line;
759
760 /* Number of tokens in body, or bytes for traditional macros. */
761 /* Do we really need 2^32-1 range here? */
762 unsigned int count;
763
764 /* Number of parameters. */
765 unsigned short paramc;
766
767 /* Non-zero if this is a user-lazy macro, value provided by user. */
768 unsigned char lazy;
769
770 /* The kind of this macro (ISO, trad or assert) */
771 unsigned kind : 2;
772
773 /* If a function-like macro. */
774 unsigned int fun_like : 1;
775
776 /* If a variadic macro. */
777 unsigned int variadic : 1;
778
779 /* If macro defined in system header. */
780 unsigned int syshdr : 1;
781
782 /* Nonzero if it has been expanded or had its existence tested. */
783 unsigned int used : 1;
784
785 /* Indicate whether the tokens include extra CPP_PASTE tokens at the
786 end to track invalid redefinitions with consecutive CPP_PASTE
787 tokens. */
788 unsigned int extra_tokens : 1;
789
790 /* 1 bits spare (32-bit). 33 on 64-bit target. */
791
792 union cpp_exp_u
793 {
794 /* Trailing array of replacement tokens (ISO), or assertion body value. */
795 cpp_token GTY ((tag ("false"), length ("%1.count"))) tokens[1];
796
797 /* Pointer to replacement text (traditional). See comment at top
798 of cpptrad.c for how traditional function-like macros are
799 encoded. */
800 const unsigned char *GTY ((tag ("true"))) text;
801 } GTY ((desc ("%1.kind == cmk_traditional"))) exp;
802};
803
804/* Poisoned identifiers are flagged NODE_POISONED. NODE_OPERATOR (C++
805 only) indicates an identifier that behaves like an operator such as
806 "xor". NODE_DIAGNOSTIC is for speed in lex_token: it indicates a
682 diagnostic may be required for this node. Currently this only807 diagnostic may be required for this node. Currently this only
683 applies to __VA_ARGS__, poisoned identifiers, and -Wc++-compat808 applies to __VA_ARGS__, poisoned identifiers, and -Wc++-compat
684 warnings about NODE_OPERATOR. */809 warnings about NODE_OPERATOR. */
@@ -686,21 +811,21 @@ struct cpp_dir · 1 unmodified line
686/* Hash node flags. */811/* Hash node flags. */
687#define NODE_OPERATOR (1 << 0) /* C++ named operator. */812#define NODE_OPERATOR (1 << 0) /* C++ named operator. */
688#define NODE_POISONED (1 << 1) /* Poisoned identifier. */813#define NODE_POISONED (1 << 1) /* Poisoned identifier. */
689#define NODE_BUILTIN (1 << 2) /* Builtin macro. */814#define NODE_DIAGNOSTIC (1 << 2) /* Possible diagnostic when lexed. */
690#define NODE_DIAGNOSTIC (1 << 3) /* Possible diagnostic when lexed. */815#define NODE_WARN (1 << 3) /* Warn if redefined or undefined. */
691#define NODE_WARN (1 << 4) /* Warn if redefined or undefined. */816#define NODE_DISABLED (1 << 4) /* A disabled macro. */
692#define NODE_DISABLED (1 << 5) /* A disabled macro. */817#define NODE_USED (1 << 5) /* Dumped with -dU. */
693#define NODE_MACRO_ARG (1 << 6) /* Used during #define processing. */818#define NODE_CONDITIONAL (1 << 6) /* Conditional macro */
694#define NODE_USED (1 << 7) /* Dumped with -dU. */819#define NODE_WARN_OPERATOR (1 << 7) /* Warn about C++ named operator. */
695#define NODE_CONDITIONAL (1 << 8) /* Conditional macro */
696#define NODE_WARN_OPERATOR (1 << 9) /* Warn about C++ named operator. */
697 820
698/* Different flavors of hash node. */821/* Different flavors of hash node. */
699enum node_type822enum node_type
700{823{
701 NT_VOID = 0, /* No definition yet. */824 NT_VOID = 0, /* Maybe an assert? */
702 NT_MACRO, /* A macro of some form. */825 NT_MACRO_ARG, /* A macro arg. */
703 NT_ASSERTION /* Predicate for #assert. */826 NT_USER_MACRO, /* A user macro. */
827 NT_BUILTIN_MACRO, /* A builtin macro. */
828 NT_MACRO_MASK = NT_USER_MACRO /* Mask for either macro kind. */
704};829};
705 830
706/* Different flavors of builtin macro. _Pragma is an operator, but we831/* Different flavors of builtin macro. _Pragma is an operator, but we
@@ -717,46 +842,27 @@ enum cpp_builtin_type · 10 unmodified lines
717 BT_PRAGMA, /* `_Pragma' operator */842 BT_PRAGMA, /* `_Pragma' operator */
718 BT_TIMESTAMP, /* `__TIMESTAMP__' */843 BT_TIMESTAMP, /* `__TIMESTAMP__' */
719 BT_COUNTER, /* `__COUNTER__' */844 BT_COUNTER, /* `__COUNTER__' */
720 BT_HAS_ATTRIBUTE, /* `__has_attribute__(x)' */845 BT_HAS_ATTRIBUTE /* `__has_attribute__(x)' */
721 BT_FIRST_USER, /* User defined builtin macros. */
722 BT_LAST_USER = BT_FIRST_USER + 63
723};846};
724 847
725#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE))848#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE))
726#define HT_NODE(NODE) ((ht_identifier *) (NODE))849#define HT_NODE(NODE) (&(NODE)->ident)
727#define NODE_LEN(NODE) HT_LEN (&(NODE)->ident)850#define NODE_LEN(NODE) HT_LEN (HT_NODE (NODE))
728#define NODE_NAME(NODE) HT_STR (&(NODE)->ident)851#define NODE_NAME(NODE) HT_STR (HT_NODE (NODE))
729
730/* Specify which field, if any, of the union is used. */
731
732enum {
733 NTV_MACRO,
734 NTV_ANSWER,
735 NTV_BUILTIN,
736 NTV_ARGUMENT,
737 NTV_NONE
738};
739
740#define CPP_HASHNODE_VALUE_IDX(HNODE) \
741 ((HNODE.flags & NODE_MACRO_ARG) ? NTV_ARGUMENT \
742 : HNODE.type == NT_MACRO ? ((HNODE.flags & NODE_BUILTIN) \
743 ? NTV_BUILTIN : NTV_MACRO) \
744 : HNODE.type == NT_ASSERTION ? NTV_ANSWER \
745 : NTV_NONE)
746 852
747/* The common part of an identifier node shared amongst all 3 C front853/* The common part of an identifier node shared amongst all 3 C front
748 ends. Also used to store CPP identifiers, which are a superset of854 ends. Also used to store CPP identifiers, which are a superset of
749 identifiers in the grammatical sense. */855 identifiers in the grammatical sense. */
750 856
751union GTY(()) _cpp_hashnode_value {857union GTY(()) _cpp_hashnode_value {
752 /* If a macro. */858 /* Assert (maybe NULL) */
753 cpp_macro * GTY((tag ("NTV_MACRO"))) macro;859 cpp_macro * GTY((tag ("NT_VOID"))) answers;
754 /* Answers to an assertion. */860 /* Macro (never NULL) */
755 struct answer * GTY ((tag ("NTV_ANSWER"))) answers;861 cpp_macro * GTY((tag ("NT_USER_MACRO"))) macro;
756 /* Code for a builtin macro. */862 /* Code for a builtin macro. */
757 enum cpp_builtin_type GTY ((tag ("NTV_BUILTIN"))) builtin;863 enum cpp_builtin_type GTY ((tag ("NT_BUILTIN_MACRO"))) builtin;
758 /* Macro argument index. */864 /* Macro argument index. */
759 unsigned short GTY ((tag ("NTV_ARGUMENT"))) arg_index;865 unsigned short GTY ((tag ("NT_MACRO_ARG"))) arg_index;
760};866};
761 867
762struct GTY(()) cpp_hashnode {868struct GTY(()) cpp_hashnode {
@@ -766,10 +872,12 @@ struct GTY(()) cpp_hashnode { · 3 unmodified lines
766 then index into directive table.872 then index into directive table.
767 Otherwise, a NODE_OPERATOR. */873 Otherwise, a NODE_OPERATOR. */
768 unsigned char rid_code; /* Rid code - for front ends. */874 unsigned char rid_code; /* Rid code - for front ends. */
769 ENUM_BITFIELD(node_type) type : 6; /* CPP node type. */875 ENUM_BITFIELD(node_type) type : 2; /* CPP node type. */
770 unsigned int flags : 10; /* CPP flags. */876 unsigned int flags : 8; /* CPP flags. */
877
878 /* 6 bits spare (plus another 32 on 64-bit hosts). */
771 879
772 union _cpp_hashnode_value GTY ((desc ("CPP_HASHNODE_VALUE_IDX (%1)"))) value;880 union _cpp_hashnode_value GTY ((desc ("%1.type"))) value;
773};881};
774 882
775/* A class for iterating through the source locations within a883/* A class for iterating through the source locations within a
@@ -778,13 +886,13 @@ struct GTY(()) cpp_hashnode { · 2 unmodified lines
778 886
779class cpp_string_location_reader {887class cpp_string_location_reader {
780 public:888 public:
781 cpp_string_location_reader (source_location src_loc,889 cpp_string_location_reader (location_t src_loc,
782 line_maps *line_table);890 line_maps *line_table);
783 891
784 source_range get_next ();892 source_range get_next ();
785 893
786 private:894 private:
787 source_location m_loc;895 location_t m_loc;
788 int m_offset_per_column;896 int m_offset_per_column;
789 line_maps *m_line_table;897 line_maps *m_line_table;
790};898};
@@ -889,11 +997,32 @@ extern int cpp_avoid_paste (cpp_reader *, const cpp_token *, · 98 unmodified lines
889 const cpp_token *);997 const cpp_token *);
890extern const cpp_token *cpp_get_token (cpp_reader *);998extern const cpp_token *cpp_get_token (cpp_reader *);
891extern const cpp_token *cpp_get_token_with_location (cpp_reader *,999extern const cpp_token *cpp_get_token_with_location (cpp_reader *,
892 source_location *);1000 location_t *);
893extern bool cpp_fun_like_macro_p (cpp_hashnode *);1001inline bool cpp_user_macro_p (const cpp_hashnode *node)
1002{
1003 return node->type == NT_USER_MACRO;
1004}
1005inline bool cpp_builtin_macro_p (const cpp_hashnode *node)
1006{
1007 return node->type == NT_BUILTIN_MACRO;
1008}
1009inline bool cpp_macro_p (const cpp_hashnode *node)
1010{
1011 return node->type & NT_MACRO_MASK;
1012}
1013
1014/* Returns true if NODE is a function-like user macro. */
1015inline bool cpp_fun_like_macro_p (cpp_hashnode *node)
1016{
1017 return cpp_user_macro_p (node) && node->value.macro->fun_like;
1018}
1019
894extern const unsigned char *cpp_macro_definition (cpp_reader *,1020extern const unsigned char *cpp_macro_definition (cpp_reader *,
895 cpp_hashnode *);1021 cpp_hashnode *);
896extern source_location cpp_macro_definition_location (cpp_hashnode *);1022inline location_t cpp_macro_definition_location (cpp_hashnode *node)
1023{
1024 return node->value.macro->line;
1025}
897extern void _cpp_backup_tokens (cpp_reader *, unsigned int);1026extern void _cpp_backup_tokens (cpp_reader *, unsigned int);
898extern const cpp_token *cpp_peek_token (cpp_reader *, int);1027extern const cpp_token *cpp_peek_token (cpp_reader *, int);
899 1028
@@ -926,6 +1055,9 @@ extern void cpp_assert (cpp_reader *, const char *); · 26 unmodified lines
926extern void cpp_undef (cpp_reader *, const char *);1055extern void cpp_undef (cpp_reader *, const char *);
927extern void cpp_unassert (cpp_reader *, const char *);1056extern void cpp_unassert (cpp_reader *, const char *);
928 1057
1058/* Mark a node as a lazily defined macro. */
1059extern void cpp_define_lazily (cpp_reader *, cpp_hashnode *node, unsigned N);
1060
929/* Undefine all macros and assertions. */1061/* Undefine all macros and assertions. */
930extern void cpp_undef_all (cpp_reader *);1062extern void cpp_undef_all (cpp_reader *);
931 1063
@@ -996,7 +1128,7 @@ struct cpp_num · 64 unmodified lines
996/* Classify a CPP_NUMBER token. The return value is a combination of1128/* Classify a CPP_NUMBER token. The return value is a combination of
997 the flags from the above sets. */1129 the flags from the above sets. */
998extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *,1130extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *,
999 const char **, source_location);1131 const char **, location_t);
1000 1132
1001/* Return the classification flags for a float suffix. */1133/* Return the classification flags for a float suffix. */
1002extern unsigned int cpp_interpret_float_suffix (cpp_reader *, const char *,1134extern unsigned int cpp_interpret_float_suffix (cpp_reader *, const char *,
@@ -1014,99 +1146,55 @@ extern cpp_num cpp_interpret_integer (cpp_reader *, const cpp_token *, · 11 unmodified lines
1014 others assumed clear, to fill out a cpp_num structure. */1146 others assumed clear, to fill out a cpp_num structure. */
1015cpp_num cpp_num_sign_extend (cpp_num, size_t);1147cpp_num cpp_num_sign_extend (cpp_num, size_t);
1016 1148
1017/* Diagnostic levels. To get a diagnostic without associating a
1018 position in the translation unit with it, use cpp_error_with_line
1019 with a line number of zero. */
1020
1021enum {
1022 /* Warning, an error with -Werror. */
1023 CPP_DL_WARNING = 0,
1024 /* Same as CPP_DL_WARNING, except it is not suppressed in system headers. */
1025 CPP_DL_WARNING_SYSHDR,
1026 /* Warning, an error with -pedantic-errors or -Werror. */
1027 CPP_DL_PEDWARN,
1028 /* An error. */
1029 CPP_DL_ERROR,
1030 /* An internal consistency check failed. Prints "internal error: ",
1031 otherwise the same as CPP_DL_ERROR. */
1032 CPP_DL_ICE,
1033 /* An informative note following a warning. */
1034 CPP_DL_NOTE,
1035 /* A fatal error. */
1036 CPP_DL_FATAL
1037};
1038
1039/* Warning reason codes. Use a reason code of zero for unclassified warnings
1040 and errors that are not warnings. */
1041enum {
1042 CPP_W_NONE = 0,
1043 CPP_W_DEPRECATED,
1044 CPP_W_COMMENTS,
1045 CPP_W_MISSING_INCLUDE_DIRS,
1046 CPP_W_TRIGRAPHS,
1047 CPP_W_MULTICHAR,
1048 CPP_W_TRADITIONAL,
1049 CPP_W_LONG_LONG,
1050 CPP_W_ENDIF_LABELS,
1051 CPP_W_NUM_SIGN_CHANGE,
1052 CPP_W_VARIADIC_MACROS,
1053 CPP_W_BUILTIN_MACRO_REDEFINED,
1054 CPP_W_DOLLARS,
1055 CPP_W_UNDEF,
1056 CPP_W_UNUSED_MACROS,
1057 CPP_W_CXX_OPERATOR_NAMES,
1058 CPP_W_NORMALIZE,
1059 CPP_W_INVALID_PCH,
1060 CPP_W_WARNING_DIRECTIVE,
1061 CPP_W_LITERAL_SUFFIX,
1062 CPP_W_DATE_TIME,
1063 CPP_W_PEDANTIC,
1064 CPP_W_C90_C99_COMPAT,
1065 CPP_W_CXX11_COMPAT,
1066 CPP_W_EXPANSION_TO_DEFINED
1067};
1068
1069/* Output a diagnostic of some kind. */1149/* Output a diagnostic of some kind. */
1070extern bool cpp_error (cpp_reader *, int, const char *msgid, ...)1150extern bool cpp_error (cpp_reader *, enum cpp_diagnostic_level,
1151 const char *msgid, ...)
1071 ATTRIBUTE_PRINTF_3;1152 ATTRIBUTE_PRINTF_3;
1072extern bool cpp_warning (cpp_reader *, int, const char *msgid, ...)1153extern bool cpp_warning (cpp_reader *, enum cpp_warning_reason,
1154 const char *msgid, ...)
1073 ATTRIBUTE_PRINTF_3;1155 ATTRIBUTE_PRINTF_3;
1074extern bool cpp_pedwarning (cpp_reader *, int, const char *msgid, ...)1156extern bool cpp_pedwarning (cpp_reader *, enum cpp_warning_reason,
1157 const char *msgid, ...)
1075 ATTRIBUTE_PRINTF_3;1158 ATTRIBUTE_PRINTF_3;
1076extern bool cpp_warning_syshdr (cpp_reader *, int, const char *msgid, ...)1159extern bool cpp_warning_syshdr (cpp_reader *, enum cpp_warning_reason reason,
1160 const char *msgid, ...)
1077 ATTRIBUTE_PRINTF_3;1161 ATTRIBUTE_PRINTF_3;
1078 1162
1079/* Output a diagnostic with "MSGID: " preceding the1163/* Output a diagnostic with "MSGID: " preceding the
1080 error string of errno. No location is printed. */1164 error string of errno. No location is printed. */
1081extern bool cpp_errno (cpp_reader *, int, const char *msgid);1165extern bool cpp_errno (cpp_reader *, enum cpp_diagnostic_level,
1166 const char *msgid);
1082/* Similarly, but with "FILENAME: " instead of "MSGID: ", where1167/* Similarly, but with "FILENAME: " instead of "MSGID: ", where
1083 the filename is not localized. */1168 the filename is not localized. */
1084extern bool cpp_errno_filename (cpp_reader *, int, const char *filename,1169extern bool cpp_errno_filename (cpp_reader *, enum cpp_diagnostic_level,
1085 source_location loc);1170 const char *filename, location_t loc);
1086 1171
1087/* Same as cpp_error, except additionally specifies a position as a1172/* Same as cpp_error, except additionally specifies a position as a
1088 (translation unit) physical line and physical column. If the line is1173 (translation unit) physical line and physical column. If the line is
1089 zero, then no location is printed. */1174 zero, then no location is printed. */
1090extern bool cpp_error_with_line (cpp_reader *, int, source_location,1175extern bool cpp_error_with_line (cpp_reader *, enum cpp_diagnostic_level,
1091 unsigned, const char *msgid, ...)1176 location_t, unsigned,
1177 const char *msgid, ...)
1092 ATTRIBUTE_PRINTF_5;1178 ATTRIBUTE_PRINTF_5;
1093extern bool cpp_warning_with_line (cpp_reader *, int, source_location,1179extern bool cpp_warning_with_line (cpp_reader *, enum cpp_warning_reason,
1094 unsigned, const char *msgid, ...)1180 location_t, unsigned,
1181 const char *msgid, ...)
1095 ATTRIBUTE_PRINTF_5;1182 ATTRIBUTE_PRINTF_5;
1096extern bool cpp_pedwarning_with_line (cpp_reader *, int, source_location,1183extern bool cpp_pedwarning_with_line (cpp_reader *, enum cpp_warning_reason,
1097 unsigned, const char *msgid, ...)1184 location_t, unsigned,
1185 const char *msgid, ...)
1098 ATTRIBUTE_PRINTF_5;1186 ATTRIBUTE_PRINTF_5;
1099extern bool cpp_warning_with_line_syshdr (cpp_reader *, int, source_location,1187extern bool cpp_warning_with_line_syshdr (cpp_reader *, enum cpp_warning_reason,
1100 unsigned, const char *msgid, ...)1188 location_t, unsigned,
1189 const char *msgid, ...)
1101 ATTRIBUTE_PRINTF_5;1190 ATTRIBUTE_PRINTF_5;
1102 1191
1103extern bool cpp_error_at (cpp_reader * pfile, int level,1192extern bool cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level,
1104 source_location src_loc, const char *msgid, ...)1193 location_t src_loc, const char *msgid, ...)
1105 ATTRIBUTE_PRINTF_4;1194 ATTRIBUTE_PRINTF_4;
1106 1195
1107extern bool cpp_error_at (cpp_reader * pfile, int level,1196extern bool cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level,
1108 rich_location *richloc, const char *msgid,1197 rich_location *richloc, const char *msgid, ...)
1109 ...)
1110 ATTRIBUTE_PRINTF_4;1198 ATTRIBUTE_PRINTF_4;
1111 1199
1112/* In lex.c */1200/* In lex.c */
@@ -1133,7 +1221,7 @@ typedef struct · 20 unmodified lines
1133 char *comment;1221 char *comment;
1134 1222
1135 /* source location for the given comment. */1223 /* source location for the given comment. */
1136 source_location sloc;1224 location_t sloc;
1137} cpp_comment;1225} cpp_comment;
1138 1226
1139/* Structure holding all comments for a given cpp_reader. */1227/* Structure holding all comments for a given cpp_reader. */
@@ -1172,7 +1260,7 @@ extern unsigned char *cpp_quote_string (unsigned char *, const unsigned char *, · 32 unmodified lines
1172 1260
1173/* In files.c */1261/* In files.c */
1174extern bool cpp_included (cpp_reader *, const char *);1262extern bool cpp_included (cpp_reader *, const char *);
1175extern bool cpp_included_before (cpp_reader *, const char *, source_location);1263extern bool cpp_included_before (cpp_reader *, const char *, location_t);
1176extern void cpp_make_system_header (cpp_reader *, int, int);1264extern void cpp_make_system_header (cpp_reader *, int, int);
1177extern bool cpp_push_include (cpp_reader *, const char *);1265extern bool cpp_push_include (cpp_reader *, const char *);
1178extern bool cpp_push_default_include (cpp_reader *, const char *);1266extern bool cpp_push_default_include (cpp_reader *, const char *);
@@ -1195,7 +1283,7 @@ extern int cpp_read_state (cpp_reader *, const char *, FILE *, · 16 unmodified lines
1195 struct save_macro_data *);1283 struct save_macro_data *);
1196 1284
1197/* In lex.c */1285/* In lex.c */
1198extern void cpp_force_token_locations (cpp_reader *, source_location *);1286extern void cpp_force_token_locations (cpp_reader *, location_t);
1199extern void cpp_stop_forcing_token_locations (cpp_reader *);1287extern void cpp_stop_forcing_token_locations (cpp_reader *);
1200 1288
1201/* In expr.c */1289/* In expr.c */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t