On 08/03/15 19:08, David Grayson wrote:
> 8) Even with FORCEINLINE, you still sometimes need to have a non-inline 
> definition of the function available, for example if you are doing any 
> operations on a function pointer to one of the intsafe.h functions.  (Or is 
> that not something a user should be doing?)  Therefore, intsafe.h should 
> provide a mode for generating non-inline definitions:
>
> +#ifndef __MINGW_INTSAFE_API
> +#define __MINGW_INTSAFE_API inline
> +#endif
>
> However, the non-inline definition might be in a different translation unit 
> that has a different definition of what a CHAR is, due to the -funsigned-char 
> option.  Therefore, for code using -funsigned-char, we change the actual 
> function names for any function operating on a char, prepending them with 
> "__mingw_intsafe_uchar_".  Someone in a special situation might need to 
> generate non-inline definitions for both the normal functions and the 
> __mingw_intsafe_uchar_* variants, so I give them independent control over 
> whether the char functions will have non-inline definitions:
>
> +#ifndef __MINGW_INTSAFE_CHAR_API
> +#define __MINGW_INTSAFE_CHAR_API __MINGW_INTSAFE_API
> +#endif
>
> I imagine a lot of developers will view this whole line of reasoning as 
> pretty far-fetched and not likely to help anyone, and that is true.  But at 
> the same time, the changes that I made to support non-inline definitions and 
> unsigned chars are pretty unobtrusive and should have no effect on someone 
> who uses signed chars, so I think there is no practical cost to doing it this 
> way.
>
> So, let me know what you think and then I'll make the next version of the 
> patch that has all the needed changes.

I'd personally call build system that mixes char types as broken, but
it's valid so we can support it. How about simply using static inline
functions for __MINGW_INTSAFE_CHAR_AP? This will avoid the problem of
having different declarations in different compile units.

Thanks,
Jacek

------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to