On Sun, 15 Mar 2020, Egor Pugin wrote:

The problem is that someone put all attributes after return value, but
windows declspec must be in front of everything.
Changing
void * WINPTHREAD_API pthread_timechange_handler_np(void * dummy);
to
WINPTHREAD_API
void *  pthread_timechange_handler_np(void * dummy);
fixes that declspec issue.

Thanks, that clears things up. I'm sure it'd be ok with a patch changing the placement, with e.g. this explanation:

---8<---
winpthreads: Move WINPTHREAD_API to the start of declarations

GCC, and Clang in mingw mode, expand __declspec(x) into __attribute__((x)), but MSVC and Clang in MSVC mode keep __declspec as is.

__attribute__(()) is allowed anywhere in the function declaration, while __declspec() (in MSVC and Clang in MSVC mode) only is allowed at the start of a declaration.

Therefore, move WINPTHREAD_API within declarations to fix compilation with MSVC and Clang in MSVC mode.
---8<---

The original part of that patch, allowing to manually override it, still potentialy could be useful, maybe - with the motivation to allow custom overrides in general.

// Martin




_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to