This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Split c_register_addr_space in separate functions for C and C++ front ends
Hi,
This is the corrected patch. Are the C++ bits also OK?
Bootstrapped on x86_64-unknown-linux gnu, and built a cross to spu-elf.
Ciao!
Steven
gcc/ChangeLog:
* c-common.h: Add FIXME for awkward split of c_register_addr_space.
* c-common.c (c_register_addr_space): Remove here.
* c-declc (c_register_addr_space): Re-add here.
cp/ChangeLog:
* tree.c (c_register_addr_space): Add stub.
Index: c-common.h
===================================================================
--- c-common.h (revision 159964)
+++ c-common.h (working copy)
@@ -799,7 +799,10 @@ extern const struct attribute_spec c_com
extern tree (*make_fname_decl) (location_t, tree, int);
+/* In c-decl.c and cp/tree.c. FIXME. */
extern void c_register_addr_space (const char *str, addr_space_t as);
+
+/* In c-common.c. */
extern const char *c_addr_space_name (addr_space_t as);
extern tree identifier_global_value (tree);
extern void record_builtin_type (enum rid, const char *, tree);
Index: c-common.c
===================================================================
--- c-common.c (revision 159964)
+++ c-common.c (working copy)
@@ -853,26 +853,6 @@ const struct attribute_spec c_common_for
{ NULL, 0, 0, false, false, false, NULL }
};
-
-/* Register reserved keyword WORD as qualifier for address space AS. */
-
-void
-c_register_addr_space (const char *word, addr_space_t as)
-{
- int rid = RID_FIRST_ADDR_SPACE + as;
- tree id;
-
- /* Address space qualifiers are only supported
- in C with GNU extensions enabled. */
- if (c_dialect_cxx () || c_dialect_objc () || flag_no_asm)
- return;
-
- id = get_identifier (word);
- C_SET_RID_CODE (id, rid);
- C_IS_RESERVED_WORD (id) = 1;
- ridpointers [rid] = id;
-}
-
/* Return identifier for address space AS. */
const char *
Index: c-decl.c
===================================================================
--- c-decl.c (revision 159964)
+++ c-decl.c (working copy)
@@ -9672,4 +9672,23 @@ c_write_global_declarations (void)
ext_block = NULL;
}
+/* Register reserved keyword WORD as qualifier for address space AS. */
+
+void
+c_register_addr_space (const char *word, addr_space_t as)
+{
+ int rid = RID_FIRST_ADDR_SPACE + as;
+ tree id;
+
+ /* Address space qualifiers are only supported
+ in C with GNU extensions enabled. */
+ if (c_dialect_objc () || flag_no_asm)
+ return;
+
+ id = get_identifier (word);
+ C_SET_RID_CODE (id, rid);
+ C_IS_RESERVED_WORD (id) = 1;
+ ridpointers [rid] = id;
+}
+
#include "gt-c-decl.h"
Index: cp/tree.c
===================================================================
--- cp/tree.c (revision 159964)
+++ cp/tree.c (working copy)
@@ -3199,6 +3199,16 @@ cp_free_lang_data (tree t)
}
}
+/* Stub for c-common. Please keep in sync with c-decl.c.
+ FIXME: If address space support is target specific, then this
+ should be a C target hook. But currently this is not possible,
+ because this function is called via REGISTER_TARGET_PRAGMAS. */
+void
+c_register_addr_space (const char *word ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED)
+{
+}
+
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
/* Complain that some language-specific thing hanging off a tree