This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add named address support to GCC 4.5


On Mon, 13 Apr 2009, Michael Meissner wrote:

> @@ -4591,6 +4662,15 @@ grokdeclarator (const struct c_declarato
>  	    if (really_funcdef)
>  	      put_pending_sizes (arg_info->pending_sizes);
>  
> +	    /* Warn about functions declared in another address space.  */
> +	    address_space = DECODE_QUAL_ADDR_SPACE (type_quals);
> +	    if (address_space)
> +	      {
> +		type_quals = CLEAR_QUAL_ADDR_SPACE (type_quals);
> +		error ("%qs specified for function %qs",
> +		       targetm.addr_space.name (address_space), name);
> +	      }
> +
>  	    /* Type qualifiers before the return type of the function
>  	       qualify the return type, not the function type.  */
>  	    if (type_quals)

My comments at <http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00804.html> 
still apply: in this code any qualifiers are qualifiers on the return type 
and so should not be an error (whereas the various places qualifiers get 
applied to a function type itself are indeed pedwarns and this patch has 
indeed removed the incorrect changes that would have allowed address space 
qualifiers in those places).

> @@ -5042,8 +5163,8 @@ grokdeclarator (const struct c_declarato
>  	C_DECL_REGISTER (decl) = was_reg;
>        }
>  
> -  /* This is the earliest point at which we might know the assembler
> -     name of a variable.  Thus, if it's known before this, die horribly.  */
> +    /* This is the earliest point at which we might know the assembler name of
> +       a variable.  Thus, if it's known before this, die horribly.  */
>      gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl));

Gratuitous reformatting of a comment.

> @@ -8897,6 +9094,17 @@ build_binary_op (location_t location, en
>  		  && TREE_CODE (tt1) == FUNCTION_TYPE)
>  		pedwarn (location, OPT_pedantic, "ISO C forbids "
>  			 "comparison of %<void *%> with function pointer");
> +
> +	      /* If this operand is a pointer into another address
> +		 space, make the result of the comparison such a
> +		 pointer also.  */
> +	      if (POINTER_TYPE_P (type0)
> +		  && (as = TYPE_ADDR_SPACE (TREE_TYPE (type0))))
> +		{
> +		  int qual = ENCODE_QUAL_ADDR_SPACE (as);
> +		  result_type = build_pointer_type
> +		    (build_qualified_type (void_type_node, qual));
> +		}
>  	    }
>  	  else if (VOID_TYPE_P (tt1))
>  	    {
> @@ -8904,6 +9112,17 @@ build_binary_op (location_t location, en
>  		  && TREE_CODE (tt0) == FUNCTION_TYPE)
>  		pedwarn (location, OPT_pedantic, "ISO C forbids "
>  			 "comparison of %<void *%> with function pointer");
> +
> +	      /* If this operand is a pointer into another address
> +		 space, make the result of the comparison such a
> +		 pointer also.  */
> +	      if (POINTER_TYPE_P (type1)
> +		  && (as = TYPE_ADDR_SPACE (TREE_TYPE (type1))))
> +		{
> +		  int qual = ENCODE_QUAL_ADDR_SPACE (as);
> +		  result_type = build_pointer_type
> +		    (build_qualified_type (void_type_node, qual));
> +		}

My comments at <http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00804.html> 
still apply.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]