C vs. C++ parsers and the __attribute__ syntax

Ulrich Weigand weigand@i1.informatik.uni-erlangen.de
Wed Oct 27 16:24:00 GMT 2004


Joseph S. Myers wrote:

> "Attribute Syntax" in the manual, but there may well be bugs in both the 
> documentation and the code.

Thanks, I overlooked this ...

> > typedef struct test * __attribute__ ((mode (SI))) test_ptr32;
> 
> This is the proper way.

So it's a bug that the C++ parser doesn't handle this correctly?
I'll open a PR if so.

> > How would I declare a type like 'an SImode pointer to a
> > TImode integer'?
> 
> typedef int (__attribute__((mode(TI))) (*__attribute__((mode(SI))) type));

This works for C; the C++ parser appears to go into an
endless loop when given this code ...

Without the outer pair of parentheses, the C compiler says
error: invalid pointer mode 'TI'
I guess this is because of the compatibility issues mentioned
in the last paragraph of the above manual page?

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de



More information about the Gcc mailing list