Release Patch 4.1.3 (#266)
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 3bd7e68..3c4d535 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -3,9 +3,9 @@
on:
# Run on PRs and pushes to the default branch.
push:
- branches: [ master ]
+ branches: [ master, stable]
pull_request:
- branches: [ master ]
+ branches: [ master, stable]
schedule:
- cron: "0 0 * * 0"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5b0259..73861a3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+# 4.1.3
+- Analyzer fixes.
+
# 4.1.2
- Added fix for empty include list to exclude all
diff --git a/lib/src/code_generator/compound.dart b/lib/src/code_generator/compound.dart
index 8bdee9b..067e64f 100644
--- a/lib/src/code_generator/compound.dart
+++ b/lib/src/code_generator/compound.dart
@@ -4,9 +4,7 @@
import 'package:ffigen/src/code_generator.dart';
-import 'binding.dart';
import 'binding_string.dart';
-import 'type.dart';
import 'utils.dart';
import 'writer.dart';
diff --git a/lib/src/code_generator/func.dart b/lib/src/code_generator/func.dart
index 425ee47..d33f135 100644
--- a/lib/src/code_generator/func.dart
+++ b/lib/src/code_generator/func.dart
@@ -4,9 +4,7 @@
import 'package:ffigen/src/code_generator.dart';
-import 'binding.dart';
import 'binding_string.dart';
-import 'type.dart';
import 'utils.dart';
import 'writer.dart';
diff --git a/lib/src/code_generator/type.dart b/lib/src/code_generator/type.dart
index e442a63..ba16841 100644
--- a/lib/src/code_generator/type.dart
+++ b/lib/src/code_generator/type.dart
@@ -4,8 +4,6 @@
import 'package:ffigen/src/code_generator.dart';
-import 'compound.dart';
-import 'typealias.dart';
import 'writer.dart';
class _SubType {
diff --git a/lib/src/code_generator/typealias.dart b/lib/src/code_generator/typealias.dart
index 7320957..ea8ef95 100644
--- a/lib/src/code_generator/typealias.dart
+++ b/lib/src/code_generator/typealias.dart
@@ -5,7 +5,6 @@
import 'package:ffigen/src/code_generator.dart';
import 'binding_string.dart';
-import 'type.dart';
import 'utils.dart';
import 'writer.dart';
diff --git a/lib/src/header_parser/sub_parsers/compounddecl_parser.dart b/lib/src/header_parser/sub_parsers/compounddecl_parser.dart
index d0d5cd6..431334a 100644
--- a/lib/src/header_parser/sub_parsers/compounddecl_parser.dart
+++ b/lib/src/header_parser/sub_parsers/compounddecl_parser.dart
@@ -192,8 +192,7 @@
final resultCode = clang.clang_visitChildren(
cursor,
- Pointer.fromFunction(_compoundMembersVisitor,
- clang_types.CXChildVisitResult.CXChildVisit_Break),
+ Pointer.fromFunction(_compoundMembersVisitor, exceptional_visitor_return),
nullptr,
);
diff --git a/lib/src/header_parser/sub_parsers/enumdecl_parser.dart b/lib/src/header_parser/sub_parsers/enumdecl_parser.dart
index 52cb4ba..c4b2ab8 100644
--- a/lib/src/header_parser/sub_parsers/enumdecl_parser.dart
+++ b/lib/src/header_parser/sub_parsers/enumdecl_parser.dart
@@ -76,8 +76,7 @@
void _addEnumConstant(clang_types.CXCursor cursor) {
final resultCode = clang.clang_visitChildren(
cursor,
- Pointer.fromFunction(
- _enumCursorVisitor, clang_types.CXChildVisitResult.CXChildVisit_Break),
+ Pointer.fromFunction(_enumCursorVisitor, exceptional_visitor_return),
nullptr,
);
diff --git a/lib/src/header_parser/sub_parsers/functiondecl_parser.dart b/lib/src/header_parser/sub_parsers/functiondecl_parser.dart
index 41d877c..3b8cd63 100644
--- a/lib/src/header_parser/sub_parsers/functiondecl_parser.dart
+++ b/lib/src/header_parser/sub_parsers/functiondecl_parser.dart
@@ -7,7 +7,6 @@
import 'package:logging/logging.dart';
import '../clang_bindings/clang_bindings.dart' as clang_types;
-import '../data.dart' show clang;
import '../includer.dart';
import '../utils.dart';
diff --git a/lib/src/header_parser/sub_parsers/macro_parser.dart b/lib/src/header_parser/sub_parsers/macro_parser.dart
index 61db537..68bc080 100644
--- a/lib/src/header_parser/sub_parsers/macro_parser.dart
+++ b/lib/src/header_parser/sub_parsers/macro_parser.dart
@@ -80,8 +80,7 @@
final resultCode = clang.clang_visitChildren(
rootCursor,
- Pointer.fromFunction(_macroVariablevisitor,
- clang_types.CXChildVisitResult.CXChildVisit_Break),
+ Pointer.fromFunction(_macroVariablevisitor, exceptional_visitor_return),
nullptr,
);
diff --git a/lib/src/header_parser/sub_parsers/unnamed_enumdecl_parser.dart b/lib/src/header_parser/sub_parsers/unnamed_enumdecl_parser.dart
index 4cac558..940369a 100644
--- a/lib/src/header_parser/sub_parsers/unnamed_enumdecl_parser.dart
+++ b/lib/src/header_parser/sub_parsers/unnamed_enumdecl_parser.dart
@@ -19,8 +19,7 @@
void saveUnNamedEnum(clang_types.CXCursor cursor) {
final resultCode = clang.clang_visitChildren(
cursor,
- Pointer.fromFunction(_unnamedenumCursorVisitor,
- clang_types.CXChildVisitResult.CXChildVisit_Break),
+ Pointer.fromFunction(_unnamedenumCursorVisitor, exceptional_visitor_return),
nullptr,
);
diff --git a/lib/src/header_parser/translation_unit_parser.dart b/lib/src/header_parser/translation_unit_parser.dart
index 3e5a677..9a576c0 100644
--- a/lib/src/header_parser/translation_unit_parser.dart
+++ b/lib/src/header_parser/translation_unit_parser.dart
@@ -26,8 +26,7 @@
_bindings = {};
final resultCode = clang.clang_visitChildren(
translationUnitCursor,
- Pointer.fromFunction(
- _rootCursorVisitor, clang_types.CXChildVisitResult.CXChildVisit_Break),
+ Pointer.fromFunction(_rootCursorVisitor, exceptional_visitor_return),
nullptr,
);
diff --git a/lib/src/header_parser/utils.dart b/lib/src/header_parser/utils.dart
index f602cdf..471cc36 100644
--- a/lib/src/header_parser/utils.dart
+++ b/lib/src/header_parser/utils.dart
@@ -13,11 +13,14 @@
import 'data.dart';
import 'type_extractor/extractor.dart';
+const exceptional_visitor_return =
+ clang_types.CXChildVisitResult.CXChildVisit_Break;
+
/// Check [resultCode] of [clang.clang_visitChildren_wrap].
///
/// Throws exception if resultCode is not 0.
void visitChildrenResultChecker(int resultCode) {
- if (resultCode != 0) {
+ if (resultCode != exceptional_visitor_return) {
throw Exception(
'Exception thrown in a dart function called via C, use --verbose to see more details');
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 34a5c3c..34b851e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
name: ffigen
-version: 4.1.2
+version: 4.1.3
homepage: https://github.com/dart-lang/ffigen
description: Generator for FFI bindings, using LibClang to parse C header files.
diff --git a/test/config_tests/compiler_opts_test.dart b/test/config_tests/compiler_opts_test.dart
index b5e644b..5193d4d 100644
--- a/test/config_tests/compiler_opts_test.dart
+++ b/test/config_tests/compiler_opts_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:ffigen/ffigen.dart';
-import 'package:ffigen/src/code_generator.dart';
import 'package:ffigen/src/config_provider/spec_utils.dart';
import 'package:ffigen/src/strings.dart' as strings;
import 'package:test/test.dart';