Skip to content

Commit 2803002

Browse files
committed
fix: disable binding on bitfiled member
1 parent cef4236 commit 2803002

2 files changed

Lines changed: 31 additions & 31 deletions

File tree

pybind11_weaver/entity/klass/field.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
def _is_bindable(cursor: cindex.Cursor):
1515
c_type = common.remove_const_ref_pointer(cursor.type)
1616
canonical = c_type.get_canonical()
17-
if int(canonical.kind) <= int(cindex.TypeKind.CXType_LastBuiltin) and int(canonical.kind) >= int(
18-
cindex.TypeKind.CXType_FirstBuiltin):
17+
if int(cindex.TypeKind.CXType_LastBuiltin) >= int(canonical.kind) >= int(cindex.TypeKind.CXType_FirstBuiltin) \
18+
and not cursor.is_bitfield():
1919
return True
2020
if canonical.kind == cindex.TypeKind.CXType_Enum:
2121
return True

sample/all_feature/_binding.cc.inc

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
// GENERATED AT 10/31/2023, 12:10:00
2+
// GENERATED AT 05/27/2024, 20:22:56
33

44
#include "c_lib/c_lib.h"
55
#include "template_pb11_weaver_helper.h"
@@ -293,7 +293,7 @@ using Entity_Foo_Q_R6int9_8 = Bind_Foo_Q_R6int9_8<>;
293293
#else
294294

295295
struct Entity_Foo_Q_R6int9_8 : public pybind11_weaver::DisabledEntity {
296-
explicit Entity_Foo_Q_R6int9_8(EntityScope parent_h) {}
296+
explicit Entity_Foo_Q_R6int9_8(EntityScope) {}
297297
static const char *Key() { return "Foo_Q_R6int9_8"; }
298298
};
299299

@@ -340,7 +340,7 @@ using Entity_Foo_float_9 = Bind_Foo_float_9<>;
340340
#else
341341

342342
struct Entity_Foo_float_9 : public pybind11_weaver::DisabledEntity {
343-
explicit Entity_Foo_float_9(EntityScope parent_h) {}
343+
explicit Entity_Foo_float_9(EntityScope) {}
344344
static const char *Key() { return "Foo_float_9"; }
345345
};
346346

@@ -384,7 +384,7 @@ using Entity_GetNotBoundType = Bind_GetNotBoundType<>;
384384
#else
385385

386386
struct Entity_GetNotBoundType : public pybind11_weaver::DisabledEntity {
387-
explicit Entity_GetNotBoundType(EntityScope parent_h) {}
387+
explicit Entity_GetNotBoundType(EntityScope) {}
388388
static const char *Key() { return "GetNotBoundType"; }
389389
};
390390

@@ -416,7 +416,7 @@ using Entity_Q = Bind_Q<>;
416416
#else
417417

418418
struct Entity_Q : public pybind11_weaver::DisabledEntity {
419-
explicit Entity_Q(EntityScope parent_h) {}
419+
explicit Entity_Q(EntityScope) {}
420420
static const char *Key() { return "Q"; }
421421
};
422422

@@ -451,7 +451,7 @@ using Entity_Q_R6int9 = Bind_Q_R6int9<>;
451451
#else
452452

453453
struct Entity_Q_R6int9 : public pybind11_weaver::DisabledEntity {
454-
explicit Entity_Q_R6int9(EntityScope parent_h) {}
454+
explicit Entity_Q_R6int9(EntityScope) {}
455455
static const char *Key() { return "Q_R6int9"; }
456456
};
457457

@@ -504,7 +504,7 @@ using Entity_template_ns_TemplateClass6double9 =
504504

505505
struct Entity_template_ns_TemplateClass6double9
506506
: public pybind11_weaver::DisabledEntity {
507-
explicit Entity_template_ns_TemplateClass6double9(EntityScope parent_h) {}
507+
explicit Entity_template_ns_TemplateClass6double9(EntityScope) {}
508508
static const char *Key() { return "template_ns_TemplateClass6double9"; }
509509
};
510510

@@ -551,7 +551,7 @@ using Entity_TopFunction = Bind_TopFunction<>;
551551
#else
552552

553553
struct Entity_TopFunction : public pybind11_weaver::DisabledEntity {
554-
explicit Entity_TopFunction(EntityScope parent_h) {}
554+
explicit Entity_TopFunction(EntityScope) {}
555555
static const char *Key() { return "TopFunction"; }
556556
};
557557

@@ -594,7 +594,7 @@ using Entity_TopFunction1 = Bind_TopFunction1<>;
594594
#else
595595

596596
struct Entity_TopFunction1 : public pybind11_weaver::DisabledEntity {
597-
explicit Entity_TopFunction1(EntityScope parent_h) {}
597+
explicit Entity_TopFunction1(EntityScope) {}
598598
static const char *Key() { return "TopFunction1"; }
599599
};
600600

