Skip to content

Commit 7adc6ea

Browse files
Fix C23 label-at-end-of-compound-statement warnings
On non-free-threaded builds, Py_END_CRITICAL_SECTION() expands to just '}'. When preceded by a goto label like 'cs_done:', this creates a C23 extension that clang -Werror rejects. Adding an empty statement (;) after the label makes it valid C11.
1 parent 03a6076 commit 7adc6ea

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

multidict/_multidict.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ multidict_tp_init(MultiDictObject *self, PyObject *args, PyObject *kwds)
618618
goto cs_done;
619619
}
620620
ret = 0;
621-
cs_done:
621+
cs_done:;
622622
Py_END_CRITICAL_SECTION();
623623
done:
624624
Py_CLEAR(arg);
@@ -668,7 +668,7 @@ multidict_extend(MultiDictObject *self, PyObject *args, PyObject *kwds)
668668
failed = 1;
669669
goto cs_done;
670670
}
671-
cs_done:
671+
cs_done:;
672672
Py_END_CRITICAL_SECTION();
673673
Py_CLEAR(arg);
674674
if (failed) {
@@ -883,7 +883,7 @@ multidict_update(MultiDictObject *self, PyObject *args, PyObject *kwds)
883883
failed = 1;
884884
goto cs_done;
885885
}
886-
cs_done:
886+
cs_done:;
887887
Py_END_CRITICAL_SECTION();
888888
Py_CLEAR(arg);
889889
if (failed) {
@@ -915,7 +915,7 @@ multidict_merge(MultiDictObject *self, PyObject *args, PyObject *kwds)
915915
failed = 1;
916916
goto cs_done;
917917
}
918-
cs_done:
918+
cs_done:;
919919
Py_END_CRITICAL_SECTION();
920920
Py_CLEAR(arg);
921921
if (failed) {
@@ -1139,7 +1139,7 @@ cimultidict_tp_init(MultiDictObject *self, PyObject *args, PyObject *kwds)
11391139
goto cs_done;
11401140
}
11411141
ret = 0;
1142-
cs_done:
1142+
cs_done:;
11431143
Py_END_CRITICAL_SECTION();
11441144
done:
11451145
Py_CLEAR(arg);

multidict/_multilib/views.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ multidict_itemsview_and1(_Multidict_ViewObject *self, PyObject *other)
331331
if (PyErr_Occurred()) {
332332
failed = 1;
333333
}
334-
cs_done:
334+
cs_done:;
335335
if (failed) {
336336
md_finder_cleanup(&finder);
337337
Py_CLEAR(key2);
@@ -423,7 +423,7 @@ multidict_itemsview_and2(_Multidict_ViewObject *self, PyObject *other)
423423
if (PyErr_Occurred()) {
424424
failed = 1;
425425
}
426-
cs_done:
426+
cs_done:;
427427
if (failed) {
428428
md_finder_cleanup(&finder);
429429
Py_CLEAR(value2);
@@ -545,7 +545,7 @@ multidict_itemsview_or1(_Multidict_ViewObject *self, PyObject *other)
545545
if (PyErr_Occurred()) {
546546
failed = 1;
547547
}
548-
cs_done:
548+
cs_done:;
549549
if (failed) {
550550
md_finder_cleanup(&finder);
551551
Py_CLEAR(value2);
@@ -847,7 +847,7 @@ multidict_itemsview_sub2(_Multidict_ViewObject *self, PyObject *other)
847847
if (PyErr_Occurred()) {
848848
failed = 1;
849849
}
850-
cs_done:
850+
cs_done:;
851851
if (failed) {
852852
md_finder_cleanup(&finder);
853853
Py_CLEAR(value2);
@@ -1027,7 +1027,7 @@ multidict_itemsview_contains(_Multidict_ViewObject *self, PyObject *obj)
10271027
goto cs_done;
10281028
}
10291029

1030-
cs_done:
1030+
cs_done:;
10311031
md_finder_cleanup(&finder);
10321032
Py_END_CRITICAL_SECTION();
10331033
done:
@@ -1095,7 +1095,7 @@ multidict_itemsview_isdisjoint(_Multidict_ViewObject *self, PyObject *other)
10951095
if (PyErr_Occurred()) {
10961096
failed = 1;
10971097
}
1098-
cs_done:
1098+
cs_done:;
10991099
md_finder_cleanup(&finder);
11001100
Py_END_CRITICAL_SECTION();
11011101
Py_CLEAR(iter);

0 commit comments

Comments
 (0)