Skip to content

[various] Enable permissive- for Windows plugin examples #8636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/camera/camera_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.2.6+2

* Fixes compile errors under strict standards mode.
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.

## 0.2.6+1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
# Enable strict standards mode in the example app, since issues it finds
# may become errors by default in future compiler versions.
target_compile_options(${TARGET} PRIVATE /permissive-)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
endfunction()
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_windows/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_windows
description: A Flutter plugin for getting information about and controlling the camera on Windows.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_windows
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.2.6+1
version: 0.2.6+2

environment:
sdk: ^3.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class CaptureDeviceInfo {

// Parses display name and device id from unique device name format.
// Format: "display_name <device_id>".
bool CaptureDeviceInfo::ParseDeviceInfoFromCameraName(
const std::string& camera_name);
bool ParseDeviceInfoFromCameraName(const std::string& camera_name);

// Updates display name.
void SetDisplayName(const std::string& display_name) {
Expand Down
3 changes: 2 additions & 1 deletion packages/file_selector/file_selector_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.9.3+4

* Fixes compile errors under strict standards mode.
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.

## 0.9.3+3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
# Enable strict standards mode in the example app, since issues it finds
# may become errors by default in future compiler versions.
target_compile_options(${TARGET} PRIVATE /permissive-)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
endfunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: file_selector_windows
description: Windows implementation of the file_selector plugin.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_windows
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
version: 0.9.3+3
version: 0.9.3+4

environment:
sdk: ^3.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ ErrorOr<FileDialogResult> ShowDialog(
mode == DialogMode::save ? CLSID_FileSaveDialog : CLSID_FileOpenDialog;
DialogWrapper dialog(dialog_factory, dialog_type);
if (!SUCCEEDED(dialog.last_result())) {
return FlutterError("System error", "Could not create dialog",
EncodableValue(dialog.last_result()));
return FlutterError(
"System error", "Could not create dialog",
EncodableValue(std::in_place_type<int32_t>, dialog.last_result()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the fixed issue link for the explanation for this.

}

FILEOPENDIALOGOPTIONS dialog_options = 0;
Expand Down Expand Up @@ -253,8 +254,9 @@ ErrorOr<FileDialogResult> ShowDialog(
std::optional<FileDialogResult> result = dialog.Show(parent_window);
if (!result) {
if (dialog.last_result() != HRESULT_FROM_WIN32(ERROR_CANCELLED)) {
return FlutterError("System error", "Could not show dialog",
EncodableValue(dialog.last_result()));
return FlutterError(
"System error", "Could not show dialog",
EncodableValue(std::in_place_type<int32_t>, dialog.last_result()));
} else {
return FileDialogResult(EncodableList(), nullptr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
# Enable strict standards mode in the example app, since issues it finds
# may become errors by default in future compiler versions.
target_compile_options(${TARGET} PRIVATE /permissive-)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
endfunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
# Enable strict standards mode in the example app, since issues it finds
# may become errors by default in future compiler versions.
target_compile_options(${TARGET} PRIVATE /permissive-)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
endfunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
# Enable strict standards mode in the example app, since issues it finds
# may become errors by default in future compiler versions.
target_compile_options(${TARGET} PRIVATE /permissive-)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
endfunction()
Expand Down
104 changes: 52 additions & 52 deletions packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof

Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@ ErrorOr<AllTypes> TestPlugin::EchoAllTypes(const AllTypes& everything) {
ErrorOr<std::optional<AllNullableTypes>> TestPlugin::EchoAllNullableTypes(
const AllNullableTypes* everything) {
if (!everything) {
return std::nullopt;
return std::optional<AllNullableTypes>(std::nullopt);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file made me sad. I'm assuming the standard doesn't allow the two-level chaining of implicit conversions that this was relying on (foo -> optional -> ErrorOr<optional>), so this does one of them explicitly and then relies on the implicit construction of ErrorOr.

}
return *everything;
return std::optional<AllNullableTypes>(*everything);
}

ErrorOr<std::optional<AllNullableTypesWithoutRecursion>>
TestPlugin::EchoAllNullableTypesWithoutRecursion(
const AllNullableTypesWithoutRecursion* everything) {
if (!everything) {
return std::nullopt;
return std::optional<AllNullableTypesWithoutRecursion>(std::nullopt);
}
return *everything;
return std::optional<AllNullableTypesWithoutRecursion>(*everything);
}

ErrorOr<std::optional<flutter::EncodableValue>> TestPlugin::ThrowError() {
Expand Down Expand Up @@ -288,193 +288,193 @@ TestPlugin::SendMultipleNullableTypesWithoutRecursion(
ErrorOr<std::optional<int64_t>> TestPlugin::EchoNullableInt(
const int64_t* a_nullable_int) {
if (!a_nullable_int) {
return std::nullopt;
return std::optional<int64_t>(std::nullopt);
}
return *a_nullable_int;
return std::optional<int64_t>(*a_nullable_int);
};

ErrorOr<std::optional<double>> TestPlugin::EchoNullableDouble(
const double* a_nullable_double) {
if (!a_nullable_double) {
return std::nullopt;
return std::optional<double>(std::nullopt);
}
return *a_nullable_double;
return std::optional<double>(*a_nullable_double);
};

ErrorOr<std::optional<bool>> TestPlugin::EchoNullableBool(
const bool* a_nullable_bool) {
if (!a_nullable_bool) {
return std::nullopt;
return std::optional<bool>(std::nullopt);
}
return *a_nullable_bool;
return std::optional<bool>(*a_nullable_bool);
};

ErrorOr<std::optional<std::string>> TestPlugin::EchoNullableString(
const std::string* a_nullable_string) {
if (!a_nullable_string) {
return std::nullopt;
return std::optional<std::string>(std::nullopt);
}
return *a_nullable_string;
return std::optional<std::string>(*a_nullable_string);
};

ErrorOr<std::optional<std::vector<uint8_t>>> TestPlugin::EchoNullableUint8List(
const std::vector<uint8_t>* a_nullable_uint8_list) {
if (!a_nullable_uint8_list) {
return std::nullopt;
return std::optional<std::vector<uint8_t>>(std::nullopt);
}
return *a_nullable_uint8_list;
return std::optional<std::vector<uint8_t>>(*a_nullable_uint8_list);
};

ErrorOr<std::optional<EncodableValue>> TestPlugin::EchoNullableObject(
const EncodableValue* a_nullable_object) {
if (!a_nullable_object) {
return std::nullopt;
return std::optional<EncodableValue>(std::nullopt);
}
return *a_nullable_object;
return std::optional<EncodableValue>(*a_nullable_object);
};

ErrorOr<std::optional<EncodableList>> TestPlugin::EchoNullableList(
const EncodableList* a_nullable_list) {
if (!a_nullable_list) {
return std::nullopt;
return std::optional<EncodableList>(std::nullopt);
}
return *a_nullable_list;
return std::optional<EncodableList>(*a_nullable_list);
};

ErrorOr<std::optional<EncodableList>> TestPlugin::EchoNullableEnumList(
const EncodableList* enum_list) {
if (!enum_list) {
return std::nullopt;
return std::optional<EncodableList>(std::nullopt);
}
return *enum_list;
return std::optional<EncodableList>(*enum_list);
};

ErrorOr<std::optional<EncodableList>> TestPlugin::EchoNullableClassList(
const EncodableList* class_list) {
if (!class_list) {
return std::nullopt;
return std::optional<EncodableList>(std::nullopt);
}
return *class_list;
return std::optional<EncodableList>(*class_list);
};

ErrorOr<std::optional<EncodableList>> TestPlugin::EchoNullableNonNullEnumList(
const EncodableList* enum_list) {
if (!enum_list) {
return std::nullopt;
return std::optional<EncodableList>(std::nullopt);
}
return *enum_list;
return std::optional<EncodableList>(*enum_list);
};

ErrorOr<std::optional<EncodableList>> TestPlugin::EchoNullableNonNullClassList(
const EncodableList* class_list) {
if (!class_list) {
return std::nullopt;
return std::optional<EncodableList>(std::nullopt);
}
return *class_list;
return std::optional<EncodableList>(*class_list);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableMap(
const EncodableMap* map) {
if (!map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *map;
return std::optional<EncodableMap>(*map);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableStringMap(
const EncodableMap* string_map) {
if (!string_map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *string_map;
return std::optional<EncodableMap>(*string_map);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableIntMap(
const EncodableMap* int_map) {
if (!int_map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *int_map;
return std::optional<EncodableMap>(*int_map);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableEnumMap(
const EncodableMap* enum_map) {
if (!enum_map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *enum_map;
return std::optional<EncodableMap>(*enum_map);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableClassMap(
const EncodableMap* class_map) {
if (!class_map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *class_map;
return std::optional<EncodableMap>(*class_map);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableNonNullStringMap(
const EncodableMap* string_map) {
if (!string_map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *string_map;
return std::optional<EncodableMap>(*string_map);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableNonNullIntMap(
const EncodableMap* int_map) {
if (!int_map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *int_map;
return std::optional<EncodableMap>(*int_map);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableNonNullEnumMap(
const EncodableMap* enum_map) {
if (!enum_map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *enum_map;
return std::optional<EncodableMap>(*enum_map);
};

ErrorOr<std::optional<EncodableMap>> TestPlugin::EchoNullableNonNullClassMap(
const EncodableMap* class_map) {
if (!class_map) {
return std::nullopt;
return std::optional<EncodableMap>(std::nullopt);
}
return *class_map;
return std::optional<EncodableMap>(*class_map);
};

ErrorOr<std::optional<AnEnum>> TestPlugin::EchoNullableEnum(
const AnEnum* an_enum) {
if (!an_enum) {
return std::nullopt;
return std::optional<AnEnum>(std::nullopt);
}
return *an_enum;
return std::optional<AnEnum>(*an_enum);
}

ErrorOr<std::optional<AnotherEnum>> TestPlugin::EchoAnotherNullableEnum(
const AnotherEnum* another_enum) {
if (!another_enum) {
return std::nullopt;
return std::optional<AnotherEnum>(std::nullopt);
}
return *another_enum;
return std::optional<AnotherEnum>(*another_enum);
}

ErrorOr<std::optional<int64_t>> TestPlugin::EchoOptionalNullableInt(
const int64_t* a_nullable_int) {
if (!a_nullable_int) {
return std::nullopt;
return std::optional<int64_t>(std::nullopt);
}
return *a_nullable_int;
return std::optional<int64_t>(*a_nullable_int);
}

ErrorOr<std::optional<std::string>> TestPlugin::EchoNamedNullableString(
const std::string* a_nullable_string) {
if (!a_nullable_string) {
return std::nullopt;
return std::optional<std::string>(std::nullopt);
}
return *a_nullable_string;
return std::optional<std::string>(*a_nullable_string);
}

void TestPlugin::NoopAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
# Enable strict standards mode in the example app, since issues it finds
# may become errors by default in future compiler versions.
target_compile_options(${TARGET} PRIVATE /permissive-)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
endfunction()
Expand Down