@@ -637,7 +637,7 @@ using Entity_TopFunctionDef = Bind_TopFunctionDef<>;
637637
#else
638638

639639
struct Entity_TopFunctionDef : public pybind11_weaver::DisabledEntity {
640-
explicit Entity_TopFunctionDef(EntityScope parent_h) {}
640+
explicit Entity_TopFunctionDef(EntityScope) {}
641641
static const char *Key() { return "TopFunctionDef"; }
642642
};
643643

@@ -763,7 +763,7 @@ using Entity_VirtualBase6int9 = Bind_VirtualBase6int9<>;
763763
#else
764764

765765
struct Entity_VirtualBase6int9 : public pybind11_weaver::DisabledEntity {
766-
explicit Entity_VirtualBase6int9(EntityScope parent_h) {}
766+
explicit Entity_VirtualBase6int9(EntityScope) {}
767767
static const char *Key() { return "VirtualBase6int9"; }
768768
};
769769

@@ -796,7 +796,7 @@ using Entity_disabled_member = Bind_disabled_member<>;
796796
#else
797797

798798
struct Entity_disabled_member : public pybind11_weaver::DisabledEntity {
799-
explicit Entity_disabled_member(EntityScope parent_h) {}
799+
explicit Entity_disabled_member(EntityScope) {}
800800
static const char *Key() { return "disabled_member"; }
801801
};
802802

@@ -833,7 +833,7 @@ using Entity_disabled_member_disabled_Foo = Bind_disabled_member_disabled_Foo<>;
833833

834834
struct Entity_disabled_member_disabled_Foo
835835
: public pybind11_weaver::DisabledEntity {
836-
explicit Entity_disabled_member_disabled_Foo(EntityScope parent_h) {}
836+
explicit Entity_disabled_member_disabled_Foo(EntityScope) {}
837837
static const char *Key() { return "disabled_member_disabled_Foo"; }
838838
};
839839

@@ -866,7 +866,7 @@ using Entity_disabled_space = Bind_disabled_space<>;
866866
#else
867867

868868
struct Entity_disabled_space : public pybind11_weaver::DisabledEntity {
869-
explicit Entity_disabled_space(EntityScope parent_h) {}
869+
explicit Entity_disabled_space(EntityScope) {}
870870
static const char *Key() { return "disabled_space"; }
871871
};
872872

@@ -901,7 +901,7 @@ using Entity_disabled_space_Foo = Bind_disabled_space_Foo<>;
901901
#else
902902

903903
struct Entity_disabled_space_Foo : public pybind11_weaver::DisabledEntity {
904-
explicit Entity_disabled_space_Foo(EntityScope parent_h) {}
904+
explicit Entity_disabled_space_Foo(EntityScope) {}
905905
static const char *Key() { return "disabled_space_Foo"; }
906906
};
907907

@@ -934,7 +934,7 @@ using Entity_earth = Bind_earth<>;
934934
#else
935935

936936
struct Entity_earth : public pybind11_weaver::DisabledEntity {
937-
explicit Entity_earth(EntityScope parent_h) {}
937+
explicit Entity_earth(EntityScope) {}
938938
static const char *Key() { return "earth"; }
939939
};
940940

@@ -967,7 +967,7 @@ using Entity_earth_creatures = Bind_earth_creatures<>;
967967
#else
968968

969969
struct Entity_earth_creatures : public pybind11_weaver::DisabledEntity {
970-
explicit Entity_earth_creatures(EntityScope parent_h) {}
970+
explicit Entity_earth_creatures(EntityScope) {}
971971
static const char *Key() { return "earth_creatures"; }
972972
};
973973

@@ -1006,7 +1006,7 @@ using Entity_earth_creatures_Animal = Bind_earth_creatures_Animal<>;
10061006
#else
10071007

10081008
struct Entity_earth_creatures_Animal : public pybind11_weaver::DisabledEntity {
1009-
explicit Entity_earth_creatures_Animal(EntityScope parent_h) {}
1009+
explicit Entity_earth_creatures_Animal(EntityScope) {}
10101010
static const char *Key() { return "earth_creatures_Animal"; }
10111011
};
10121012

@@ -1057,7 +1057,7 @@ using Entity_earth_creatures_Home = Bind_earth_creatures_Home<>;
10571057
#else
10581058

10591059
struct Entity_earth_creatures_Home : public pybind11_weaver::DisabledEntity {
1060-
explicit Entity_earth_creatures_Home(EntityScope parent_h) {}
1060+
explicit Entity_earth_creatures_Home(EntityScope) {}
10611061
static const char *Key() { return "earth_creatures_Home"; }
10621062
};
10631063

@@ -1094,7 +1094,7 @@ using Entity_earth_creatures_Home_Food = Bind_earth_creatures_Home_Food<>;
10941094

