Skip to content

Commit 695c065

Browse files
authored
[ffigen] Add compiler option -Wno-nullability-completeness by default (#1074)
1 parent cf4f974 commit 695c065

6 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎pkgs/ffigen/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
`ffi-native` option.
66
- Add `retainAndReturnPointer` method to ObjC objects and blocks, and add
77
`castFromPointer` method to blocks.
8+
- Add `-Wno-nullability-completeness` as default compiler option for MacOS.
89

910
## 11.0.0
1011

‎pkgs/ffigen/example/libclang-example/config.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ headers:
2222
compiler-opts:
2323
- '-I../../third_party/libclang/include'
2424
- '-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/'
25-
- '-Wno-nullability-completeness'
2625
functions:
2726
include:
2827
- 'clang_.*' # Can be a regexp, '.' matches any character.

‎pkgs/ffigen/lib/src/config_provider/config_types.dart‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ class CompilerOptsAuto {
347347

348348
/// Extracts compiler options based on OS and config.
349349
List<String> extractCompilerOpts() {
350-
if (Platform.isMacOS && macIncludeStdLib) {
351-
return getCStandardLibraryHeadersForMac();
352-
}
353-
354-
return [];
350+
return [
351+
if (Platform.isMacOS && macIncludeStdLib)
352+
...getCStandardLibraryHeadersForMac(),
353+
if (Platform.isMacOS) '-Wno-nullability-completeness',
354+
];
355355
}
356356
}
357357

‎pkgs/ffigen/test/config_tests/compiler_opts_test.dart‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
import 'dart:io';
6+
57
import 'package:ffigen/ffigen.dart';
68
import 'package:ffigen/src/config_provider/spec_utils.dart';
79
import 'package:ffigen/src/strings.dart' as strings;
@@ -40,7 +42,12 @@ ${strings.compilerOptsAuto}:
4042
${strings.macos}:
4143
${strings.includeCStdLib}: false
4244
''');
43-
expect(config.compilerOpts.isEmpty, true);
45+
expect(
46+
config.compilerOpts,
47+
equals([
48+
if (Platform.isMacOS) '-Wno-nullability-completeness',
49+
]),
50+
);
4451
});
4552
});
4653
}

‎pkgs/ffigen/test/native_test/config.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ headers:
1515
include-directives:
1616
- '**native_test.c'
1717

18-
compiler-opts: '-Wno-nullability-completeness'
1918
preamble: |
2019
// ignore_for_file: camel_case_types, non_constant_identifier_names
2120

‎pkgs/ffigen/tool/libclang_config.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ description: Holds bindings to LibClang.
1616
output: '../lib/src/header_parser/clang_bindings/clang_bindings.dart'
1717
compiler-opts:
1818
- '-Ithird_party/libclang/include'
19-
- '-Wno-nullability-completeness'
2019
headers:
2120
entry-points:
2221
- '../third_party/libclang/include/clang-c/Index.h'

0 commit comments

Comments
 (0)