On Thu, 26 Apr 2018, Josh de Kock wrote:
On 2018/04/26 14:30, JonY via Mingw-w64-public wrote:
On 04/26/2018 01:08 PM, Josh de Kock wrote:
On 2018/04/26 12:44, JonY via Mingw-w64-public wrote:
On 04/25/2018 07:47 PM, Josh de Kock wrote:
---
mingw-w64-headers/crt/_mingw.h.in | 4 ++++
1 file changed, 4 insertions(+)
Can you show a test case where it fails without this patch?
user@pc:~$ cat t.rc
#include <winver.h>
user@pc:~$ x86_64-w64-mingw32-clang -xc -E -P -DRC_INVOKED t.rc | sed
'/^$/d'
#pragma pack(push,_CRT_PACKING)
typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list va_list;
#pragma pack(pop)
void __attribute__((__cdecl__)) __debugbreak(void);
extern __inline__ __attribute__((__always_inline__,__gnu_inline__)) void
__attribute__((__cdecl__)) __debugbreak(void)
{
__asm__ __volatile__("int {$}3":);
}
const char *__mingw_get_crt_info (void);
user@pc:~$
Using a sufficiently pendantic resource compiler, it cannot handle C
constructs. RC_INVOKED should guard for this. With this patch no output
is produced for the above test file. Though it seems there are a few
other cases where C is not guarded by RC_INVOKED (such as windows.h),
but they seem minimal. Would a patch guarding more thoroughly be
accepted? The current behaviour seems to intend to guard all C with
RC_INVOKED but due to the resource compilers mostly being rather lax, it
is difficult to notice the few cases where they are not.
Patch OK then.
Don't push this though, I would like to look through the other headers
first, thanks.
While this patch in itself probably is good, to make a sensibly usable
windres replacement that works with real world project, you will need to
implement what rc.exe and binutils windres does to ignore what those
headers leave behind anyway.
No matter how much you polish the mingw-w64 headers, third party projects
will include headers of their own in .rc builds, triggering the exact same
issue.
So having windres support such input is absolutely mandatory in any case,
and thus, cleaning up all of the mingw headers in this aspect is just a
nice to have.
I did a crude hack to your WIP tool to implement this, and it seems to
work fine in the cases I've tested so far.
// Martin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public