History

gcc16 merge

Wolfgang Thaller committed 5 months ago

Commit 934c3881 parent 8179bfd62140 files · +6958943 −1619974Browse files

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

Unified · Split

gcc/libcpp/include/cpplib.h+52−6
@@ -1,5 +1,5 @@
1/* Definitions for CPP library.1/* Definitions for CPP library.
2 Copyright (C) 1995-2025 Free Software Foundation, Inc.2 Copyright (C) 1995-2026 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
@@ -101,6 +101,8 @@ class rich_location; · 95 unmodified lines
101 OP(CLOSE_SQUARE, "]") \101 OP(CLOSE_SQUARE, "]") \
102 OP(OPEN_BRACE, "{") \102 OP(OPEN_BRACE, "{") \
103 OP(CLOSE_BRACE, "}") \103 OP(CLOSE_BRACE, "}") \
104 OP(OPEN_SPLICE, "[:") \
105 OP(CLOSE_SPLICE, ":]") \
104 /* The remainder of the punctuation. Order is not significant. */ \106 /* The remainder of the punctuation. Order is not significant. */ \
105 OP(SEMICOLON, ";") /* structure */ \107 OP(SEMICOLON, ";") /* structure */ \
106 OP(ELLIPSIS, "...") \108 OP(ELLIPSIS, "...") \
@@ -111,6 +113,7 @@ class rich_location; · 4 unmodified lines
111 OP(SCOPE, "::") \113 OP(SCOPE, "::") \
112 OP(DEREF_STAR, "->*") \114 OP(DEREF_STAR, "->*") \
113 OP(DOT_STAR, ".*") \115 OP(DOT_STAR, ".*") \
116 OP(REFLECT_OP, "^^") \
114 OP(ATSIGN, "@") /* used in Objective-C */ \117 OP(ATSIGN, "@") /* used in Objective-C */ \
115 \118 \
116 TK(NAME, IDENT) /* word */ \119 TK(NAME, IDENT) /* word */ \
@@ -435,6 +438,10 @@ struct cpp_options · 318 unmodified lines
435 Presumably the usage is protected by the appropriate #ifdef. */438 Presumably the usage is protected by the appropriate #ifdef. */
436 unsigned char warn_variadic_macros;439 unsigned char warn_variadic_macros;
437 440
441 /* Non-zero means suppress diagnostics for NODE_WARN #define or #undef.
442 Used for cpp_define/cpp_undef. */
443 unsigned char suppress_builtin_macro_warnings;
444
438 /* Nonzero means warn about builtin macros that are redefined or445 /* Nonzero means warn about builtin macros that are redefined or
439 explicitly undefined. */446 explicitly undefined. */
440 unsigned char warn_builtin_macro_redefined;447 unsigned char warn_builtin_macro_redefined;
@@ -620,6 +627,9 @@ struct cpp_options · 179 unmodified lines
620 /* True if -finput-charset= option has been used explicitly. */627 /* True if -finput-charset= option has been used explicitly. */
621 bool cpp_input_charset_explicit;628 bool cpp_input_charset_explicit;
622 629
630 /* True if -Wkeyword-macro. */
631 bool cpp_warn_keyword_macro;
632
623 /* -Wleading-whitespace= value. */633 /* -Wleading-whitespace= value. */
624 unsigned char cpp_warn_leading_whitespace;634 unsigned char cpp_warn_leading_whitespace;
625 635
@@ -757,7 +767,8 @@ enum cpp_warning_reason { · 131 unmodified lines
757 CPP_W_HEADER_GUARD,767 CPP_W_HEADER_GUARD,
758 CPP_W_PRAGMA_ONCE_OUTSIDE_HEADER,768 CPP_W_PRAGMA_ONCE_OUTSIDE_HEADER,
759 CPP_W_LEADING_WHITESPACE,769 CPP_W_LEADING_WHITESPACE,
760 CPP_W_TRAILING_WHITESPACE770 CPP_W_TRAILING_WHITESPACE,
771 CPP_W_KEYWORD_MACRO
761};772};
762 773
763/* Callback for header lookup for HEADER, which is the name of a774/* Callback for header lookup for HEADER, which is the name of a
@@ -852,7 +863,8 @@ struct cpp_callbacks · 88 unmodified lines
852 /* Maybe translate a #include into something else. Return a863 /* Maybe translate a #include into something else. Return a
853 cpp_buffer containing the translation if translating. */864 cpp_buffer containing the translation if translating. */
854 char *(*translate_include) (cpp_reader *, line_maps *, location_t,865 char *(*translate_include) (cpp_reader *, line_maps *, location_t,
855 const char *path);866 _cpp_file *file, bool angle_brackets,
867 const char **alternate);
856};868};
857 869
858#ifdef VMS870#ifdef VMS
@@ -1169,6 +1181,8 @@ extern const char *cpp_probe_header_unit (cpp_reader *, const char *file, · 310 unmodified lines
1169extern const char *cpp_get_narrow_charset_name (cpp_reader *) ATTRIBUTE_PURE;1181extern const char *cpp_get_narrow_charset_name (cpp_reader *) ATTRIBUTE_PURE;
1170extern const char *cpp_get_wide_charset_name (cpp_reader *) ATTRIBUTE_PURE;1182extern const char *cpp_get_wide_charset_name (cpp_reader *) ATTRIBUTE_PURE;
1171 1183
1184extern location_t cpp_get_diagnostic_override_loc (const cpp_reader *);
1185
1172/* This function reads the file, but does not start preprocessing. It1186/* This function reads the file, but does not start preprocessing. It
1173 returns the name of the original file; this is the same as the1187 returns the name of the original file; this is the same as the
1174 input file, except for preprocessed input. This will generate at1188 input file, except for preprocessed input. This will generate at
@@ -1248,6 +1262,17 @@ inline bool cpp_fun_like_macro_p (cpp_hashnode *node) · 73 unmodified lines
1248 return cpp_user_macro_p (node) && node->value.macro->fun_like;1262 return cpp_user_macro_p (node) && node->value.macro->fun_like;
1249}1263}
1250 1264
1265/* Return true for nodes marked for -Wkeyword-macro diagnostics. */
1266inline bool cpp_keyword_p (cpp_hashnode *node)
1267{
1268 /* As keywords are marked identifiers which don't start with underscore
1269 or start with underscore followed by capital letter (except for
1270 _Pragma). */
1271 return ((node->flags & NODE_WARN)
1272 && (NODE_NAME (node)[0] != '_'
1273 || (NODE_NAME (node)[1] != '_' && NODE_NAME (node)[1] != 'P')));
1274}
1275
1251extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *);1276extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *);
1252extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *,1277extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *,
1253 const cpp_macro *);1278 const cpp_macro *);
@@ -1284,6 +1309,9 @@ extern const char *cpp_interpret_string_ranges (cpp_reader *pfile, · 30 unmodified lines
1284extern bool cpp_interpret_string_notranslate (cpp_reader *,1309extern bool cpp_interpret_string_notranslate (cpp_reader *,
1285 const cpp_string *, size_t,1310 const cpp_string *, size_t,
1286 cpp_string *, enum cpp_ttype);1311 cpp_string *, enum cpp_ttype);
1312extern bool cpp_translate_string (cpp_reader *, const cpp_string *,
1313 cpp_string *, enum cpp_ttype, bool);
1314extern bool cpp_valid_identifier (cpp_reader *, const unsigned char *);
1287 1315
1288/* Convert a host character constant to the execution character set. */1316/* Convert a host character constant to the execution character set. */
1289extern cppchar_t cpp_host_to_exec_charset (cpp_reader *, cppchar_t);1317extern cppchar_t cpp_host_to_exec_charset (cpp_reader *, cppchar_t);
@@ -1509,6 +1537,21 @@ extern cpp_comment_table *cpp_get_comments (cpp_reader *); · 219 unmodified lines
1509extern cpp_hashnode *cpp_lookup (cpp_reader *, const unsigned char *,1537extern cpp_hashnode *cpp_lookup (cpp_reader *, const unsigned char *,
1510 unsigned int);1538 unsigned int);
1511 1539
1540/* Set NODE_WARN flag for NAME, such that there will be diagnostics
1541 for #define or #undef of NAME. */
1542
1543inline void
1544cpp_warn (cpp_reader *pfile, const char *name, unsigned int len)
1545{
1546 cpp_lookup (pfile, (const unsigned char *) name, len)->flags |= NODE_WARN;
1547}
1548
1549inline void
1550cpp_warn (cpp_reader *pfile, const char *name)
1551{
1552 cpp_warn (pfile, name, strlen (name));
1553}
1554
1512typedef int (*cpp_cb) (cpp_reader *, cpp_hashnode *, void *);1555typedef int (*cpp_cb) (cpp_reader *, cpp_hashnode *, void *);
1513extern void cpp_forall_identifiers (cpp_reader *, cpp_cb, void *);1556extern void cpp_forall_identifiers (cpp_reader *, cpp_cb, void *);
1514 1557
@@ -1527,8 +1570,10 @@ extern void cpp_make_system_header (cpp_reader *, int, int); · 12 unmodified lines
1527extern bool cpp_push_include (cpp_reader *, const char *);1570extern bool cpp_push_include (cpp_reader *, const char *);
1528extern bool cpp_push_default_include (cpp_reader *, const char *);1571extern bool cpp_push_default_include (cpp_reader *, const char *);
1529extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *);1572extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *);
1530extern const char *cpp_get_path (struct _cpp_file *);1573extern const char *_cpp_get_file_path (_cpp_file *);
1531extern cpp_dir *cpp_get_dir (struct _cpp_file *);1574extern const char *_cpp_get_file_name (_cpp_file *);
1575extern struct stat *_cpp_get_file_stat (_cpp_file *);
1576extern struct cpp_dir *_cpp_get_file_dir (_cpp_file *);
1532extern cpp_buffer *cpp_get_buffer (cpp_reader *);1577extern cpp_buffer *cpp_get_buffer (cpp_reader *);
1533extern struct _cpp_file *cpp_get_file (cpp_buffer *);1578extern struct _cpp_file *cpp_get_file (cpp_buffer *);
1534extern cpp_buffer *cpp_get_prev (cpp_buffer *);1579extern cpp_buffer *cpp_get_prev (cpp_buffer *);
@@ -1608,7 +1653,8 @@ struct cpp_decoded_char · 73 unmodified lines
1608 This is a tabstop value, along with a callback for getting the1653 This is a tabstop value, along with a callback for getting the
1609 widths of characters. Normally this callback is cpp_wcwidth, but we1654 widths of characters. Normally this callback is cpp_wcwidth, but we
1610 support other schemes for escaping non-ASCII unicode as a series of1655 support other schemes for escaping non-ASCII unicode as a series of
1611 ASCII chars when printing the user's source code in diagnostic-show-locus.cc1656 ASCII chars when printing the user's source code in
1657 gcc/diagnostics/source-printing.cc
1612 1658
1613 For example, consider:1659 For example, consider:
1614 - the Unicode character U+03C0 "GREEK SMALL LETTER PI" (UTF-8: 0xCF 0x80)1660 - the Unicode character U+03C0 "GREEK SMALL LETTER PI" (UTF-8: 0xCF 0x80)

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