Updated gcc patch v2 comments

This commit is contained in:
York Jasper Niebuhr 2025-10-30 21:34:57 +01:00
parent 68c42910dd
commit 9555c48024

View File

@ -1,6 +1,6 @@
From 0d2945f8e3c1b89b122fef0ded3973dfae2eb904 Mon Sep 17 00:00:00 2001 From 5b6e53085b50bd8b7c9f4cbfd77297c1134f9014 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:12:24 +0100 Date: Thu, 30 Oct 2025 21:30:06 +0100
Subject: [PATCH] c, plugin: Add c_parse_component_ref callback Subject: [PATCH] c, plugin: Add c_parse_component_ref callback
This patch supersedes my earlier submission: This patch supersedes my earlier submission:
@ -46,17 +46,23 @@ guarantees.
Signed-off-by: York Jasper Niebuhr <yjnworkstation@gmail.com> Signed-off-by: York Jasper Niebuhr <yjnworkstation@gmail.com>
--- ---
gcc/c-family/c-common.cc | 48 +++++++++++++++++++++------ gcc/c-family/c-common.cc | 52 ++++++++++++++++++++++-------
gcc/c-family/c-common.h | 3 +- gcc/c-family/c-common.h | 3 +-
gcc/c/c-parser.cc | 72 +++++++++++++++++++++++++++++++++++++++- gcc/c/c-parser.cc | 72 +++++++++++++++++++++++++++++++++++++++-
3 files changed, 110 insertions(+), 13 deletions(-) 3 files changed, 113 insertions(+), 14 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..a1c76642b12 100644
--- a/gcc/c-family/c-common.cc --- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc
@@ -7076,43 +7076,48 @@ c_common_to_target_charset (HOST_WIDE_INT c) @@ -7073,46 +7073,53 @@ c_common_to_target_charset (HOST_WIDE_INT c)
the whole expression. Return the folded result. */ /* Fold an offsetof-like expression. EXPR is a nested sequence of component
references with an INDIRECT_REF of a constant at the bottom; much like the
traditional rendering of offsetof as a macro. TYPE is the desired type of
- the whole expression. Return the folded result. */
+ the whole expression. On error, error_mark_node is returned. Compiler
+ errors are only produced if MAY_FAIL is set to false. Otherwise, the folded
+ result is returned. */
tree tree
-fold_offsetof (tree expr, tree type, enum tree_code ctx) -fold_offsetof (tree expr, tree type, enum tree_code ctx)
@ -111,7 +117,7 @@ index 587d76461e9..d34edfaa688 100644
return error_mark_node; return error_mark_node;
} }
off = size_binop_loc (input_location, PLUS_EXPR, DECL_FIELD_OFFSET (t), off = size_binop_loc (input_location, PLUS_EXPR, DECL_FIELD_OFFSET (t),
@@ -7121,7 +7126,7 @@ fold_offsetof (tree expr, tree type, enum tree_code ctx) @@ -7121,7 +7128,7 @@ fold_offsetof (tree expr, tree type, enum tree_code ctx)
break; break;
case ARRAY_REF: case ARRAY_REF:
@ -120,7 +126,7 @@ index 587d76461e9..d34edfaa688 100644
if (base == error_mark_node) if (base == error_mark_node)
return base; return base;
@@ -7178,17 +7183,38 @@ fold_offsetof (tree expr, tree type, enum tree_code ctx) @@ -7178,17 +7185,38 @@ fold_offsetof (tree expr, tree type, enum tree_code ctx)
case COMPOUND_EXPR: case COMPOUND_EXPR:
/* Handle static members of volatile structs. */ /* Handle static members of volatile structs. */
t = TREE_OPERAND (expr, 1); t = TREE_OPERAND (expr, 1);