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: RFA: partially hookize *_TYPE_SIZE


Quoting "Joseph S. Myers" <joseph@codesourcery.com>:

On Tue, 30 Nov 2010, Joern Rennecke wrote:

I see your point. The name of the parameter is not evident at the call site.
I suppose the best way to handle the enum tree_index dependency
(not all users of target.h use tree.h) is to declare these hooks to take an
int argument.

You could alternatively create separate enums for each hook for greater type safety.

Yes. Unfortunately, the enum literals are prone to name clash, and it doesn't get simpler to avoid these when lots of random different enums use different naming schemes. Using bool seemed like an easy way out, till you pointed out the flaw with that...

So I suppose we could have something like this in target.h :

/* enums to describe types in target hooks.
   integer_type_kind is defined in coretypes.h  */
enum th_wchar_type
{
  th_wt_wchar_t, th_wt_wint_t
};

enum th_size_type
{
  th_st_size_type, th_st_ptrdiff_t
};

enum th_float_type
{
  th_ft_float, th_ft_double, th_ft_widest_hard_fp, th_ft_long_double
};

enum th_stdint
{
  th_si_int8_t,
...
};


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