10951095
struct Entity_earth_creatures_Home_Food
10961096
: public pybind11_weaver::DisabledEntity {
1097-
explicit Entity_earth_creatures_Home_Food(EntityScope parent_h) {}
1097+
explicit Entity_earth_creatures_Home_Food(EntityScope) {}
10981098
static const char *Key() { return "earth_creatures_Home_Food"; }
10991099
};
11001100

@@ -1138,7 +1138,7 @@ using Entity_NSFunction = Bind_NSFunction<>;
11381138
#else
11391139

11401140
struct Entity_NSFunction : public pybind11_weaver::DisabledEntity {
1141-
explicit Entity_NSFunction(EntityScope parent_h) {}
1141+
explicit Entity_NSFunction(EntityScope) {}
11421142
static const char *Key() { return "NSFunction"; }
11431143
};
11441144

@@ -1181,7 +1181,7 @@ using Entity_NSFunctionDef = Bind_NSFunctionDef<>;
11811181
#else
11821182

11831183
struct Entity_NSFunctionDef : public pybind11_weaver::DisabledEntity {
1184-
explicit Entity_NSFunctionDef(EntityScope parent_h) {}
1184+
explicit Entity_NSFunctionDef(EntityScope) {}
11851185
static const char *Key() { return "NSFunctionDef"; }
11861186
};
11871187

@@ -1427,7 +1427,7 @@ using Entity_earth_creatures_SweetHome = Bind_earth_creatures_SweetHome<>;
14271427

14281428
struct Entity_earth_creatures_SweetHome
14291429
: public pybind11_weaver::DisabledEntity {
1430-
explicit Entity_earth_creatures_SweetHome(EntityScope parent_h) {}
1430+
explicit Entity_earth_creatures_SweetHome(EntityScope) {}
14311431
static const char *Key() { return "earth_creatures_SweetHome"; }
14321432
};
14331433

@@ -1465,7 +1465,7 @@ using Entity_earth_creatures_ValueSet = Bind_earth_creatures_ValueSet<>;
14651465

14661466
struct Entity_earth_creatures_ValueSet
14671467
: public pybind11_weaver::DisabledEntity {
1468-
explicit Entity_earth_creatures_ValueSet(EntityScope parent_h) {}
1468+
explicit Entity_earth_creatures_ValueSet(EntityScope) {}
14691469
static const char *Key() { return "earth_creatures_ValueSet"; }
14701470
};
14711471

@@ -1498,7 +1498,7 @@ using Entity_template_ns = Bind_template_ns<>;
14981498
#else
14991499

15001500
struct Entity_template_ns : public pybind11_weaver::DisabledEntity {
1501-
explicit Entity_template_ns(EntityScope parent_h) {}
1501+
explicit Entity_template_ns(EntityScope) {}
15021502
static const char *Key() { return "template_ns"; }
15031503
};
15041504

@@ -1550,7 +1550,7 @@ using Entity_template_ns_DerivedClass = Bind_template_ns_DerivedClass<>;
15501550

15511551
struct Entity_template_ns_DerivedClass
15521552
: public pybind11_weaver::DisabledEntity {
1553-
explicit Entity_template_ns_DerivedClass(EntityScope parent_h) {}
1553+
explicit Entity_template_ns_DerivedClass(EntityScope) {}
15541554
static const char *Key() { return "template_ns_DerivedClass"; }
15551555
};
15561556

@@ -1605,7 +1605,7 @@ using Entity_template_ns_TemplateClass6float9 =
16051605

16061606
struct Entity_template_ns_TemplateClass6float9
16071607
: public pybind11_weaver::DisabledEntity {
1608-
explicit Entity_template_ns_TemplateClass6float9(EntityScope parent_h) {}
1608+
explicit Entity_template_ns_TemplateClass6float9(EntityScope) {}
16091609
static const char *Key() { return "template_ns_TemplateClass6float9"; }
16101610
};
16111611

@@ -1658,7 +1658,7 @@ using Entity_template_ns_TemplateClass6int9 =
16581658

16591659
struct Entity_template_ns_TemplateClass6int9
16601660
: public pybind11_weaver::DisabledEntity {
1661-
explicit Entity_template_ns_TemplateClass6int9(EntityScope parent_h) {}
1661+
explicit Entity_template_ns_TemplateClass6int9(EntityScope) {}
16621662
static const char *Key() { return "template_ns_TemplateClass6int9"; }
16631663
};
16641664

@@ -1768,7 +1768,7 @@ using Entity_DriveVirtual = Bind_DriveVirtual<>;
17681768
#else
17691769

17701770
struct Entity_DriveVirtual : public pybind11_weaver::DisabledEntity {
1771-
explicit Entity_DriveVirtual(EntityScope parent_h) {}
1771+
explicit Entity_DriveVirtual(EntityScope) {}
17721772
static const char *Key() { return "DriveVirtual"; }
17731773
};
17741774

0 commit comments

Comments
 (0)