Tk Source Code

View Ticket
Login
2026-11-15
01:44
Fix [1ccface1]: tkMacOSXFileTypes.c does not compile on 10.15; patch from Christopher Chavez. check-in: cc51739e user: culler tags: trunk, main
01:42
Fix [1ccface1]: tkMacOSXFileTypes.c does not compile on 10.15; patch from Christopher Chavez. check-in: 23b4b9c3 user: culler tags: core-9-0-branch
01:40 • Closed ticket [1ccface1]: tkMacOSXFileTypes.c does not compile on 10.15 plus 4 other changes artifact: 6e756521 user: marc_culler
01:35
Fix [1ccface1]: tkMacOSXFileTypes.c does not compile on 10.15; patch from Christopher Chavez. check-in: 7bdecbc6 user: culler tags: core-8-6-branch
00:10 • Ticket [1ccface1] tkMacOSXFileTypes.c does not compile on 10.15 status still Pending with 4 other changes artifact: 2b1b5ec7 user: marc_culler
2026-11-03
15:37 • Ticket [1ccface1]: 3 changes artifact: 83dc882a user: chrstphrchvz
2022-09-23
18:05 • Add attachment 1ccface1c510-result.diff to ticket [1ccface1] artifact: 49b21139 user: chrstphrchvz
18:04 • Ticket [1ccface1] tkMacOSXFileTypes.c does not compile on 10.15 status still Pending with 3 other changes artifact: a4f36bb2 user: chrstphrchvz
2022-09-22
15:44 • Ticket [1ccface1]: 4 changes artifact: 7f8a9524 user: marc_culler
14:43 • Ticket [1ccface1]: 4 changes artifact: 2fc3d4cf user: chrstphrchvz
2022-09-21
23:27 • Pending ticket [1ccface1]. artifact: ca882979 user: marc_culler
22:45
Fix [1ccface1c5]: Aqua build fails on macOS 10.15 (I hope I got this right.) check-in: ed04ec46 user: marc_culler tags: core-8-6-branch
20:04 • Ticket [1ccface1] tkMacOSXFileTypes.c does not compile on 10.15 status still Open with 4 other changes artifact: a45f919c user: marc_culler
19:29
Fix [1ccface1c5]: Aqua build fails on macOS 10.15 closed check-in: e034999c user: marc_culler tags: mistake
18:53 • Ticket [1ccface1] tkMacOSXFileTypes.c does not compile on 10.15 status still Open with 3 other changes artifact: 916965fc user: chrstphrchvz
18:50 • Add attachment 1ccface1c510-alt.diff to ticket [1ccface1] artifact: 2ac9bddf user: chrstphrchvz
15:16 • Ticket [1ccface1] tkMacOSXFileTypes.c does not compile on 10.15 status still Open with 4 other changes artifact: 74115244 user: marc_culler
2022-09-20
16:00 • Ticket [1ccface1]: 5 changes artifact: dcc4841f user: marc_culler
15:58
Fix [1ccface1c5]: build fails on macOS 10.15 leaf check-in: 3e83ac71 user: marc_culler tags: bug-1ccface1c5
15:24 • New ticket [1ccface1] tkMacOSXFileTypes.c does not compile on 10.15. artifact: ce458aef user: chrstphrchvz

Ticket UUID: 1ccface1c5107b308a1a7be15987853565e6e711
Title: tkMacOSXFileTypes.c does not compile on 10.15
Type: Bug Version: core-8-6-branch
Submitter: chrstphrchvz Created on: 2022-09-20 15:24:46
Subsystem: 83. Mac OS X Build Assigned To: marc_culler
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2026-11-15 01:40:25
Resolution: Fixed Closed By: marc_culler
    Closed on: 2026-11-15 01:40:25
Description:

tk/macosx/tkMacOSXFileTypes.c:79:20: error: use of undeclared identifier 'UTType'
        UTType *uttype = [UTType typeWithIdentifier: filetype];
                          ^
tk/macosx/tkMacOSXFileTypes.c:79:2: error: use of undeclared identifier 'UTType'
        UTType *uttype = [UTType typeWithIdentifier: filetype];
        ^
tk/macosx/tkMacOSXFileTypes.c:79:10: error: use of undeclared identifier 'uttype'
        UTType *uttype = [UTType typeWithIdentifier: filetype];
                ^
