Skip to content

Fix nullable-to-nonnull conversions for Xcode 26.6 (#20466)#20466

Merged
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
NSProgrammer:export-D109459540
Jun 24, 2026
Merged

Fix nullable-to-nonnull conversions for Xcode 26.6 (#20466)#20466
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
NSProgrammer:export-D109459540

Conversation

@NSProgrammer

@NSProgrammer NSProgrammer commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary:

X-link: pytorch/pytorch#187979

Xcode 26.x errors under -Werror on implicit conversions from nullable NSString.UTF8String results to non-nullable const char * / std::string parameters. Guard each affected site with a ?: "" fallback (these paths are non-null in practice, so behavior is unchanged). Fixed sites (both the fbcode and xplat mirror copies):

  • caffe2/.../mpscnn/tests/MPSCNNTests.mm: the sf.UTF8String append in the tensor-printing helper.
  • executorch/.../ExecuTorchLLMTextRunner.mm: token.UTF8String (special tokens), _modelPath/_tokenizerPath (runner creation), and prompt.UTF8String (generate).
  • executorch/.../ExecuTorchLLMMultimodalRunner.mm: _modelPath/_tokenizerPath (runner creation) and input.text.UTF8String (text input).

Differential Revision: D109459540

@pytorch-bot

pytorch-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20466

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 3 New Failures, 3 Unrelated Failures

As of commit 63b852d with merge base aada6d7 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 23, 2026
@meta-codesync

meta-codesync Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@NSProgrammer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109459540.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Summary:

X-link: pytorch/pytorch#187979

Xcode 26.x errors under `-Werror` on implicit conversions from nullable `NSString.UTF8String` results to non-nullable `const char *` / `std::string` parameters. Guard each affected site with a `?: ""` fallback (these paths are non-null in practice, so behavior is unchanged). Fixed sites (both the `fbcode` and `xplat` mirror copies):

- `caffe2/.../mpscnn/tests/MPSCNNTests.mm`: the `sf.UTF8String` append in the tensor-printing helper.
- `executorch/.../ExecuTorchLLMTextRunner.mm`: `token.UTF8String` (special tokens), `_modelPath`/`_tokenizerPath` (runner creation), and `prompt.UTF8String` (generate).
- `executorch/.../ExecuTorchLLMMultimodalRunner.mm`: `_modelPath`/`_tokenizerPath` (runner creation) and `input.text.UTF8String` (text input).

___

Differential Revision: D109459540
@meta-codesync meta-codesync Bot changed the title Fix nullable-to-nonnull conversions for Xcode 26.6 Fix nullable-to-nonnull conversions for Xcode 26.6 (#20466) Jun 24, 2026
NSProgrammer added a commit to NSProgrammer/pytorch that referenced this pull request Jun 24, 2026
Summary:
X-link: pytorch/executorch#20466


Xcode 26.x errors under `-Werror` on implicit conversions from nullable `NSString.UTF8String` results to non-nullable `const char *` / `std::string` parameters. Guard each affected site with a `?: ""` fallback (these paths are non-null in practice, so behavior is unchanged). Fixed sites (both the `fbcode` and `xplat` mirror copies):

- `caffe2/.../mpscnn/tests/MPSCNNTests.mm`: the `sf.UTF8String` append in the tensor-printing helper.
- `executorch/.../ExecuTorchLLMTextRunner.mm`: `token.UTF8String` (special tokens), `_modelPath`/`_tokenizerPath` (runner creation), and `prompt.UTF8String` (generate).
- `executorch/.../ExecuTorchLLMMultimodalRunner.mm`: `_modelPath`/`_tokenizerPath` (runner creation) and `input.text.UTF8String` (text input).

___

Test Plan:
Affected targets build clean under the Apple SDK:

```
buck2 build fbobjc/mode/buck2/ios-tests -c 'facebook-dt#apple.xcode_sdk_version=xcode_26.4.1_17e202' --skip-incompatible-targets --skip-missing-targets fbsource//xplat/caffe2:aten_metal_testsApple
buck2 build fbobjc/mode/buck2/ios-tests -c 'facebook-dt#apple.xcode_sdk_version=xcode_26.4.1_17e202' --skip-incompatible-targets --skip-missing-targets fbsource//xplat/executorch/extension/llm/apple:ExecuTorchLLMTests
```

Differential Revision: D109459540
@mergennachin mergennachin requested a review from shoumikhin June 24, 2026 02:33
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jun 24, 2026
Summary:
X-link: pytorch/executorch#20466

Xcode 26.x errors under `-Werror` on implicit conversions from nullable `NSString.UTF8String` results to non-nullable `const char *` / `std::string` parameters. Guard each affected site with a `?: ""` fallback (these paths are non-null in practice, so behavior is unchanged). Fixed sites (both the `fbcode` and `xplat` mirror copies):

- `caffe2/.../mpscnn/tests/MPSCNNTests.mm`: the `sf.UTF8String` append in the tensor-printing helper.
- `executorch/.../ExecuTorchLLMTextRunner.mm`: `token.UTF8String` (special tokens), `_modelPath`/`_tokenizerPath` (runner creation), and `prompt.UTF8String` (generate).
- `executorch/.../ExecuTorchLLMMultimodalRunner.mm`: `_modelPath`/`_tokenizerPath` (runner creation) and `input.text.UTF8String` (text input).

___

Test Plan:
Affected targets build clean under the Apple SDK:

```
buck2 build fbobjc/mode/buck2/ios-tests -c 'facebook-dt#apple.xcode_sdk_version=xcode_26.4.1_17e202' --skip-incompatible-targets --skip-missing-targets fbsource//xplat/caffe2:aten_metal_testsApple
buck2 build fbobjc/mode/buck2/ios-tests -c 'facebook-dt#apple.xcode_sdk_version=xcode_26.4.1_17e202' --skip-incompatible-targets --skip-missing-targets fbsource//xplat/executorch/extension/llm/apple:ExecuTorchLLMTests
```

Differential Revision: D109459540

Pull Request resolved: #187979
Approved by: https://github.com/larryliu0820, https://github.com/Skylion007
@meta-codesync meta-codesync Bot merged commit 45a14b9 into pytorch:main Jun 24, 2026
176 of 183 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants