public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Olivier Hainque <hainque@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] support static nested constructors in bitfields (2/2)
Date: Tue, 26 May 2009 14:41:00 -0000	[thread overview]
Message-ID: <m34ov8vsdz.fsf@google.com> (raw)
In-Reply-To: <20090427103635.GB29582@cardhu.act-europe.fr> (Olivier Hainque's message of "Mon\, 27 Apr 2009 12\:36\:35 +0200")

Olivier Hainque <hainque@adacore.com> writes:

> 2009-04-27  Olivier Hainque  <hainque@adacore.com>
>             Eric Botcazou  <ebotcazou@adacore.com>
>
> 	Support for output of static nested constructors within bitfields
> 	* varasm.c (initializer_constant_valid_for_bitfield_p): New
> 	predicate. Whether VALUE is a valid constant-valued expression
> 	for use in initializing a static bit-field.
> 	(oc_outer_state): New type. output_constructor outer state of
> 	relevance in recursive calls.
> 	(oc_local_state): byte_buffer_in_use is bool, not int.  Add a
> 	"last_relative_index" field to memorize the index of the last
> 	array element output within a bitfield.
> 	(output_constructor_array_range): Minor prototype and head
> 	comment adjustments.
> 	(output_constructor_regular_field): Likewise.  Adjust assignments
> 	to byte_buffer_in_use, now bool.
> 	(output_constructor_bitfield): Likewise.  Accept an OUTER state
> 	argument for recursive processing.  Recurse on record or array
> 	CONSTRUCTOR values, possibly past noop conversions.
> 	(output_constructor): Accept and honor an OUTER state argument for
> 	recursive calls + return total size.  Be prepared for nested
> 	constructors initializing bitfields and consider BLKmode toplevel
> 	fields as regular even if DECL_BIT_FIELD is set.
> 	(output_constant): Feed OUTER in calls to output_constructor.
> 	* output.h (initializer_constant_valid_for_bitfield_p): Declare.
>
> 	ada/
> 	* utils2.c (gnat_build_constructor): Factor out code.  Use
> 	initializer_constant_valid_for_bitfield_p for bit-fields and
> 	account for BLKmode in addition to DECL_BIT_FIELD as in
> 	output_constructor.
>
> 	testsuite/
> 	* gnat.dg/oconst[1-6].ad[bs]: New tests. Also support for ...
> 	* gnat.dg/test_oconst.adb: New test.



> +   if (TREE_CODE (local->val) != INTEGER_CST
> +       && TREE_CODE (local->val) != CONSTRUCTOR)
> +       error ("invalid initial value for member %qs",
> + 	     IDENTIFIER_POINTER (DECL_NAME (local->field)));

You may need to return, or change local->var, to avoid useless follow-on
errors.


This is OK with those changes.

Thanks.

Ian

  parent reply	other threads:[~2009-05-26 14:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 10:44 Olivier Hainque
2009-05-18  9:10 ` [PING] " Olivier Hainque
2009-05-26 14:41 ` Ian Lance Taylor [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-07-24 12:37 [PATCH] " Olivier Hainque
2008-07-24 12:55 ` Olivier Hainque

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=m34ov8vsdz.fsf@google.com \
    --to=iant@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hainque@adacore.com \
    /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).