Bug 31307

Summary: gdb/symtab.h: SEARCH_ALL clashes with <winioctl.h> on MinGW
Product: gdb Reporter: Pekka Seppänen <pexu>
Component: gdbAssignee: Tom Tromey <tromey>
Status: RESOLVED FIXED    
Severity: normal CC: tromey
Priority: P2    
Version: HEAD   
Target Milestone: 15.1   
Host: Target:
Build: Last reconfirmed: 2024-01-29 00:00:00

Description Pekka Seppänen 2024-01-29 09:55:15 UTC
Hi.

Recent domain_search_flags patch [1] introduces a convenience constant SEARCH_ALL that unfortunately clashes with SEARCH_ALL macro that is defined <winioctl.h>.  

This header file is included indirectly when compiling gdb/mingw-hdep.c (via gdb/serial.h:23 -> /mingw-w64/include/winsock2.h:23 -> /mingw-w64/include/windows.h:97 -> /mingw-w64/include/winscard.h:11 -> /mingw-w64/include/winioctl.h).

A quick (and dirty) workaround would be to add #define NOCRYPT prior serial.h include.  However, in the long run, it might be more beneficial to move <windows.h> et. al. to a shared header that sets up all feature removal macros.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=25f31e1820dcec2f0c073c28cbf88646c7c2af97
Comment 1 Tom Tromey 2024-01-29 16:17:08 UTC
I don't mind renaming this, but FWIW I can't reproduce the
problem with my Fedora-hosted mingw cross.
Comment 2 Tom Tromey 2024-01-29 16:41:34 UTC
Aha, I was on the wrong branch, of course.
Comment 4 Sourceware Commits 2024-02-01 14:23:49 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f214edceb8cd97058c2682efb7b321d923e4ff02

commit f214edceb8cd97058c2682efb7b321d923e4ff02
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Jan 29 09:45:35 2024 -0700

    Rename SEARCH_ALL
    
    The constant SEARCH_ALL conflicts with a define in a Windows header.
    This patch renames the constant to SEARCH_ALL_DOMAINS to avoid the
    conflict.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31307
Comment 5 Tom Tromey 2024-02-01 16:19:05 UTC
Fixed.