This is the mail archive of the gcc@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]

[SOLVED] Re: stdint.h type information needed


Dave Korn wrote:
> FX wrote:
>>>  LOL, I forgot to attach mine didn't I?  It's basically the same, I
>>> copied
>>> and pasted the newlib version and tweaked a couple of the definitions
>>> so they
>>> were identical to Cygwin's stdint.h.  I suspect we're simply missing some
>>> needed definition somewhere, so I won't send mine now you've sent yours.
>>>
>>>  Neither adding /usr/include/uchar.h, nor defining char{16,32}_t in
>>> /usr/include/stdint.h fixed this for me.
>> It's simpler than that actually: the node for "unsigned short int" is
>> not defined, but that of "short unsigned int" is. So we have to write in
>> our target macros the following form: "(short|long|long long) unsigned
>> int". I don't understand why, but it appears to work :)
> 
>   Ah, because it's initially based on string-matching when it creates the
> identifiers to find an existing one that already has the binding info set.  I
> don't know what the existing one is that's being matched, but that's a simple
> solution, thanks for the tip!


  Got it: the key is that the types we use in our stdint.h target files have
to match the exact wording used at the top of c_common_nodes_and_builtins:

  /* `signed' is the same as `int'.  FIXME: the declarations of "signed",
     "unsigned long", "long long unsigned" and "unsigned short" were in C++
     but not C.  Are the conditionals here needed?  */
  if (c_dialect_cxx ())
    record_builtin_type (RID_SIGNED, NULL, integer_type_node);
  record_builtin_type (RID_LONG, "long int", long_integer_type_node);
  record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
  record_builtin_type (RID_MAX, "long unsigned int",
		       long_unsigned_type_node);
  if (c_dialect_cxx ())
    record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
  record_builtin_type (RID_MAX, "long long int",
		       long_long_integer_type_node);
  record_builtin_type (RID_MAX, "long long unsigned int",
		       long_long_unsigned_type_node);
  if (c_dialect_cxx ())
    record_builtin_type (RID_MAX, "long long unsigned",
			 long_long_unsigned_type_node);
  record_builtin_type (RID_SHORT, "short int", short_integer_type_node);
  record_builtin_type (RID_MAX, "short unsigned int",
		       short_unsigned_type_node);
  if (c_dialect_cxx ())
    record_builtin_type (RID_MAX, "unsigned short",
			 short_unsigned_type_node);

  Other OS maintainers, take note!

    cheers,
      DaveK


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