This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3/5] Named address spaces: C front-end support
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: joseph at codesourcery dot com (Joseph S. Myers)
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 Sep 2009 15:27:28 +0200 (CEST)
- Subject: Re: [PATCH 3/5] Named address spaces: C front-end support
Joseph Myers wrote:
> On Wed, 26 Aug 2009, Ulrich Weigand wrote:
>
> > + /* Warn about address space used for things other that static memory or
>
> "other that" should be "other than".
Fixed, thanks.
> > + else if (decl_context == PARM && TREE_CODE (type) != ARRAY_TYPE)
> > + error ("%qs specified for parameter %qE",
> > + c_addr_space_name (address_space), name);
> > + else if (decl_context == FIELD)
> > + error ("%qs specified for structure field %qE",
> > + c_addr_space_name (address_space), name);
>
> What happens with unnamed parameters or bit-fields (so name is NULL)
> declared with an address space qualifier? If they can reach here then you
> need to allow for that case with a different diagnostic text, and you
> should make sure there are testcases for this in the testsuite.
Good point. I've just checked into the branch the patch below that gives
different error messages if name is NULL, in analogy to what is done above
for the "storage class specified for ..." messages.
> I don't see any other issues with this patch version.
Thanks for the review! I'll be posting a new version of the full
patch set against current mainline shortly.
Bye,
Ulrich
gcc/
* c-decl.c (grokdeclarator): Fix typo. Correct error message for
address space qualifiers specified for unnamed parameters or
structure fields.
gcc/testsuite/
* gcc.target/spu/ea/errors1.c: Add tests for incorrect qualifiers
for unnamed parameters and structure fields.
Index: gcc/c-decl.c
===================================================================
*** gcc/c-decl.c (revision 151727)
--- gcc/c-decl.c (working copy)
*************** grokdeclarator (const struct c_declarato
*** 5566,5572 ****
/* Now TYPE has the actual type, apart from any qualifiers in
TYPE_QUALS. */
! /* Warn about address space used for things other that static memory or
pointers. */
address_space = DECODE_QUAL_ADDR_SPACE (type_quals);
if (address_space)
--- 5566,5572 ----
/* Now TYPE has the actual type, apart from any qualifiers in
TYPE_QUALS. */
! /* Warn about address space used for things other than static memory or
pointers. */
address_space = DECODE_QUAL_ADDR_SPACE (type_quals);
if (address_space)
*************** grokdeclarator (const struct c_declarato
*** 5600,5610 ****
}
}
else if (decl_context == PARM && TREE_CODE (type) != ARRAY_TYPE)
! error ("%qs specified for parameter %qE",
! c_addr_space_name (address_space), name);
else if (decl_context == FIELD)
! error ("%qs specified for structure field %qE",
! c_addr_space_name (address_space), name);
}
/* Check the type and width of a bit-field. */
--- 5600,5622 ----
}
}
else if (decl_context == PARM && TREE_CODE (type) != ARRAY_TYPE)
! {
! if (name)
! error ("%qs specified for parameter %qE",
! c_addr_space_name (address_space), name);
! else
! error ("%qs specified for unnamed parameter",
! c_addr_space_name (address_space));
! }
else if (decl_context == FIELD)
! {
! if (name)
! error ("%qs specified for structure field %qE",
! c_addr_space_name (address_space), name);
! else
! error ("%qs specified for structure field",
! c_addr_space_name (address_space));
! }
}
/* Check the type and width of a bit-field. */
Index: gcc/testsuite/gcc.target/spu/ea/errors1.c
===================================================================
*** gcc/testsuite/gcc.target/spu/ea/errors1.c (revision 151726)
--- gcc/testsuite/gcc.target/spu/ea/errors1.c (working copy)
*************** void func2 (__ea int x) /* { dg-erro
*** 37,46 ****
--- 37,49 ----
struct st {
__ea int x; /* { dg-error "'__ea' specified for structure field 'x'" } */
int *__ea q; /* { dg-error "'__ea' specified for structure field 'q'" } */
+ int __ea b : 7; /* { dg-error "'__ea' specified for structure field 'b'" } */
+ int __ea : 1; /* { dg-error "'__ea' specified for structure field" } */
} s;
struct A { int a; };
+ int func3 (int *__ea); /* { dg-error "'__ea' specified for unnamed parameter" } */
int func3 (int *__ea x) /* { dg-error "'__ea' specified for parameter 'x'" } */
{
struct A i = (__ea struct A) { 1 }; /* { dg-error "compound literal qualified by address-space qualifier" } */
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com