Updated GCC patch v2 to ensure visibility to plugins
This commit is contained in:
parent
156da90260
commit
060d7685c6
@ -1,13 +1,13 @@
|
|||||||
From 474c2208836a447bb2452a45a0e76453b1d9c56c Mon Sep 17 00:00:00 2001
|
From 0d2945f8e3c1b89b122fef0ded3973dfae2eb904 Mon Sep 17 00:00:00 2001
|
||||||
From: York Jasper Niebuhr <yjnworkstation@gmail.com>
|
From: York Jasper Niebuhr <yjnworkstation@gmail.com>
|
||||||
Date: Thu, 30 Oct 2025 13:04:18 +0100
|
Date: Thu, 30 Oct 2025 13:12:24 +0100
|
||||||
Subject: [PATCH] c_parse_component_ref callback
|
Subject: [PATCH] c_parse_component_ref callback
|
||||||
|
|
||||||
---
|
---
|
||||||
gcc/c-family/c-common.cc | 48 ++++++++++++++++++++-------
|
gcc/c-family/c-common.cc | 48 +++++++++++++++++++++------
|
||||||
gcc/c-family/c-common.h | 3 +-
|
gcc/c-family/c-common.h | 3 +-
|
||||||
gcc/c/c-parser.cc | 70 +++++++++++++++++++++++++++++++++++++++-
|
gcc/c/c-parser.cc | 72 +++++++++++++++++++++++++++++++++++++++-
|
||||||
3 files changed, 108 insertions(+), 13 deletions(-)
|
3 files changed, 110 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
|
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
|
||||||
index 587d76461e9..d34edfaa688 100644
|
index 587d76461e9..d34edfaa688 100644
|
||||||
@ -135,10 +135,10 @@ index ea6c2975056..70fcfeb6661 100644
|
|||||||
extern int complete_array_type (tree *, tree, bool);
|
extern int complete_array_type (tree *, tree, bool);
|
||||||
extern void complete_flexible_array_elts (tree);
|
extern void complete_flexible_array_elts (tree);
|
||||||
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
|
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
|
||||||
index 22ec0f849b7..5410b9dc003 100644
|
index 22ec0f849b7..08cf0d9839b 100644
|
||||||
--- a/gcc/c/c-parser.cc
|
--- a/gcc/c/c-parser.cc
|
||||||
+++ b/gcc/c/c-parser.cc
|
+++ b/gcc/c/c-parser.cc
|
||||||
@@ -11354,6 +11354,62 @@ get_counted_by_ref (tree array_ref)
|
@@ -11354,6 +11354,64 @@ get_counted_by_ref (tree array_ref)
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,8 @@ index 22ec0f849b7..5410b9dc003 100644
|
|||||||
+ the expression unchanged.
|
+ the expression unchanged.
|
||||||
+
|
+
|
||||||
+ This callback is intended for plugins that wish to observe or transform
|
+ This callback is intended for plugins that wish to observe or transform
|
||||||
+ member-access expressions (such as 'a.b' or 'a->b') or at parse time. */
|
+ member-access expressions (such as 'a.b' or 'a->b') or offsetof expressions
|
||||||
|
+ at parse time. */
|
||||||
+using c_parse_component_ref_cb_t = tree (*)(tree ref);
|
+using c_parse_component_ref_cb_t = tree (*)(tree ref);
|
||||||
+
|
+
|
||||||
+/* Plugin-registered callback for COMPONENT_REF parse notifications.
|
+/* Plugin-registered callback for COMPONENT_REF parse notifications.
|
||||||
@ -162,6 +163,7 @@ index 22ec0f849b7..5410b9dc003 100644
|
|||||||
+
|
+
|
||||||
+ Only a single callback is supported; registering a new one replaces
|
+ Only a single callback is supported; registering a new one replaces
|
||||||
+ any previously registered callback. */
|
+ any previously registered callback. */
|
||||||
|
+__attribute__ ((visibility ("default")))
|
||||||
+void
|
+void
|
||||||
+register_c_parse_component_ref_cb (c_parse_component_ref_cb_t cb)
|
+register_c_parse_component_ref_cb (c_parse_component_ref_cb_t cb)
|
||||||
+{
|
+{
|
||||||
@ -201,7 +203,7 @@ index 22ec0f849b7..5410b9dc003 100644
|
|||||||
/* Parse a postfix expression (C90 6.3.1-6.3.2, C99 6.5.1-6.5.2,
|
/* Parse a postfix expression (C90 6.3.1-6.3.2, C99 6.5.1-6.5.2,
|
||||||
C11 6.5.1-6.5.2). Compound literals aren't handled here; callers have to
|
C11 6.5.1-6.5.2). Compound literals aren't handled here; callers have to
|
||||||
call c_parser_postfix_expression_after_paren_type on encountering them.
|
call c_parser_postfix_expression_after_paren_type on encountering them.
|
||||||
@@ -11766,6 +11822,9 @@ c_parser_postfix_expression (c_parser *parser)
|
@@ -11766,6 +11824,9 @@ c_parser_postfix_expression (c_parser *parser)
|
||||||
= build_component_ref (loc, offsetof_ref, comp_tok->value,
|
= build_component_ref (loc, offsetof_ref, comp_tok->value,
|
||||||
comp_tok->location, UNKNOWN_LOCATION,
|
comp_tok->location, UNKNOWN_LOCATION,
|
||||||
false);
|
false);
|
||||||
@ -211,7 +213,7 @@ index 22ec0f849b7..5410b9dc003 100644
|
|||||||
c_parser_consume_token (parser);
|
c_parser_consume_token (parser);
|
||||||
while (c_parser_next_token_is (parser, CPP_DOT)
|
while (c_parser_next_token_is (parser, CPP_DOT)
|
||||||
|| c_parser_next_token_is (parser,
|
|| c_parser_next_token_is (parser,
|
||||||
@@ -11800,6 +11859,9 @@ c_parser_postfix_expression (c_parser *parser)
|
@@ -11800,6 +11861,9 @@ c_parser_postfix_expression (c_parser *parser)
|
||||||
comp_tok->location,
|
comp_tok->location,
|
||||||
UNKNOWN_LOCATION,
|
UNKNOWN_LOCATION,
|
||||||
false);
|
false);
|
||||||
@ -221,7 +223,7 @@ index 22ec0f849b7..5410b9dc003 100644
|
|||||||
c_parser_consume_token (parser);
|
c_parser_consume_token (parser);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -11823,7 +11885,7 @@ c_parser_postfix_expression (c_parser *parser)
|
@@ -11823,7 +11887,7 @@ c_parser_postfix_expression (c_parser *parser)
|
||||||
location_t end_loc = c_parser_peek_token (parser)->get_finish ();
|
location_t end_loc = c_parser_peek_token (parser)->get_finish ();
|
||||||
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
|
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
|
||||||
"expected %<)%>");
|
"expected %<)%>");
|
||||||
@ -230,7 +232,7 @@ index 22ec0f849b7..5410b9dc003 100644
|
|||||||
set_c_expr_source_range (&expr, loc, end_loc);
|
set_c_expr_source_range (&expr, loc, end_loc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -13771,6 +13833,9 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
|
@@ -13771,6 +13835,9 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
|
||||||
c_parser_consume_token (parser);
|
c_parser_consume_token (parser);
|
||||||
expr.value = build_component_ref (op_loc, expr.value, ident,
|
expr.value = build_component_ref (op_loc, expr.value, ident,
|
||||||
comp_loc, UNKNOWN_LOCATION);
|
comp_loc, UNKNOWN_LOCATION);
|
||||||
@ -240,7 +242,7 @@ index 22ec0f849b7..5410b9dc003 100644
|
|||||||
set_c_expr_source_range (&expr, start, finish);
|
set_c_expr_source_range (&expr, start, finish);
|
||||||
expr.original_code = ERROR_MARK;
|
expr.original_code = ERROR_MARK;
|
||||||
if (TREE_CODE (expr.value) != COMPONENT_REF)
|
if (TREE_CODE (expr.value) != COMPONENT_REF)
|
||||||
@@ -13813,6 +13878,9 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
|
@@ -13813,6 +13880,9 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
|
||||||
RO_ARROW),
|
RO_ARROW),
|
||||||
ident, comp_loc,
|
ident, comp_loc,
|
||||||
expr.get_location ());
|
expr.get_location ());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user