Hi Simon,

In addition to the non portable issues already mentioned, this change isn't OK 
also
for other reasons.

Basically this function is global and decides once for all on the case 
sensitivity, while
the case sensitiviy is on a per filsystem basis as you noted.

So without changing fundamentally the model, you can't decide dynamically for 
the whole
system. Making the choice based on the current directory is pretty random, 
since the current
directory isn't well defined at program's start up and could be pretty much any 
filesystem.

Note that the current setting on arm is actually for iOS, which we did support 
at AdaCore
at some point (and could revive in the future, who knows).

So it would be fine to refine the test to differentiate between macOS and 
embedded iOS and co,
that would be a better change here.

> This change affects only Ada.
> 
> In gcc/ada/adaint.c(__gnat_get_file_names_case_sensitive), the
> assumption for __APPLE__ is that file names are case-insensitive
> unless __arm__ or __arm64__ are defined, in which case file names
> are declared case-sensitive.
> 
> The associated comment is
>   "By default, we suppose filesystems aren't case sensitive on
>   Windows and Darwin (but they are on arm-darwin)."
> 
> This means that on aarch64-apple-darwin, file names are declared
> case-sensitive, which is not normally the case (but users can set
> up case-sensitive volumes).
> 
> It's understood that GCC does not currently support iOS/tvOS/watchOS,
> so we assume macOS.
> 
> Bootstrapped on x86_64-apple-darwin with languages c,c++,ada and regression 
> tested (check-gnat).
> Also, tested with the example from PR ada/81114, extracted into 4 volumes 
> (APFS, APFS-case-sensitive,
> HFS, HFS-case-sensitive; the example code built successfully on the 
> case-sensitive volumes.
> Setting GNAT_FILE_NAME_CASE_SENSITIVE successfully overrode the choices made 
> by the
> new code.
> 
>  gcc/ada/Changelog:
> 
>  2023-10-29 Simon Wright <si...@pushface.org>
> 
>  PR ada/111909
> 
>  * gcc/ada/adaint.c
>   (__gnat_get_file_names_case_sensitive): Remove the checks for
>   __arm__, __arm64__.
>   Split out the check for __APPLE__; remove the checks for __arm__,
>   __arm64__, and use getattrlist(2) to determine whether the current
>   working directory is on a case-sensitive filesystem.
> 
> Signed-off-by: Simon Wright <si...@pushface.org>

Reply via email to