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] |
Hello, 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. This message/patch is a suggestion to address the issue in a simple manner, by moving the relevant attribute handlers in a dedicated source file common to all languages (attrib-handlers.c), together with the definition of a "global_attribute_table" to collect them. This will add a few functions to compilers that possibly don't need them, but the amount of code is small, there is no other penalty, it really looks preferrable to the copy/paste alternative, and it could well become handy at some point anyway. It seems to me that alternate schemes to allow any combination of choices by any combination of languages would rapidly grow too complex for the final gain. Moving the "nonnull" attribute processing to a common place conflicts with a dummy entry for it in the current java front-end, introduced in revision 112574 together with other changes for PR java/26858. The purpose of this specific piece wrt the bug behavior is unclear to me - maybe the author (cc'ed) could enlighten. Part of the patch suggested here removes the java specific attribute table altogether, without effect on the testresults in my configuration (bootstrap+check for languages=all,ada on x86_64-suse-linux). The PR dedicated libjava test is exercised and passes. Thanks in advance for your feedback, With Kind Regards, Olivier 2009-06-16 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 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): Account for the global table. Use enum symbols instead of harcoded constants to designate the slots. * Makefile.in (C_AND_OBJC_OBJS): Add attrib-handlers.o. (attrib-handlers.o): List dependencies. cp/ * Make-lang.in (CXX_C_OBJS): Add attrib-handlers.o. fortran/ * Make-lang.in (f951): Likewise. java/ * Make-lang.in (jc1): Likewise. * lang.c (java_attribute_table, LANG_HOOKS_ATTRIBUTE_TABLE): Remove. ada/gcc-interface/ * Make-lang.in (ADA_BACKEND): Likewise. * utils.c: Remove attribute handlers now available to all languages. Remove the corresponding gnat_internal_attribute_table entries.
Attachment:
global_attributes.dif
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |