On 17 Nov 2023, at 08:37, Arnaud Charlet <char...@adacore.com> wrote:
> 
>> Also, should the test code below (between %%%) be included in the
>> testsuite?
> 
> It would be good but tests shouldn't output anything, they should be self 
> testing,
> and you will need to deal with making the test portable to all targets.
> 
> Given that the compiler itself uses this feature, I don't think this is worth
> the trouble.

OK

>> @@ -613,12 +613,25 @@ __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 defined (TARGET_OS_OSX)      /* In recent SDK.  */
>> +#if TARGET_OS_OSX                /* macOS.  */   
>>        file_names_case_sensitive_cache = 0;
>> #else
>>        file_names_case_sensitive_cache = 1;
>> +#endif
>> +#elif TARGET_OS_MAC    /* macOS, in older SDK.  */
>> +      file_names_case_sensitive_cache = 0;
>> +#else
>> +      file_names_case_sensitive_cache = 1;
>> +#endif
>> +#else /* Neither Windows nor Apple.  */
>> +      file_names_case_sensitive_cache = 1;
>> #endif
> 
> Please simplify the above to (untested):
> 
> #elif defined (__APPLE__)
>        /* By default, macOS volumes are case-insensitive, iOS
>           volumes are case-sensitive.  */
> #if TARGET_OS_MAC    /* macOS, in older SDK.  */
>         file_names_case_sensitive_cache = 0;
> #elif TARGET_OS_OSX  /* macOS, in recent SDK.  */
>         file_names_case_sensitive_cache = 0;
> #else                /* assume iOS.  */
>         file_names_case_sensitive_cache = 1;
> #endif
> #else /* Neither Windows nor Apple.  */
>        file_names_case_sensitive_cache = 1;
> #endif
> 
> which is simpler and more readable and should be equivalent AFAICT.
> 
> OK with the above change.
> 
> Arno

Sorry, but that wouldn’t work.

TargetConditionals.h is created by Apple as part of SDK construction, so the 
TARGET_* macros are defined directly (#define TARGET_OS_OSX 1),

In a newer macOS SDK, both TARGET_OS_MAC and TARGET_OS_OSX are defined and set 
to 1, and TARGET_OS_MAC covers OSX (macOS), IOS, TV, WATCH and others.
In an older macOS SDK, TARGET_OS_MAC is defined and set to 1, and none of the 
others are defined at all.

This is from the current TargetConditionals.h:

 *    
+---------------------------------------------------------------------------+
 *    |                             TARGET_OS_MAC                               
  |
 *    | +-----+ +-------------------------------------------------+ 
+-----------+ |
 *    | |     | |                  TARGET_OS_IPHONE               | |           
| |
 *    | |     | | +-----------------+ +----+ +-------+ +--------+ | |           
| |
 *    | |     | | |       IOS       | |    | |       | |        | | |           
| |
 *    | | OSX | | | +-------------+ | | TV | | WATCH | | BRIDGE | | | DRIVERKIT 
| |
 *    | |     | | | | MACCATALYST | | |    | |       | |        | | |           
| |
 *    | |     | | | +-------------+ | |    | |       | |        | | |           
| |
 *    | |     | | +-----------------+ +----+ +-------+ +--------+ | |           
| |
 *    | +-----+ +-------------------------------------------------+ 
+-----------+ |
 *    
+---------------------------------------------------------------------------+



Reply via email to