[PATCH 5/3] C++ bits to improve detection of attribute conflicts (PR 81544)

Martin Sebor msebor@gmail.com
Fri Dec 8 16:00:00 GMT 2017


On 12/08/2017 04:30 AM, Jakub Jelinek wrote:
> On Fri, Dec 08, 2017 at 11:32:54AM +0100, Rainer Orth wrote:
>> Jakub Jelinek <jakub@redhat.com> writes:
>>
>>> On Fri, Dec 08, 2017 at 10:43:58AM +0100, Rainer Orth wrote:
>>>> The line numbers are completely misleading, unfortunately.  Hadn't
>>>> SUBTARGET_ATTRIBUTE_TABLE been used at the end of the (very short)
>>>> sparc_attribute_table, I wouldn't have seen what was wrong.
>>>>
>>>> The following patch fixes the problem, installed on mainline after
>>>> i386-pc-solaris2.11 and sparc-sun-solaris2.11 bootstraps completed
>>>> without regressions.
>>>>
>>>> However, there are two more SUBTARGET_ATTRIBUTE_TABLE defines:
>>>>
>>>> gcc/config/darwin.h:#define SUBTARGET_ATTRIBUTE_TABLE \
>>>> gcc/config/i386/cygming.h:#define SUBTARGET_ATTRIBUTE_TABLE \
>>>
>>> I'll deal with this.
>>
>> This is what I'm currently testing with an  x86_64-apple-darwin11.4.2
>> bootstrap.  Ok if it passes?
>
> I've committed this instead, while only darwin.h and cygming.h were left
> broken, the comments haven't been adjusted in many more cases.

Sorry about that and thanks for fixing it up.  Hopefully the Solaris
and Darwin files were the only ones I missed.  They were hidden from
my search by macros.

Martin

