Skip to content

Commit 3a4f1a2

Browse files
committed
Remove default argument of export_values
1 parent 553842f commit 3a4f1a2

6 files changed

+5
-27
lines changed

include/genpybind/annotations/annotations.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ANNOTATION_KIND(Visible, visible) // (Boolean|Default)?
99

1010
// EnumDecl
1111
ANNOTATION_KIND(Arithmetic, arithmetic) // (Boolean)?
12-
ANNOTATION_KIND(ExportValues, export_values) // (Boolean|Default)?
12+
ANNOTATION_KIND(ExportValues, export_values) // (Boolean)?
1313

1414
// CXXMethodDecl only (but not CXXConstructorDecl, CXXConversionDecl, CXXDestructorDecl, and operators)
1515
ANNOTATION_KIND(GetterFor, getter_for) // (String)+

src/annotated_decl.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -380,22 +380,15 @@ bool genpybind::processAnnotation(const clang::NamedDecl *decl,
380380
return false;
381381

382382
case AnnotationKind::Arithmetic:
383-
return dispatch
384-
.nullary([&]() { attrs.arithmetic = true; })
385-
// TODO: "default"?
383+
return dispatch.nullary([&]() { attrs.arithmetic = true; })
386384
.unary(LiteralValue::Kind::Boolean,
387385
[&](const LiteralValue &value) {
388386
attrs.arithmetic = value.getBoolean();
389387
})
390388
.checkMatch();
391389

392390
case AnnotationKind::ExportValues:
393-
return dispatch
394-
.nullary([&]() { attrs.export_values = true; })
395-
// TODO: Remove "default"?
396-
.unary(
397-
LiteralValue::Kind::Default,
398-
[&](const LiteralValue &) { attrs.export_values = std::nullopt; })
391+
return dispatch.nullary([&]() { attrs.export_values = true; })
399392
.unary(LiteralValue::Kind::Boolean,
400393
[&](const LiteralValue &value) {
401394
attrs.export_values = value.getBoolean();
@@ -420,9 +413,7 @@ bool genpybind::processAnnotation(const clang::NamedDecl *decl,
420413
return false;
421414

422415
case AnnotationKind::DynamicAttr:
423-
return dispatch
424-
.nullary([&]() { attrs.dynamic_attr = true; })
425-
// TODO: "default"?
416+
return dispatch.nullary([&]() { attrs.dynamic_attr = true; })
426417
.unary(LiteralValue::Kind::Boolean,
427418
[&](const LiteralValue &value) {
428419
attrs.dynamic_attr = value.getBoolean();

tests/integration/enums-export-values-when-scoped.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ enum class GENPYBIND(export_values) ScopedExport {
1010
ScopedExportC,
1111
};
1212

13-
enum class GENPYBIND(export_values(default)) ScopedExportDefault {
14-
ScopedExportDefaultA,
15-
ScopedExportDefaultB,
16-
ScopedExportDefaultC,
17-
};
18-
1913
enum class GENPYBIND(export_values(true)) ScopedExportTrue {
2014
ScopedExportTrueA,
2115
ScopedExportTrueB,

tests/integration/enums-export-values-when-scoped_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_values_are_exported():
99

1010

1111
def test_values_are_not_exported():
12-
for name in ["Scoped", "ScopedExportDefault", "ScopedExportFalse"]:
12+
for name in ["Scoped", "ScopedExportFalse"]:
1313
enum = getattr(m, name)
1414
for suffix in ["A", "B", "C"]:
1515
assert not hasattr(m, f"{name}{suffix}")

tests/integration/enums-export-values-when-unscoped.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ enum GENPYBIND(export_values) UnscopedExport {
1010
UnscopedExportC,
1111
};
1212

13-
enum GENPYBIND(export_values(default)) UnscopedExportDefault {
14-
UnscopedExportDefaultA,
15-
UnscopedExportDefaultB,
16-
UnscopedExportDefaultC,
17-
};
18-
1913
enum GENPYBIND(export_values(true)) UnscopedExportTrue {
2014
UnscopedExportTrueA,
2115
UnscopedExportTrueB,

tests/integration/enums-export-values-when-unscoped_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ def test_values_are_exported():
55
for name in [
66
"Unscoped",
77
"UnscopedExport",
8-
"UnscopedExportDefault",
98
"UnscopedExportTrue",
109
]:
1110
enum = getattr(m, name)

0 commit comments

Comments
 (0)