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 @@
11 /* Definitions for CPP library.
2− Copyright (C) 1995-2025 Free Software Foundation, Inc.
2+ Copyright (C) 1995-2026 Free Software Foundation, Inc.
33 Written by Per Bothner, 1994-95.
44
55 This program is free software; you can redistribute it and/or modify it
@@ -101,6 +101,8 @@ class rich_location; · 95 unmodified lines
101101 OP(CLOSE_SQUARE, "]") \
102102 OP(OPEN_BRACE, "{") \
103103 OP(CLOSE_BRACE, "}") \
104+ OP(OPEN_SPLICE, "[:") \
105+ OP(CLOSE_SPLICE, ":]") \
104106 /* The remainder of the punctuation. Order is not significant. */ \
105107 OP(SEMICOLON, ";") /* structure */ \
106108 OP(ELLIPSIS, "...") \
@@ -111,6 +113,7 @@ class rich_location; · 4 unmodified lines
111113 OP(SCOPE, "::") \
112114 OP(DEREF_STAR, "->*") \
113115 OP(DOT_STAR, ".*") \
116+ OP(REFLECT_OP, "^^") \
114117 OP(ATSIGN, "@") /* used in Objective-C */ \
115118 \
116119 TK(NAME, IDENT) /* word */ \
@@ -435,6 +438,10 @@ struct cpp_options · 318 unmodified lines
435438 Presumably the usage is protected by the appropriate #ifdef. */
436439 unsigned char warn_variadic_macros;
437440
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+
438445 /* Nonzero means warn about builtin macros that are redefined or
439446 explicitly undefined. */
440447 unsigned char warn_builtin_macro_redefined;
@@ -620,6 +627,9 @@ struct cpp_options · 179 unmodified lines
620627 /* True if -finput-charset= option has been used explicitly. */
621628 bool cpp_input_charset_explicit;
622629
630+ /* True if -Wkeyword-macro. */
631+ bool cpp_warn_keyword_macro;
632+
623633 /* -Wleading-whitespace= value. */
624634 unsigned char cpp_warn_leading_whitespace;
625635
@@ -757,7 +767,8 @@ enum cpp_warning_reason { · 131 unmodified lines
757767 CPP_W_HEADER_GUARD,
758768 CPP_W_PRAGMA_ONCE_OUTSIDE_HEADER,
759769 CPP_W_LEADING_WHITESPACE,
760− CPP_W_TRAILING_WHITESPACE
770+ CPP_W_TRAILING_WHITESPACE,
771+ CPP_W_KEYWORD_MACRO
761772 };
762773
763774 /* Callback for header lookup for HEADER, which is the name of a
@@ -852,7 +863,8 @@ struct cpp_callbacks · 88 unmodified lines
852863 /* Maybe translate a #include into something else. Return a
853864 cpp_buffer containing the translation if translating. */
854865 char *(*translate_include) (cpp_reader *, line_maps *, location_t,
855− const char *path);
866+ _cpp_file *file, bool angle_brackets,
867+ const char **alternate);
856868 };
857869
858870 #ifdef VMS
@@ -1169,6 +1181,8 @@ extern const char *cpp_probe_header_unit (cpp_reader *, const char *file, · 310 unmodified lines
11691181 extern const char *cpp_get_narrow_charset_name (cpp_reader *) ATTRIBUTE_PURE;
11701182 extern const char *cpp_get_wide_charset_name (cpp_reader *) ATTRIBUTE_PURE;
11711183
1184+extern location_t cpp_get_diagnostic_override_loc (const cpp_reader *);
1185+
11721186 /* This function reads the file, but does not start preprocessing. It
11731187 returns the name of the original file; this is the same as the
11741188 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
12481262 return cpp_user_macro_p (node) && node->value.macro->fun_like;
12491263 }
12501264
1265+/* Return true for nodes marked for -Wkeyword-macro diagnostics. */
1266+inline 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+
12511276 extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *);
12521277 extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *,
12531278 const cpp_macro *);
@@ -1284,6 +1309,9 @@ extern const char *cpp_interpret_string_ranges (cpp_reader *pfile, · 30 unmodified lines
12841309 extern bool cpp_interpret_string_notranslate (cpp_reader *,
12851310 const cpp_string *, size_t,
12861311 cpp_string *, enum cpp_ttype);
1312+extern bool cpp_translate_string (cpp_reader *, const cpp_string *,
1313+ cpp_string *, enum cpp_ttype, bool);
1314+extern bool cpp_valid_identifier (cpp_reader *, const unsigned char *);
12871315
12881316 /* Convert a host character constant to the execution character set. */
12891317 extern 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
15091537 extern cpp_hashnode *cpp_lookup (cpp_reader *, const unsigned char *,
15101538 unsigned int);
15111539
1540+/* Set NODE_WARN flag for NAME, such that there will be diagnostics
1541+ for #define or #undef of NAME. */
1542+
1543+inline void
1544+cpp_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+
1549+inline void
1550+cpp_warn (cpp_reader *pfile, const char *name)
1551+{
1552+ cpp_warn (pfile, name, strlen (name));
1553+}
1554+
15121555 typedef int (*cpp_cb) (cpp_reader *, cpp_hashnode *, void *);
15131556 extern void cpp_forall_identifiers (cpp_reader *, cpp_cb, void *);
15141557
@@ -1527,8 +1570,10 @@ extern void cpp_make_system_header (cpp_reader *, int, int); · 12 unmodified lines
15271570 extern bool cpp_push_include (cpp_reader *, const char *);
15281571 extern bool cpp_push_default_include (cpp_reader *, const char *);
15291572 extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *);
1530−extern const char *cpp_get_path (struct _cpp_file *);
1531−extern cpp_dir *cpp_get_dir (struct _cpp_file *);
1573+extern const char *_cpp_get_file_path (_cpp_file *);
1574+extern const char *_cpp_get_file_name (_cpp_file *);
1575+extern struct stat *_cpp_get_file_stat (_cpp_file *);
1576+extern struct cpp_dir *_cpp_get_file_dir (_cpp_file *);
15321577 extern cpp_buffer *cpp_get_buffer (cpp_reader *);
15331578 extern struct _cpp_file *cpp_get_file (cpp_buffer *);
15341579 extern cpp_buffer *cpp_get_prev (cpp_buffer *);
@@ -1608,7 +1653,8 @@ struct cpp_decoded_char · 73 unmodified lines
16081653 This is a tabstop value, along with a callback for getting the
16091654 widths of characters. Normally this callback is cpp_wcwidth, but we
16101655 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.cc
1656+ ASCII chars when printing the user's source code in
1657+ gcc/diagnostics/source-printing.cc
16121658
16131659 For example, consider:
16141660 - 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