From: Ian Lance Taylor <iant@google.com>
To: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Cc: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com
Subject: Re: Go patch committed: Update to current Go library
Date: Tue, 24 May 2011 21:33:00 -0000 [thread overview]
Message-ID: <mcrk4dfhm6q.fsf@coign.corp.google.com> (raw)
In-Reply-To: <yddoc2xxza0.fsf@manam.CeBiTec.Uni-Bielefeld.DE> (Rainer Orth's message of "Fri, 20 May 2011 15:44:07 +0200")
[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> <pwd.h> includes <stdio.h>, which leads to
>
> // type ___FILE struct { _cnt int32; _ptr *uint8; _base *uint8; _flag uint8; _magic uint8; __orientation INVALID-bit-field; __ionolock INVALID-bit-field; __seekable INVALID-bit-field; __extendedfd INVALID-bit-field; __xf_nocheck INVALID-bit-field; __filler INVALID-bit-field; }
> // type _FILE struct { _cnt int32; _ptr *uint8; _base *uint8; _flag uint8; _magi
> c uint8; __orientation INVALID-bit-field; __ionolock INVALID-bit-field; __seekab
> le INVALID-bit-field; __extendedfd INVALID-bit-field; __xf_nocheck INVALID-bit-f
> ield; __filler INVALID-bit-field; }
> var ___iob [59+1]___FILE
> var __lastbuf *_FILE
>
> in gen-sysinfo.go.
I just committed a patch to godump.c which I think should fix this
issue. Let me know if it doesn't.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
2011-05-24 Ian Lance Taylor <iant@google.com>
* godump.c (struct godump_container): Add invalid_hash field.
(go_format_type): Return false if type is found in invalid_hash.
(go_output_typedef): Add invalid type to invalid_hash.
(go_finish): Create and delete invalid_hash.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3090 bytes --]
Index: godump.c
===================================================================
--- godump.c (revision 174138)
+++ godump.c (working copy)
@@ -464,6 +464,9 @@ struct godump_container
/* Global type definitions. */
htab_t type_hash;
+ /* Invalid types. */
+ htab_t invalid_hash;
+
/* Obstack used to write out a type definition. */
struct obstack type_obstack;
};
@@ -500,20 +503,20 @@ go_format_type (struct godump_container
|| TREE_CODE (type) == FUNCTION_TYPE))
{
tree name;
+ void **slot;
name = TYPE_NAME (type);
- if (TREE_CODE (name) == IDENTIFIER_NODE)
- {
- obstack_1grow (ob, '_');
- go_append_string (ob, name);
- return ret;
- }
- else if (TREE_CODE (name) == TYPE_DECL)
- {
- obstack_1grow (ob, '_');
- go_append_string (ob, DECL_NAME (name));
- return ret;
- }
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+
+ slot = htab_find_slot (container->invalid_hash, IDENTIFIER_POINTER (name),
+ NO_INSERT);
+ if (slot != NULL)
+ ret = false;
+
+ obstack_1grow (ob, '_');
+ go_append_string (ob, name);
+ return ret;
}
pointer_set_insert (container->decls_seen, type);
@@ -879,7 +882,11 @@ go_output_typedef (struct godump_contain
*slot = CONST_CAST (void *, (const void *) type);
if (!go_format_type (container, TREE_TYPE (decl), false, false))
- fprintf (go_dump_file, "// ");
+ {
+ fprintf (go_dump_file, "// ");
+ slot = htab_find_slot (container->invalid_hash, type, INSERT);
+ *slot = CONST_CAST (void *, (const void *) type);
+ }
fprintf (go_dump_file, "type _%s ",
IDENTIFIER_POINTER (DECL_NAME (decl)));
go_output_type (container);
@@ -898,7 +905,11 @@ go_output_typedef (struct godump_contain
*slot = CONST_CAST (void *, (const void *) type);
if (!go_format_type (container, TREE_TYPE (decl), false, false))
- fprintf (go_dump_file, "// ");
+ {
+ fprintf (go_dump_file, "// ");
+ slot = htab_find_slot (container->invalid_hash, type, INSERT);
+ *slot = CONST_CAST (void *, (const void *) type);
+ }
fprintf (go_dump_file, "type _%s ",
IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))));
go_output_type (container);
@@ -1010,6 +1021,8 @@ go_finish (const char *filename)
container.pot_dummy_types = pointer_set_create ();
container.type_hash = htab_create (100, htab_hash_string,
string_hash_eq, NULL);
+ container.invalid_hash = htab_create (10, htab_hash_string,
+ string_hash_eq, NULL);
container.keyword_hash = htab_create (50, htab_hash_string,
string_hash_eq, NULL);
obstack_init (&container.type_obstack);
@@ -1044,6 +1057,7 @@ go_finish (const char *filename)
pointer_set_destroy (container.decls_seen);
pointer_set_destroy (container.pot_dummy_types);
htab_delete (container.type_hash);
+ htab_delete (container.invalid_hash);
htab_delete (container.keyword_hash);
obstack_free (&container.type_obstack, NULL);
next prev parent reply other threads:[~2011-05-24 20:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-20 9:44 Ian Lance Taylor
2011-05-20 14:18 ` Rainer Orth
2011-05-20 14:37 ` Jakub Jelinek
2011-05-20 19:31 ` Ian Lance Taylor
2011-05-20 18:09 ` Rainer Orth
2011-05-24 22:41 ` Ian Lance Taylor
2011-05-20 18:26 ` Rainer Orth
2011-05-24 23:33 ` Ian Lance Taylor
2011-05-25 0:24 ` Ian Lance Taylor
2011-05-24 21:33 ` Ian Lance Taylor [this message]
2011-05-25 19:11 ` Rainer Orth
2011-05-26 6:36 ` Ian Lance Taylor
2011-05-26 11:11 ` Rainer Orth
2011-05-26 9:04 ` Ian Lance Taylor
2011-05-24 22:01 ` Ian Lance Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mcrk4dfhm6q.fsf@coign.corp.google.com \
--to=iant@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gofrontend-dev@googlegroups.com \
--cc=ro@CeBiTec.Uni-Bielefeld.DE \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).