tk/macosx/tkMacOSXFileTypes.c:80:8: error: use of undeclared identifier 'uttype'
        if (![uttype isDeclared]) {
              ^
tk/macosx/tkMacOSXFileTypes.c:81:6: error: use of undeclared identifier 'uttype'
            uttype = [UTType typeWithFilenameExtension: filetype];
            ^
tk/macosx/tkMacOSXFileTypes.c:81:16: error: use of undeclared identifier 'UTType'
            uttype = [UTType typeWithFilenameExtension: filetype];
                      ^
tk/macosx/tkMacOSXFileTypes.c:83:8: error: use of undeclared identifier 'uttype'
        if (![uttype isDeclared] && [filetype length] == 4) {
              ^
tk/macosx/tkMacOSXFileTypes.c:86:6: error: use of undeclared identifier 'uttype'; did you mean 'ostype'?
            uttype = [UTType typeWithIdentifier:UTI];
            ^~~~~~
            ostype
tk/macosx/tkMacOSXFileTypes.c:84:13: note: 'ostype' declared here
            OSType ostype = CHARS_TO_OSTYPE(filetype.UTF8String);
                   ^
tk/macosx/tkMacOSXFileTypes.c:86:16: error: use of undeclared identifier 'UTType'
            uttype = [UTType typeWithIdentifier:UTI];
                      ^
tk/macosx/tkMacOSXFileTypes.c:88:8: error: use of undeclared identifier 'uttype'
        if (![uttype isDeclared]) {
              ^
tk/macosx/tkMacOSXFileTypes.c:91:40: warning: instance method '-iconForContentType:' not found (return type defaults to 'id') [-Wobjc-method-access]
        return [[NSWorkspace sharedWorkspace] iconForContentType:uttype];
                                              ^~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:27:12: note: receiver is instance of class declared here
@interface NSWorkspace : NSObject
           ^
tk/macosx/tkMacOSXFileTypes.c:91:59: error: use of undeclared identifier 'uttype'
        return [[NSWorkspace sharedWorkspace] iconForContentType:uttype];
                                                                 ^
tk/macosx/tkMacOSXFileTypes.c:91:40: warning: instance method '-iconForContentType:' not found (return type defaults to 'id') [-Wobjc-method-access]
        return [[NSWorkspace sharedWorkspace] iconForContentType:uttype];
                                              ^~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:27:12: note: receiver is instance of class declared here
@interface NSWorkspace : NSObject
           ^
2 warnings and 11 errors generated.

User Comments: marc_culler (claiming to be Marc Culler) added on 2026-11-15 00:10:57:
I built 8.6 with the patch-1ccface1 branch merged into the tip of
core-86-branch on macOS 10.13 and 10.15.  Also on macOS 15 with a
minimum deployment target of 10.15 and with both a minimum and
a maximum deployment target of 10.15.  All of the builds worked
with only the expected warnings (i.e. scrollRect:by: is deprecated).

There were test failures, but that is another story.

I think this can be merged.

chrstphrchvz added on 2026-11-03 15:37:25:

Revised patch committed, please see branch patch-1ccface1. Compare to structure of preceding function TkMacOSXOSTypeToUTI().


chrstphrchvz added on 2022-09-23 18:04:43:

The patch is simpler, and better, but it does not avoid a warning in the case where MIN_REQUIRED == MAX_ALLOWED == 12.0, say. That is because there is no else block for the if (@available) block in that case.

I had not realized this, however I would deal with it just by introducing a result variable. Would that still be simpler? See patch 1ccface1c510-result.diff (based on core-8-6-branch)


marc_culler (claiming to be Marc Culler) added on 2022-09-22 15:44:01:
Thank you!

I moved the } inside of the #if ... #endif block, where it belongs.
I tried adding
#define MAC_OS_X_VERSION_MAX_ALLOWED 101500
#define MAC_OS_X_VERSION_MIN_REQUIRED 101500
at the top of the tkMacOSXFileTypes.c source file and the compiler did
not report any syntax errors.  So I think it may finally be correct.

chrstphrchvz added on 2022-09-22 14:43:22:

tk/macosx/tkMacOSXFileTypes.c:114:1: error: extraneous closing brace ('}')
}
^
1 error generated.


marc_culler (claiming to be Marc Culler) added on 2022-09-21 23:27:24:
Pending the drop of the other shoe.

marc_culler (claiming to be Marc Culler) added on 2022-09-21 20:04:19:
Thanks!

The patch is simpler, and better, but it does not avoid a warning
in the case where MIN_REQUIRED == MAX_ALLOWED == 12.0, say. That
is because there is no else block for the if (@available) block
in that case.

I wish Apple would deal with this problem in a better way.

chrstphrchvz added on 2022-09-21 18:53:46:

[3e83ac71ca45] does build on 10.15, but it leads to a warning:

tk/macosx/tkMacOSXFileTypes.c:105:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^

See the attached patch 1ccface1c510-alt.diff (based on latest tkMacOSXFileTypes.c in core-8-6-branch); would these changes both avoid the warning and be simpler?


marc_culler (claiming to be Marc Culler) added on 2022-09-21 15:16:27:
Can anyone test to make sure the bug-fix branch now builds on 10.15?
I can't do it right now.

marc_culler (claiming to be Marc Culler) added on 2022-09-20 16:00:27:
Thank you Christopher.  I added an #if ... #endif pair which will hopefully
fix this.  I put it in a bugfix branch bug-1ccface1c5 in case there are more.

Would you please try again?  Thanks!

Attachments: