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] make a bunch of attribute handlers globally available


Hello,

Following up a on recent exchange about vector_size handling for Ada
at http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01799.html, this is a
re-post of the patch initially suggested at

  http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01203.html

  << A number of GCC attribute handlers today shared by the C family of
     languages are needed by at least Ada and possibly others, e.g. for
     builtins support.
 
     For Ada, we so far dealt with this by copy-paste operations, not
     exactly proper software engineering practice.  We'd like to
     improve the situation, all the more that we now have needs for
     the vector_size attribute as well, and maybe others in the future.
  >>

... adjusted to account for Paolo's suggestion to move the common
attribute handling object files to libbackend instead of explicitely
adding them to every front-end.

Tested on x86_64-linux-suse with languages=all,ada.

Thanks in advance,

With Kind Regards,

Olivier

2009-06-26  Olivier Hainque  <hainque@adacore.com>

	* c-common.c (handle_noreturn_attribute, handle_const_attribute,
	handle_malloc_attribute, handle_pure_attribute,
	handle_novops_attribute, handle_vector_size_attribute,
	handle_nonnull_attribute, handle_nothrow_attribute, 
	handle_sentinel_attribute, handle_type_generic_attribute,
	get_nonnull_operand): Move bodies to attrib-handlers.c.
	(c_common_attribute_table, "noreturn", "volatile", "const", "malloc",
	"pure", "no vops", "vector_size", "nonnull", "nothrow", "sentinel",
	"type generic"): Move entries to global_attribute_table in ...
	* attrib-handlers.c: New file. Host global attribute handlers
	extracted from c-common.c.
	(global_attribute_table): Define.
	* tree.h (get_nonnull_operand): Declare.
	* attribs.c (global_attribute_table): Declare.
	(attribute_tables, init_attributes): Handle global_attribute_table.
	Use enum symbols instead of harcoded constants to designate the slots.
	* Makefile.in (attrib-handlers.o): List dependencies.
	(OBJS-common): Add attribs.o and attrib-handlers.o.
	(C_AND_OBJC_OBJS): Remove attribs.o.
	
	ada/
	* Make-lang.in (ADA_BACKEND): Remove.
	(gnat1): Use $(BACKEND) instead.
	* gcc-interface/utils.c: Remove attribute handlers formerly
	imported from c-common and now available to all languages.  Use
	NULL instead of fake_attribute_handler and remove the latter.

	cp/
	* Make-lang.in (CXX_C_OBJS): Remove attribs.o.

	fortran/
	* Make-lang.in (f951): Remove attribs.o from the dependencies.

	java/
	* Make-lang.in (jc1): Remove attribs.o from the dependencies.
	* lang.c (java_attribute_table, LANG_HOOKS_ATTRIBUTE_TABLE): Remove.

Attachment: attrib-handlers.dif
Description: Text document


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