opj_includes.h has this snippet:
/* Ignore GCC attributes if this is not GCC */
#ifndef __GNUC__
#define __attribute__(x) /* __attribute__(x) */
#endif
That's not valid, things starting with two underscores are reserved for the implementation and shouldn't be redefined. In practice, it's even actively harmful: When building openjpeg with clang-cl, __GNUC__ isn't defined, so __attribute__ gets defined to nothing, and then the same file includes <intrin.h> a bit futher down. clang-cl's intrin.h header uses __attribute__ internally, and since it's included after this redefine, clang-cl gets very confused.
One approach would be to do
#ifndef __GNUC__
#define ATTRIB(x) __attribute__(x)
#else
#define ATTRIB(x)
#endif
And then use ATTRIB everywhere -- but from what I can tell, all uses of __attribute__ are already guarded by other diffs and just deleting these 4 lines should probably be fine too.
(This blocks https://crbug.com/592745)
opj_includes.h has this snippet:
That's not valid, things starting with two underscores are reserved for the implementation and shouldn't be redefined. In practice, it's even actively harmful: When building openjpeg with clang-cl,
__GNUC__isn't defined, so__attribute__gets defined to nothing, and then the same file includes <intrin.h> a bit futher down. clang-cl's intrin.h header uses__attribute__internally, and since it's included after this redefine, clang-cl gets very confused.One approach would be to do
And then use ATTRIB everywhere -- but from what I can tell, all uses of
__attribute__are already guarded by other diffs and just deleting these 4 lines should probably be fine too.(This blocks https://crbug.com/592745)