>
> BTW, we should swap handler and affects_type_identity fields at some point,
> 3 bools, then pointer, then bool, then pointer needs quite a lot of padding.
>
> 2017-12-08  Jakub Jelinek  <jakub@redhat.com>
>
> 	* config/arc/arc.c (arc_attribute_table): Add exclusions to
> 	the comment.
> 	* config/avr/avr.c (avr_attribute_table): Likewise.
> 	* config/msp430/msp430.c (msp430_attribute_table): Likewise.
> 	* config/rl78/rl78.c (rl78_attribute_table): Likewise.
> 	* config/nds32/nds32.c (nds32_attribute_table): Likewise.
> 	* config/darwin.h (SUBTARGET_ATTRIBUTE_TABLE): Initialize new member
> 	of struct attribute_spec.
> 	* config/i386/cygming.h (SUBTARGET_ATTRIBUTE_TABLE): Likewise.
> ada/
> 	* gcc-interface/utils.c (gnat_internal_attribute_table): Add
> 	exclusions to the comment.
> brig/
> 	* brig-lang.c (brig_attribute_table): Fix up comment.
>
> --- gcc/config/arc/arc.c.jj	2017-12-07 18:05:03.000000000 +0100
> +++ gcc/config/arc/arc.c	2017-12-08 11:20:24.605501619 +0100
> @@ -218,7 +218,7 @@ static tree arc_handle_fndecl_attribute
>  const struct attribute_spec arc_attribute_table[] =
>  {
>   /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
> -      affects_type_identity } */
> +      affects_type_identity, exclusions } */
>    { "interrupt", 1, 1, true, false, false, arc_handle_interrupt_attribute,
>        true, NULL },
>    /* Function calls made to this symbol must be done indirectly, because
> --- gcc/config/avr/avr.c.jj	2017-12-07 18:05:02.000000000 +0100
> +++ gcc/config/avr/avr.c	2017-12-08 11:24:32.270391537 +0100
> @@ -9875,7 +9875,7 @@ static const struct attribute_spec
>  avr_attribute_table[] =
>  {
>    /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
> -       affects_type_identity } */
> +       affects_type_identity, exclusions } */
>    { "progmem",   0, 0, false, false, false,  avr_handle_progmem_attribute,
>      false, NULL },
>    { "signal",    0, 0, true,  false, false,  avr_handle_fndecl_attribute,
> --- gcc/config/darwin.h.jj	2017-11-28 12:11:41.000000000 +0100
> +++ gcc/config/darwin.h	2017-12-08 11:18:05.866243854 +0100
> @@ -741,11 +741,11 @@ extern GTY(()) section * darwin_sections
>  /* Extra attributes for Darwin.  */
>  #define SUBTARGET_ATTRIBUTE_TABLE					     \
>    /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,     \
> -       affects_type_identity } */						     \
> +       affects_type_identity, exclusions } */				     \
>    { "apple_kext_compatibility", 0, 0, false, true, false,		     \
> -    darwin_handle_kext_attribute, false },				     \
> +    darwin_handle_kext_attribute, false, NULL },			     \
>    { "weak_import", 0, 0, true, false, false,				     \
> -    darwin_handle_weak_import_attribute, false }
> +    darwin_handle_weak_import_attribute, false, NULL }
>
>  /* Make local constant labels linker-visible, so that if one follows a
>     weak_global constant, ld64 will be able to separate the atoms.  */
> --- gcc/config/i386/cygming.h.jj	2017-10-30 12:02:35.000000000 +0100
> +++ gcc/config/i386/cygming.h	2017-12-08 11:25:12.372887945 +0100
> @@ -448,9 +448,9 @@ do {						\
>
>  #define SUBTARGET_ATTRIBUTE_TABLE \
>    { "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute, \
> -    false }
> +    false, NULL }
>    /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
> -       affects_type_identity } */
> +       affects_type_identity, exclusions } */
>
>  /*  mcount() does not need a counter variable.  */
>  #undef NO_PROFILE_COUNTERS
> --- gcc/config/msp430/msp430.c.jj	2017-12-07 18:05:03.000000000 +0100
> +++ gcc/config/msp430/msp430.c	2017-12-08 11:26:47.634691684 +0100
> @@ -2050,7 +2050,7 @@ msp430_data_attr (tree * node,
>  const struct attribute_spec msp430_attribute_table[] =
>  {
>    /* Name        min_num_args     type_req,             affects_type_identity
> -                      max_num_args,     fn_type_req
> +		      max_num_args,     fn_type_req		exclusions
>                            decl_req               handler.  */
>    { ATTR_INTR,        0, 1, true,  false, false, msp430_attr, false, NULL },
>    { ATTR_NAKED,       0, 0, true,  false, false, msp430_attr, false, NULL },
> --- gcc/config/rl78/rl78.c.jj	2017-12-07 18:05:03.000000000 +0100
> +++ gcc/config/rl78/rl78.c	2017-12-08 11:27:25.024222160 +0100
> @@ -858,7 +858,7 @@ rl78_handle_saddr_attribute (tree * node
>  const struct attribute_spec rl78_attribute_table[] =
>  {
>    /* Name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
> -     affects_type_identity.  */
> +     affects_type_identity, exclusions.  */
>    { "interrupt",      0, 0, true, false, false, rl78_handle_func_attribute,
>      false, NULL },
>    { "brk_interrupt",  0, 0, true, false, false, rl78_handle_func_attribute,
> --- gcc/config/nds32/nds32.c.jj	2017-12-07 18:05:02.000000000 +0100
> +++ gcc/config/nds32/nds32.c	2017-12-08 11:27:54.160856273 +0100
> @@ -83,7 +83,8 @@ static const char * const nds32_intrinsi
>  static const struct attribute_spec nds32_attribute_table[] =
>  {
>    /* Syntax: { name, min_len, max_len, decl_required, type_required,
> -	       function_type_required, handler, affects_type_identity } */
> +	       function_type_required, handler, affects_type_identity,
> +	       exclusions } */
>
>    /* The interrupt vid: [0-63]+ (actual vector number starts from 9 to 72).  */
>    { "interrupt",    1, 64, false, false, false, NULL, false, NULL },
> --- gcc/ada/gcc-interface/utils.c.jj	2017-12-07 18:04:59.000000000 +0100
> +++ gcc/ada/gcc-interface/utils.c	2017-12-08 11:29:11.796881349 +0100
> @@ -108,7 +108,7 @@ static tree fake_attribute_handler (tree
>  const struct attribute_spec gnat_internal_attribute_table[] =
>  {
>    /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
> -       affects_type_identity } */
> +       affects_type_identity, exclusions } */
>    { "const",        0, 0,  true,  false, false, handle_const_attribute,
>      false, NULL },
>    { "nothrow",      0, 0,  true,  false, false, handle_nothrow_attribute,
> --- gcc/brig/brig-lang.c.jj	2017-12-07 18:04:55.000000000 +0100
> +++ gcc/brig/brig-lang.c	2017-12-08 12:20:40.475998143 +0100
> @@ -448,7 +448,7 @@ brig_localize_identifier (const char *id
>  const struct attribute_spec brig_attribute_table[] =
>  {
>    /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
> -       do_diagnostic } */
> +       affects_type_identity, exclusions } */
>    { "leaf",		      0, 0, true,  false, false,
>  			      handle_leaf_attribute, false, NULL },
>    { "const",                  0, 0, true,  false, false,
>
>
> 	Jakub
>



More information about the Gcc-patches mailing list