PATCH RFA: Add -ggo option

Ian Lance Taylor iant@google.com
Fri Nov 5 05:45:00 GMT 2010


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

>> +    {
>> +      if (ISALPHA (*p) || *p == '_')
>> +	{
>> +	  const char *start;
>> +	  char *n;
>> +
>> +	  start = p;
>> +	  while (ISALNUM (*p) || *p == '_')
>
> What happens if you have an extended identifier (represented internally in 
> UTF-8) as a macro name?  Likewise, for all the various uses of identifiers 
> through IDENTIFIER_POINTER?

There is no particular issue with a UTF-8 macro name or an identifier
whose name is encoded in UTF-8; Go will accept those names, as all Go
source code is required to be UTF-8.  There may be some difference
between the set of valid UCN identifiers in C99 and the valid
identifiers in Go; that should not be a major problem in practice.

The code you quote above is examining the replacement string of a
#define macro.  Ideally that code would check for valid UCN identifiers
in Go; right now it just uses ISALPHA and ISALNUM.  The effect will be
that if a #define macro expands to something using a UCN identifer, it
will be commented out in the generated Go code.  I'm willing to live
with that for now.  The fix should probably be using the Unicode
character properties currently in libcpp/ucnid.h.

Ian



More information about the Gcc-patches mailing list