corrode icon indicating copy to clipboard operation
corrode copied to clipboard

macOS: __attribute__

Open waywardmonkeys opened this issue 8 years ago • 4 comments

On macOS, I get errors from the system headers due to usages of __attribute__. I end up just passing -D"__attribute__(x)=/**/" on the corrode command line for now to work around this.

waywardmonkeys avatar Nov 03 '16 10:11 waywardmonkeys

That's odd, __attribute__ is supposed to be quietly ignored. Could you provide a minimal example of a declaration that fails, and the error message you get from that declaration?

jameysharp avatar Nov 03 '16 21:11 jameysharp

Hi, I asked about compile failures in your talk today. It looks like this is the same issue. When I try corrode on mac, I get:

/usr/include/string.h:171: (column 52) [ERROR]  >>> Syntax Error !
  Syntax error !
  The symbol `.1' does not fit here.

The relevant code is

#ifndef __CUDACC__
__OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1)
__TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1)
#endif
int	timingsafe_bcmp(const void *__b1, const void *__b2, size_t __len);

Line 171 expands to

__attribute__((availability(macosx,introduced=10.12.1))) __attribute__((availability(ios,introduced=10.1)))

where column 52 is the start of the first .1.

rillian avatar Dec 08 '16 06:12 rillian

This key seems to be the tiny revision number inside the attribute. 10.0 is fine, but the following example fails to parse:

__attribute__((availability(macos,introduced=10.0.0)))
int foo(void);

but compiles without warning on clang.

rillian avatar Dec 08 '16 06:12 rillian

This will get better once visq/language-c#19 is resolved (and there's a new language-c up on hackage, etc...)

lambdageek avatar Feb 25 '17 14:02 lambdageek