* [objc++] RFH: PR 48167 gengtype failure (issue4291054)
@ 2011-03-18 15:53 Diego Novillo
2011-03-18 16:02 ` Laurynas Biveinis
2011-03-18 18:00 ` Nicola Pero
0 siblings, 2 replies; 9+ messages in thread
From: Diego Novillo @ 2011-03-18 15:53 UTC (permalink / raw)
To: gcc-patches, reply, mikestump, stanshebs, laurynas.biveinis
I think gengtype is failing me here, but I'm not sure. In PR 48167 we
are failing to link cc1objplus because of undefined references:
cp/parser.o:(.rodata+0x2b18): undefined reference to `gt_ggc_mx_cp_parser'
cp/parser.o:(.rodata+0x2b20): undefined reference to `gt_pch_nx_cp_parser'
cp/tree.o: In function `gt_ggc_mx_lang_tree_node':
tree.c:(.text+0xd33e): undefined reference to `gt_ggc_mx_cp_token_cache'
cp/tree.o: In function `gt_pch_nx_lang_tree_node':
tree.c:(.text+0xea2e): undefined reference to `gt_pch_nx_cp_token_cache'
cp/tree.o: In function `gt_ggc_mx_lang_decl':
tree.c:(.text+0xd23b): undefined reference to `gt_ggc_mx_cp_token_cache'
cp/tree.o: In function `gt_pch_nx_lang_decl':
tree.c:(.text+0xe923): undefined reference to `gt_pch_nx_cp_token_cache'
collect2: ld returned 1 exit status
make: *** [cc1objplus] Error 1
The problem is that those GTY functions are generated in cp/cp-lang.o,
which is not linked to cc1objplus.
The usual way of getting these functions generated is to #include the
header file in <fe>/<fe>-lang.c and add it to gtfiles in
config-lang.in (which this patch does). However, gengtype is not
generating the functions, so I'm not sure how to make it do that.
The Obj-C++ FE is kind of weird as it shares files from cp/ and objc/,
so I'm missing some other connection I need to make to fix this.
Any ideas?
Thanks. Diego.
diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in
index 5bbd27e..e2e0196 100644
--- a/gcc/objcp/Make-lang.in
+++ b/gcc/objcp/Make-lang.in
@@ -45,7 +45,7 @@ obj-c++: cc1objplus$(exeext)
.PHONY: obj-c++
START_HDRS = $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
- langhooks.h c-family/c-objc.h objc/objc-act.h
+ langhooks.h c-family/c-objc.h objc/objc-act.h $(CXX_PARSER_H)
# Use maximal warnings for this front end. Also, make ObjC and C++
# headers accessible.
diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in
index 8c3d9c5..985da17 100644
--- a/gcc/objcp/config-lang.in
+++ b/gcc/objcp/config-lang.in
@@ -37,5 +37,5 @@ build_by_default="no"
lang_requires="objc c++"
subdir_requires="objc cp"
-gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/method.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/rtti.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c "
+gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/method.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/rtti.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/objcp/objcp-lang.c"
diff --git a/gcc/objcp/objcp-lang.c b/gcc/objcp/objcp-lang.c
index fe2be66..65857b5 100644
--- a/gcc/objcp/objcp-lang.c
+++ b/gcc/objcp/objcp-lang.c
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks-def.h"
#include "target.h"
#include "cp-objcp-common.h"
+#include "parser.h"
enum c_language_kind c_language = clk_objcxx;
static void objcxx_init_ts (void);
--
This patch is available for review at http://codereview.appspot.com/4291054
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [objc++] RFH: PR 48167 gengtype failure (issue4291054)
2011-03-18 15:53 [objc++] RFH: PR 48167 gengtype failure (issue4291054) Diego Novillo
@ 2011-03-18 16:02 ` Laurynas Biveinis
2011-03-18 18:00 ` Nicola Pero
1 sibling, 0 replies; 9+ messages in thread
From: Laurynas Biveinis @ 2011-03-18 16:02 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches, reply, mikestump, stanshebs
I will be able to look into this on Monday, not earlier, sorry.
2011/3/18 Diego Novillo <dnovillo@google.com>:
> I think gengtype is failing me here, but I'm not sure. In PR 48167 we
> are failing to link cc1objplus because of undefined references:
>
> cp/parser.o:(.rodata+0x2b18): undefined reference to `gt_ggc_mx_cp_parser'
> cp/parser.o:(.rodata+0x2b20): undefined reference to `gt_pch_nx_cp_parser'
> cp/tree.o: In function `gt_ggc_mx_lang_tree_node':
> tree.c:(.text+0xd33e): undefined reference to `gt_ggc_mx_cp_token_cache'
> cp/tree.o: In function `gt_pch_nx_lang_tree_node':
> tree.c:(.text+0xea2e): undefined reference to `gt_pch_nx_cp_token_cache'
> cp/tree.o: In function `gt_ggc_mx_lang_decl':
> tree.c:(.text+0xd23b): undefined reference to `gt_ggc_mx_cp_token_cache'
> cp/tree.o: In function `gt_pch_nx_lang_decl':
> tree.c:(.text+0xe923): undefined reference to `gt_pch_nx_cp_token_cache'
> collect2: ld returned 1 exit status
> make: *** [cc1objplus] Error 1
>
> The problem is that those GTY functions are generated in cp/cp-lang.o,
> which is not linked to cc1objplus.
>
> The usual way of getting these functions generated is to #include the
> header file in <fe>/<fe>-lang.c and add it to gtfiles in
> config-lang.in (which this patch does). However, gengtype is not
> generating the functions, so I'm not sure how to make it do that.
>
> The Obj-C++ FE is kind of weird as it shares files from cp/ and objc/,
> so I'm missing some other connection I need to make to fix this.
>
> Any ideas?
>
>
> Thanks. Diego.
>
> diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in
> index 5bbd27e..e2e0196 100644
> --- a/gcc/objcp/Make-lang.in
> +++ b/gcc/objcp/Make-lang.in
> @@ -45,7 +45,7 @@ obj-c++: cc1objplus$(exeext)
> .PHONY: obj-c++
>
> START_HDRS = $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
> - langhooks.h c-family/c-objc.h objc/objc-act.h
> + langhooks.h c-family/c-objc.h objc/objc-act.h $(CXX_PARSER_H)
>
> # Use maximal warnings for this front end. Also, make ObjC and C++
> # headers accessible.
> diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in
> index 8c3d9c5..985da17 100644
> --- a/gcc/objcp/config-lang.in
> +++ b/gcc/objcp/config-lang.in
> @@ -37,5 +37,5 @@ build_by_default="no"
> lang_requires="objc c++"
> subdir_requires="objc cp"
>
> -gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/method.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/rtti.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c "
> +gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/method.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/rtti.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/objcp/objcp-lang.c"
>
> diff --git a/gcc/objcp/objcp-lang.c b/gcc/objcp/objcp-lang.c
> index fe2be66..65857b5 100644
> --- a/gcc/objcp/objcp-lang.c
> +++ b/gcc/objcp/objcp-lang.c
> @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
> #include "langhooks-def.h"
> #include "target.h"
> #include "cp-objcp-common.h"
> +#include "parser.h"
>
> enum c_language_kind c_language = clk_objcxx;
> static void objcxx_init_ts (void);
>
> --
> This patch is available for review at http://codereview.appspot.com/4291054
>
--
Laurynas
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [objc++] RFH: PR 48167 gengtype failure (issue4291054)
2011-03-18 15:53 [objc++] RFH: PR 48167 gengtype failure (issue4291054) Diego Novillo
2011-03-18 16:02 ` Laurynas Biveinis
@ 2011-03-18 18:00 ` Nicola Pero
2011-03-18 18:40 ` Basile Starynkevitch
` (3 more replies)
1 sibling, 4 replies; 9+ messages in thread
From: Nicola Pero @ 2011-03-18 18:00 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches, reply, mikestump, stanshebs, laurynas.biveinis
[-- Attachment #1: Type: text/plain, Size: 6844 bytes --]
> The Obj-C++ FE is kind of weird as it shares files from cp/ and objc/,
> so I'm missing some other connection I need to make to fix this.
>
> Any ideas?
As far as I can see, the problem is that header files (such as cp/parser.h)
generate GC stuff that gets put into gtype-{lang}.h, where {lang} is determined
by looking at the directory where the file is (eg, if it's in the cp/ directory,
then {lang} is cp) ... unless you override this with a custom hardcoded rule in
gengtype.c.
It seems that all files that are shared between ObjC or C++ and ObjC++ have custom
hardcoded rules in gengtype.c. The cp/parser.h file you added didn't, and without
it, every time it is processed, the results are stored in gtype-cp.h even if the
file is processed for ObjC++. :-(
This all looks ugly. Anyhow, until someone refactors everything, the following
patch fixes ObjC++ bootstrap in trunk by processing cp/parser.h in the same way
as the other C++ headers are processed. :-)
Ok to commit ?
Thanks
Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c (revision 171155)
+++ gcc/gengtype.c (working copy)
@@ -1761,6 +1761,12 @@
matters, so change with extreme care! */
struct file_rule_st files_rules[] = {
+ /* The general rule assumes that files in subdirectories belong to a
+ particular front-end, and files not in subdirectories are shared.
+ The following rules deal with exceptions - files that are in
+ subdirectories and yet are shared, and files that are top-level,
+ but are not shared. */
+
/* the c-family/ source directory is special. */
{ DIR_PREFIX_REGEX "c-family/([[:alnum:]_-]*)\\.c$",
REG_EXTENDED, NULL_REGEX,
@@ -1792,7 +1798,12 @@
REG_EXTENDED, NULL_REGEX,
"gt-cp-name-lookup.h", "cp/name-lookup.c", NULL_FRULACT },
- /* objc/objc-act.h fives gt-objc-objc-act.h for objc/objc-act.c ! */
+ /* cp/parser.h gives gt-cp-parser.h for cp/parser.c ! */
+ { DIR_PREFIX_REGEX "cp/parser\\.h$",
+ REG_EXTENDED, NULL_REGEX,
+ "gt-cp-parser.h", "cp/parser.c", NULL_FRULACT },
+
+ /* objc/objc-act.h gives gt-objc-objc-act.h for objc/objc-act.c ! */
{ DIR_PREFIX_REGEX "objc/objc-act\\.h$",
REG_EXTENDED, NULL_REGEX,
"gt-objc-objc-act.h", "objc/objc-act.c", NULL_FRULACT },
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog (revision 171155)
+++ gcc/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2011-03-18 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * gengtype.c (files_rules): Added rule for cp/parser.h.
+
2011-03-18 Maxim Kuvyrkov <maxim@codesourcery.com>
PR rtl-optimization/48170
Index: gcc/objcp/Make-lang.in
===================================================================
--- gcc/objcp/Make-lang.in (revision 171155)
+++ gcc/objcp/Make-lang.in (working copy)
@@ -45,7 +45,7 @@
.PHONY: obj-c++
START_HDRS = $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
- langhooks.h c-family/c-objc.h objc/objc-act.h
+ $(CXX_PARSER_H) $(CXX_PRETTY_PRINT_H) langhooks.h c-family/c-objc.h objc/objc-act.h
# Use maximal warnings for this front end. Also, make ObjC and C++
# headers accessible.
@@ -78,7 +78,7 @@
objcp/objcp-lang.o : objcp/objcp-lang.c $(START_HDRS) \
$(C_COMMON_H) $(LANGHOOKS_DEF_H) cp/cp-objcp-common.h \
- $(TARGET_H) gtype-objcp.h
+ $(TARGET_H) gtype-objcp.h
objcp/objcp-decl.o : objcp/objcp-decl.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
Index: gcc/objcp/ChangeLog
===================================================================
--- gcc/objcp/ChangeLog (revision 171155)
+++ gcc/objcp/ChangeLog (working copy)
@@ -1,3 +1,11 @@
+2011-03-17 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Make-lang.in (START_HDRS): Added CXX_PARSER_H and
+ CXX_PRETTY_PRINT_H.
+ * config-lang.in (gtfiles): Added cp/parser.h and reorganized list
+ so that it is more obvious that it is identical to the C++ one
+ with the addition of some files at the end.
+
2011-03-06 Joseph Myers <joseph@codesourcery.com>
* lang-specs.h: Match -save-temps* instead of -save-temps.
Index: gcc/objcp/config-lang.in
===================================================================
--- gcc/objcp/config-lang.in (revision 171155)
+++ gcc/objcp/config-lang.in (working copy)
@@ -37,5 +37,14 @@
lang_requires="objc c++"
subdir_requires="objc cp"
-gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/method.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/rtti.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c "
+# When you add to this gtfiles list a header which comes from a
+# directory belonging to another language (ie, C++ or ObjC), you need
+# to also edit gengtype.c adding a special rule for the header to
+# avoid having the GC stuff from that header being added to gtype-cp.h
+# or gtype-objc.h.
+# This list is separated in two parts: the first one is identical to
+# the C++ one, the second one contains our ObjC++ additions.
+gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \
+\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c-family/c-cppbuiltin.c"
+
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 5598 bytes --]
Index: gengtype.c
===================================================================
--- gengtype.c (revision 171138)
+++ gengtype.c (working copy)
@@ -1761,6 +1761,12 @@
matters, so change with extreme care! */
struct file_rule_st files_rules[] = {
+ /* The general rule assumes that files in subdirectories belong to a
+ special front-end, and files not in subdirectories are shared.
+ The following rules deal with exceptions - files that are in
+ subdirectories and yet are shared, and files that are top-level,
+ but are not shared. */
+
/* the c-family/ source directory is special. */
{ DIR_PREFIX_REGEX "c-family/([[:alnum:]_-]*)\\.c$",
REG_EXTENDED, NULL_REGEX,
@@ -1792,7 +1798,12 @@
REG_EXTENDED, NULL_REGEX,
"gt-cp-name-lookup.h", "cp/name-lookup.c", NULL_FRULACT },
- /* objc/objc-act.h fives gt-objc-objc-act.h for objc/objc-act.c ! */
+ /* cp/parser.h gives gt-cp-parser.h for cp/parser.c ! */
+ { DIR_PREFIX_REGEX "cp/parser\\.h$",
+ REG_EXTENDED, NULL_REGEX,
+ "gt-cp-parser.h", "cp/parser.c", NULL_FRULACT },
+
+ /* objc/objc-act.h gives gt-objc-objc-act.h for objc/objc-act.c ! */
{ DIR_PREFIX_REGEX "objc/objc-act\\.h$",
REG_EXTENDED, NULL_REGEX,
"gt-objc-objc-act.h", "objc/objc-act.c", NULL_FRULACT },
Index: ChangeLog
===================================================================
--- ChangeLog (revision 171138)
+++ ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2011-03-18 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * gengtype.c (files_rules): Added rule for cp/parser.h.
+
2011-03-18 Chung-Lin Tang <cltang@codesourcery.com>
* combine.c (try_combine): Do simplification only call of
Index: objcp/Make-lang.in
===================================================================
--- objcp/Make-lang.in (revision 171138)
+++ objcp/Make-lang.in (working copy)
@@ -45,7 +45,7 @@
.PHONY: obj-c++
START_HDRS = $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
- langhooks.h c-family/c-objc.h objc/objc-act.h
+ $(CXX_PARSER_H) $(CXX_PRETTY_PRINT_H) langhooks.h c-family/c-objc.h objc/objc-act.h
# Use maximal warnings for this front end. Also, make ObjC and C++
# headers accessible.
@@ -78,7 +78,7 @@
objcp/objcp-lang.o : objcp/objcp-lang.c $(START_HDRS) \
$(C_COMMON_H) $(LANGHOOKS_DEF_H) cp/cp-objcp-common.h \
- $(TARGET_H) gtype-objcp.h
+ $(TARGET_H) gtype-objcp.h
objcp/objcp-decl.o : objcp/objcp-decl.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
Index: objcp/ChangeLog
===================================================================
--- objcp/ChangeLog (revision 171138)
+++ objcp/ChangeLog (working copy)
@@ -1,3 +1,11 @@
+2011-03-17 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Make-lang.in (START_HDRS): Added CXX_PARSER_H and
+ CXX_PRETTY_PRINT_H.
+ * config-lang.in (gtfiles): Added cp/parser.h and reorganized list
+ so that it is more obvious that it is identical to the C++ one
+ with the addition of some files at the end.
+
2011-03-06 Joseph Myers <joseph@codesourcery.com>
* lang-specs.h: Match -save-temps* instead of -save-temps.
Index: objcp/config-lang.in
===================================================================
--- objcp/config-lang.in (revision 171138)
+++ objcp/config-lang.in (working copy)
@@ -37,5 +37,14 @@
lang_requires="objc c++"
subdir_requires="objc cp"
-gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/method.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/rtti.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c "
+# When you add to this gtfiles list a header which comes from a
+# directory belonging to another language (ie, C++ or ObjC), you need
+# to also edit gengtype.c adding a special rule for the header to
+# avoid having the GC stuff from that header being added to gtype-cp.h
+# or gtype-objc.h.
+# This list is separated in two parts: the first one is identical to
+# the C++ one, the second one contains our ObjC++ additions.
+gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \
+\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c-family/c-cppbuiltin.c"
+
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [objc++] RFH: PR 48167 gengtype failure (issue4291054)
2011-03-18 18:00 ` Nicola Pero
@ 2011-03-18 18:40 ` Basile Starynkevitch
2011-03-18 19:50 ` Diego Novillo
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Basile Starynkevitch @ 2011-03-18 18:40 UTC (permalink / raw)
To: Nicola Pero
Cc: Diego Novillo, gcc-patches, reply, mikestump, stanshebs,
laurynas.biveinis
On Fri, 18 Mar 2011 18:59:47 +0100 (CET)
"Nicola Pero" <nicola.pero@meta-innovation.com> wrote:
>
> > The Obj-C++ FE is kind of weird as it shares files from cp/ and objc/,
> > so I'm missing some other connection I need to make to fix this.
>
> This all looks ugly. Anyhow, until someone refactors everything, the following
> patch fixes ObjC++ bootstrap in trunk by processing cp/parser.h in the same way
> as the other C++ headers are processed. :-)
>
> Ok to commit ?
I don't have authority to Ok, but I find your patch nice (and I believe
that it illustrates the fact that adding some regexp rules to gengtype
was a good idea).
Regards!
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [objc++] RFH: PR 48167 gengtype failure (issue4291054)
2011-03-18 18:00 ` Nicola Pero
2011-03-18 18:40 ` Basile Starynkevitch
@ 2011-03-18 19:50 ` Diego Novillo
2011-03-18 20:17 ` Nicola Pero
2011-03-19 4:04 ` Mike Stump
2011-03-21 8:20 ` Laurynas Biveinis
3 siblings, 1 reply; 9+ messages in thread
From: Diego Novillo @ 2011-03-18 19:50 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches, reply, mikestump, stanshebs, laurynas.biveinis
On Fri, Mar 18, 2011 at 13:59, Nicola Pero
<nicola.pero@meta-innovation.com> wrote:
>
>> The Obj-C++ FE is kind of weird as it shares files from cp/ and objc/,
>> so I'm missing some other connection I need to make to fix this.
>>
>> Any ideas?
>
> As far as I can see, the problem is that header files (such as cp/parser.h)
> generate GC stuff that gets put into gtype-{lang}.h, where {lang} is determined
> by looking at the directory where the file is (eg, if it's in the cp/ directory,
> then {lang} is cp) ... unless you override this with a custom hardcoded rule in
> gengtype.c.
Oh! That's what I was missing. Thanks for the fix.
>
> It seems that all files that are shared between ObjC or C++ and ObjC++ have custom
> hardcoded rules in gengtype.c. The cp/parser.h file you added didn't, and without
> it, every time it is processed, the results are stored in gtype-cp.h even if the
> file is processed for ObjC++. :-(
Ugh.
> This all looks ugly. Anyhow, until someone refactors everything, the following
> patch fixes ObjC++ bootstrap in trunk by processing cp/parser.h in the same way
> as the other C++ headers are processed. :-)
>
> Ok to commit ?
>
> Thanks
>
> Index: gcc/gengtype.c
> ===================================================================
> --- gcc/gengtype.c (revision 171155)
> +++ gcc/gengtype.c (working copy)
> @@ -1761,6 +1761,12 @@
> matters, so change with extreme care! */
>
> struct file_rule_st files_rules[] = {
> + /* The general rule assumes that files in subdirectories belong to a
> + particular front-end, and files not in subdirectories are shared.
> + The following rules deal with exceptions - files that are in
> + subdirectories and yet are shared, and files that are top-level,
> + but are not shared. */
> +
> /* the c-family/ source directory is special. */
> { DIR_PREFIX_REGEX "c-family/([[:alnum:]_-]*)\\.c$",
> REG_EXTENDED, NULL_REGEX,
> @@ -1792,7 +1798,12 @@
> REG_EXTENDED, NULL_REGEX,
> "gt-cp-name-lookup.h", "cp/name-lookup.c", NULL_FRULACT },
>
> - /* objc/objc-act.h fives gt-objc-objc-act.h for objc/objc-act.c ! */
> + /* cp/parser.h gives gt-cp-parser.h for cp/parser.c ! */
> + { DIR_PREFIX_REGEX "cp/parser\\.h$",
> + REG_EXTENDED, NULL_REGEX,
> + "gt-cp-parser.h", "cp/parser.c", NULL_FRULACT },
But cp/parser.c also gets its own gt-cp-parser.h. Won't they
conflict? Doesn't this mean that cp/parser.h should be renamed to
something else? (say cp/cp-parser.h).
Other than that, it looks fine.
Diego.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [objc++] RFH: PR 48167 gengtype failure (issue4291054)
2011-03-18 19:50 ` Diego Novillo
@ 2011-03-18 20:17 ` Nicola Pero
2011-03-18 21:14 ` Diego Novillo
0 siblings, 1 reply; 9+ messages in thread
From: Nicola Pero @ 2011-03-18 20:17 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches, reply, mikestump, stanshebs, laurynas.biveinis
>> + /* cp/parser.h gives gt-cp-parser.h for cp/parser.c ! */
>> + { DIR_PREFIX_REGEX "cp/parser\\.h$",
>> + REG_EXTENDED, NULL_REGEX,
>> + "gt-cp-parser.h", "cp/parser.c", NULL_FRULACT },
>
> But cp/parser.c also gets its own gt-cp-parser.h. Won't they
> conflict? Doesn't this mean that cp/parser.h should be renamed to
> something else? (say cp/cp-parser.h).
My understanding is that, with that rule, GC generated code from
cp-parser.h will end up into gt-cp-parser.h, together with the code
generated from cp-parser.c. gengtype basically runs once for all
files, so has no problem putting GC generated code from multiple
input files into the same output file.
In practical terms, cp/decl.c and cp/decl.h (or cp/name-lookup.c
and cp/name-lookup.h) are in a similar situation, and work fine
with similar gengtype.c rules. :-)
Thanks
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [objc++] RFH: PR 48167 gengtype failure (issue4291054)
2011-03-18 20:17 ` Nicola Pero
@ 2011-03-18 21:14 ` Diego Novillo
0 siblings, 0 replies; 9+ messages in thread
From: Diego Novillo @ 2011-03-18 21:14 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches, reply, mikestump, stanshebs, laurynas.biveinis
On Fri, Mar 18, 2011 at 16:17, Nicola Pero
<nicola.pero@meta-innovation.com> wrote:
>
>>> + /* cp/parser.h gives gt-cp-parser.h for cp/parser.c ! */
>>> + { DIR_PREFIX_REGEX "cp/parser\\.h$",
>>> + REG_EXTENDED, NULL_REGEX,
>>> + "gt-cp-parser.h", "cp/parser.c", NULL_FRULACT },
>>
>> But cp/parser.c also gets its own gt-cp-parser.h. Won't they
>> conflict? Doesn't this mean that cp/parser.h should be renamed to
>> something else? (say cp/cp-parser.h).
>
> My understanding is that, with that rule, GC generated code from
> cp-parser.h will end up into gt-cp-parser.h, together with the code
> generated from cp-parser.c. gengtype basically runs once for all
> files, so has no problem putting GC generated code from multiple
> input files into the same output file.
OK, thanks.
I'm OK with the patch, but please wait for a specific approval from
Laurynas. I'm not sufficiently familiar with this code to give final
approval.
Diego.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [objc++] RFH: PR 48167 gengtype failure (issue4291054)
2011-03-18 18:00 ` Nicola Pero
2011-03-18 18:40 ` Basile Starynkevitch
2011-03-18 19:50 ` Diego Novillo
@ 2011-03-19 4:04 ` Mike Stump
2011-03-21 8:20 ` Laurynas Biveinis
3 siblings, 0 replies; 9+ messages in thread
From: Mike Stump @ 2011-03-19 4:04 UTC (permalink / raw)
To: Nicola Pero
Cc: Diego Novillo, gcc-patches, reply, stanshebs, laurynas.biveinis
On Mar 18, 2011, at 10:59 AM, Nicola Pero wrote:
> This all looks ugly. Anyhow, until someone refactors everything, the following
> patch fixes ObjC++ bootstrap in trunk by processing cp/parser.h in the same way
> as the other C++ headers are processed. :-)
>
> Ok to commit ?
Ok for the Objective parts. Thanks for the work.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [objc++] RFH: PR 48167 gengtype failure (issue4291054)
2011-03-18 18:00 ` Nicola Pero
` (2 preceding siblings ...)
2011-03-19 4:04 ` Mike Stump
@ 2011-03-21 8:20 ` Laurynas Biveinis
3 siblings, 0 replies; 9+ messages in thread
From: Laurynas Biveinis @ 2011-03-21 8:20 UTC (permalink / raw)
To: Nicola Pero; +Cc: Diego Novillo, gcc-patches, reply, mikestump, stanshebs
2011/3/18 Nicola Pero <nicola.pero@meta-innovation.com>:
> Index: gcc/ChangeLog
> ===================================================================
> --- gcc/ChangeLog (revision 171155)
> +++ gcc/ChangeLog (working copy)
> @@ -1,3 +1,7 @@
> +2011-03-18 Nicola Pero <nicola.pero@meta-innovation.com>
> +
> + * gengtype.c (files_rules): Added rule for cp/parser.h.
> +
The gengtype parts are OK. Thanks and sorry for the delay.
--
Laurynas
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-03-21 8:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-18 15:53 [objc++] RFH: PR 48167 gengtype failure (issue4291054) Diego Novillo
2011-03-18 16:02 ` Laurynas Biveinis
2011-03-18 18:00 ` Nicola Pero
2011-03-18 18:40 ` Basile Starynkevitch
2011-03-18 19:50 ` Diego Novillo
2011-03-18 20:17 ` Nicola Pero
2011-03-18 21:14 ` Diego Novillo
2011-03-19 4:04 ` Mike Stump
2011-03-21 8:20 ` Laurynas Biveinis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).