threads / patch / 59836

patchUse lowercase includes for some Windows headers

Subject: [PATCH] Use lowercase includes for some Windows headers

## tl;dr

3 messages between Jun 4, 2023 and Jul 14, 2023. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Mike Hommey· Jun 4, 2023, 21:19 UTC · lore

When cross-compiling with the mingw toolchain on a system with a case sensitive filesystem, the mixed case (which is technically correct as per the contents of MS Visual C++) doesn't work (the corresponding mingw headers are all lowercase for some reason).

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 compat/win32/trace2_win32_process_info.c | 4 ++--
 wrapper.c                                | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Show changes to 2 files +3 −3

compat/win32/trace2_win32_process_info.c, wrapper.c

diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c
index a4e33768f4..438af8f818 100644
--- a/compat/win32/trace2_win32_process_info.c
+++ b/compat/win32/trace2_win32_process_info.c
@@ -3,8 +3,8 @@
 #include "../../repository.h"
 #include "../../trace2.h"
 #include "lazyload.h"
-#include <Psapi.h>
-#include <tlHelp32.h>
+#include <psapi.h>
+#include <tlhelp32.h>
 
 /*
  * An arbitrarily chosen value to limit the size of the ancestor
diff --git a/wrapper.c b/wrapper.c
index 67f5f5dbe1..5dc48e815a 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -17,7 +17,7 @@ static intmax_t count_fsync_hardware_flush;
 #ifdef HAVE_RTLGENRANDOM
 /* This is required to get access to RtlGenRandom. */
 #define SystemFunction036 NTAPI SystemFunction036
-#include <NTSecAPI.h>
+#include <ntsecapi.h>
 #undef SystemFunction036
 #endif
 
-- 
2.41.0.6.ge371d37104
Junio C Hamano· Jun 12, 2023, 19:30 UTC · re: Mike Hommey · lore

Re: [PATCH] Use lowercase includes for some Windows headers

Mike Hommey <mh@glandium.org> writes:
Show 10 quoted lines
> When cross-compiling with the mingw toolchain on a system with a case
> sensitive filesystem, the mixed case (which is technically correct as
> per the contents of MS Visual C++) doesn't work (the corresponding mingw
> headers are all lowercase for some reason).
>
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
>  compat/win32/trace2_win32_process_info.c | 4 ++--
>  wrapper.c                                | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

I can guess that this will not break the primary target audience of the source, who build from the source on case insensitive filesystems. The only possible breakage I can think of is if different versions of mingw toolchain have these header files in different cases---those who have been happily using header files like <tlHelp32.h> on their case sensitive filesystem now will find their build to fail. Theoretically, those who _corrected_ their header files to mixed case themselves (as it is "technically correct as per the contents of MS Visual C++") will be broken the same way, but they should be capable of diagnosing and recovering from such a breakage, so I'm not worried about that.

Appreciate input from those who builds with mingw toolchain, but in the meantime let me queue it on 'seen' so that we won't forget.

Thanks.
Show 27 quoted lines
> diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c
> index a4e33768f4..438af8f818 100644
> --- a/compat/win32/trace2_win32_process_info.c
> +++ b/compat/win32/trace2_win32_process_info.c
> @@ -3,8 +3,8 @@
>  #include "../../repository.h"
>  #include "../../trace2.h"
>  #include "lazyload.h"
> -#include <Psapi.h>
> -#include <tlHelp32.h>
> +#include <psapi.h>
> +#include <tlhelp32.h>
>  
>  /*
>   * An arbitrarily chosen value to limit the size of the ancestor
> diff --git a/wrapper.c b/wrapper.c
> index 67f5f5dbe1..5dc48e815a 100644
> --- a/wrapper.c
> +++ b/wrapper.c
> @@ -17,7 +17,7 @@ static intmax_t count_fsync_hardware_flush;
>  #ifdef HAVE_RTLGENRANDOM
>  /* This is required to get access to RtlGenRandom. */
>  #define SystemFunction036 NTAPI SystemFunction036
> -#include <NTSecAPI.h>
> +#include <ntsecapi.h>
>  #undef SystemFunction036
>  #endif
Junio C Hamano· Jul 14, 2023, 17:07 UTC · re: Junio C Hamano · lore

Re: [PATCH] Use lowercase includes for some Windows headers

Junio C Hamano <gitster@pobox.com> writes:
Show 25 quoted lines
> Mike Hommey <mh@glandium.org> writes:
>
>> When cross-compiling with the mingw toolchain on a system with a case
>> sensitive filesystem, the mixed case (which is technically correct as
>> per the contents of MS Visual C++) doesn't work (the corresponding mingw
>> headers are all lowercase for some reason).
>>
>> Signed-off-by: Mike Hommey <mh@glandium.org>
>> ---
>>  compat/win32/trace2_win32_process_info.c | 4 ++--
>>  wrapper.c                                | 2 +-
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> ...  The only possible breakage I can think of is if
> different versions of mingw toolchain have these header files in
> different cases---those who have been happily using header files
> like <tlHelp32.h> on their case sensitive filesystem now will find
> their build to fail.  Theoretically, those who _corrected_ their
> header files to mixed case themselves (as it is "technically correct
> as per the contents of MS Visual C++") will be broken the same way,
> but they should be capable of diagnosing and recovering from such a
> breakage, so I'm not worried about that.
>
> Appreciate input from those who builds with mingw toolchain, but in
> the meantime let me queue it on 'seen' so that we won't forget.

And a month has passed. Unless I hear objections, I'll merge this change to 'next' in a few days at most.

Thanks.
Show 34 quoted lines
>
> Thanks.
>
>
>
>
>
>> diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c
>> index a4e33768f4..438af8f818 100644
>> --- a/compat/win32/trace2_win32_process_info.c
>> +++ b/compat/win32/trace2_win32_process_info.c
>> @@ -3,8 +3,8 @@
>>  #include "../../repository.h"
>>  #include "../../trace2.h"
>>  #include "lazyload.h"
>> -#include <Psapi.h>
>> -#include <tlHelp32.h>
>> +#include <psapi.h>
>> +#include <tlhelp32.h>
>>  
>>  /*
>>   * An arbitrarily chosen value to limit the size of the ancestor
>> diff --git a/wrapper.c b/wrapper.c
>> index 67f5f5dbe1..5dc48e815a 100644
>> --- a/wrapper.c
>> +++ b/wrapper.c
>> @@ -17,7 +17,7 @@ static intmax_t count_fsync_hardware_flush;
>>  #ifdef HAVE_RTLGENRANDOM
>>  /* This is required to get access to RtlGenRandom. */
>>  #define SystemFunction036 NTAPI SystemFunction036
>> -#include <NTSecAPI.h>
>> +#include <ntsecapi.h>
>>  #undef SystemFunction036
>>  #endif

← back to recent threads