]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix PR ada/111909 On Darwin, determine filesystem case sensitivity at runtime
authorSimon Wright <simon@pushface.org>
Tue, 28 Nov 2023 13:56:36 +0000 (14:56 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 28 Nov 2023 16:47:10 +0000 (17:47 +0100)
In gcc/ada/adaint.c(__gnat_get_file_names_case_sensitive), the current
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 treated as
case-sensitive, which is not the default case.

The true default position is that macOS file systems are
case-insensitive, iOS file systems are case-sensitive.

Apple provide a header file <TargetConditionals.h> which permits a
compile-time check for the compiler target (e.g. OSX vs IOS); if
TARGET_OS_IOS is defined as 1, this is a build for iOS.

2023-11-22  Simon Wright  <simon@pushface.org>

gcc/ada/

PR ada/111909
* adaint.c
(__gnat_get_file_names_case_sensitive): Split out the __APPLE__
check and remove the checks for __arm__, __arm64__. For Apple,
file names are by default case-insensitive unless TARGET_OS_IOS is
set.

Signed-off-by: Simon Wright <simon@pushface.org>
gcc/ada/adaint.c

index 4ab95658c62db2b9a2de4aaeb11fa95a98b7dd79..9bb3054d6a342b30c7e4e4ae57529963c9520e9d 100644 (file)
@@ -85,6 +85,7 @@
 
 #if defined (__APPLE__)
 #include <unistd.h>
+#include <TargetConditionals.h>
 #endif
 
 #if defined (__hpux__)
@@ -613,11 +614,18 @@ __gnat_get_file_names_case_sensitive (void)
       else
        {
          /* By default, we suppose filesystems aren't case sensitive on
-            Windows and Darwin (but they are on arm-darwin).  */
-#if defined (WINNT) || defined (__DJGPP__) \
-  || (defined (__APPLE__) && !(defined (__arm__) || defined (__arm64__)))
+            Windows or DOS.  */
+#if defined (WINNT) || defined (__DJGPP__)
          file_names_case_sensitive_cache = 0;
+#elif defined (__APPLE__)
+         /* By default, macOS volumes are case-insensitive, iOS
+            volumes are case-sensitive.  */
+#if TARGET_OS_IOS
+         file_names_case_sensitive_cache = 1;
 #else
+         file_names_case_sensitive_cache = 0;
+#endif
+#else /* Neither Windows nor Apple.  */
          file_names_case_sensitive_cache = 1;
 #endif
        }