summaryrefslogtreecommitdiff
path: root/gcc/java/parse.h
diff options
context:
space:
mode:
authorapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>2001-09-21 16:01:45 +0000
committerapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>2001-09-21 16:01:45 +0000
commit9f2cc694fb01b917c88cd6ce3b3d44c0e90b87a1 (patch)
tree30481005378fd20ffc8b2a59df9a4f96dfebfa5f /gcc/java/parse.h
parent82863d5e235b06f2fdbb514b5db470bd124814e8 (diff)
downloadgcc-9f2cc694fb01b917c88cd6ce3b3d44c0e90b87a1.tar.gz
2001-09-19 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.h: (WFL_STRIP_BRACKET): Re-written using build_type_name_from_array_name. (STRING_STRIP_BRACKETS): New macro. * parse.y (build_type_name_from_array_name): New function. (array_creation_expression:): Accumulate []s instead of [s. (cast_expression:): Accumulate []s instead of [s after cast type name. (build_array_from_name): Local string deleted, use build_type_name_from_array_name. (build_unresolved_array_type): Accumulate []s instead of [s after type name. (register_fields): Fixed comment. (resolve_class): Local name, base deleted, new locals tname and array_dims. Use build_type_name_from_array_name. Use array_dims to build array type. (purify_type_name): Use STRING_STRIP_BRACKETS. ( http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00779.html ) git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45732 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/parse.h')
-rw-r--r--gcc/java/parse.h46
1 files changed, 28 insertions, 18 deletions
diff --git a/gcc/java/parse.h b/gcc/java/parse.h
index acc60696ac6..f425750e459 100644
--- a/gcc/java/parse.h
+++ b/gcc/java/parse.h
@@ -562,24 +562,34 @@ typedef struct _jdeplist {
} \
}
-#define WFL_STRIP_BRACKET(TARGET, TYPE) \
-{ \
- tree __type = (TYPE); \
- if (TYPE && TREE_CODE (TYPE) == EXPR_WITH_FILE_LOCATION) \
- { \
- tree _node = EXPR_WFL_NODE (TYPE); \
- const char *_ptr = IDENTIFIER_POINTER (_node); \
- const char *_ref = _ptr; \
- while (_ptr[0] == '[') \
- _ptr++; \
- if (_ref != _ptr) \
- { \
- tree _new = copy_node (TYPE); \
- EXPR_WFL_NODE (_new) = get_identifier (_ptr); \
- __type = _new; \
- } \
- } \
- (TARGET) = __type; \
+#define WFL_STRIP_BRACKET(TARGET, TYPE) \
+{ \
+ tree __type = (TYPE); \
+ if (TYPE && TREE_CODE (TYPE) == EXPR_WITH_FILE_LOCATION) \
+ { \
+ tree _node; \
+ if (build_type_name_from_array_name (EXPR_WFL_NODE (TYPE), &_node)) \
+ { \
+ tree _new = copy_node (TYPE); \
+ EXPR_WFL_NODE (_new) = _node; \
+ __type = _new; \
+ } \
+ } \
+ (TARGET) = __type; \
+}
+
+/* If NAME contains one or more trailing []s, NAMELEN will be the
+ adjusted to be the index of the last non bracket character in
+ NAME. ARRAY_DIMS will contain the number of []s found. */
+
+#define STRING_STRIP_BRACKETS(NAME, NAMELEN, ARRAY_DIMS) \
+{ \
+ ARRAY_DIMS = 0; \
+ while (NAMELEN >= 2 && (NAME)[NAMELEN - 1] == ']') \
+ { \
+ NAMELEN -= 2; \
+ (ARRAY_DIMS)++; \
+ } \
}
/* Promote a type if it won't be registered as a patch */