summaryrefslogtreecommitdiffstats
path: root/package/python/python-015-fix-sqlite-without-threads.patch
blob: 805edff6d3d0b052d9327891168390ca2b6ac968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
sqlite3: fix build when threads are not used/available

When threads are not used/available, a function in the sqlite3 extension
ends up with a label at the end:

    void _pysqlite_final_callback(sqlite3_context* context)
    {
        PyObject* function_result;
        PyObject** aggregate_instance;
        int ok;

    #ifdef WITH_THREAD
        PyGILState_STATE threadstate;

        threadstate = PyGILState_Ensure();
    #endif

        aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
        if (!*aggregate_instance) {
            goto error;
        }

        [......]

    error:
    #ifdef WITH_THREAD
        PyGILState_Release(threadstate);
    #endif
    }

This is not valid, and gcc complains.

Fix that by adding a dummy statement after the label, so that the label
is never the last statement of the function.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

diff -durN python-2.7.8.orig/Modules/_sqlite/connection.c python-2.7.8/Modules/_sqlite/connection.c
--- python-2.7.8.orig/Modules/_sqlite/connection.c	2014-06-30 04:05:42.000000000 +0200
+++ python-2.7.8/Modules/_sqlite/connection.c	2014-07-12 13:53:32.258041224 +0200
@@ -786,6 +786,7 @@
 #ifdef WITH_THREAD
     PyGILState_Release(threadstate);
 #endif
+    ;   /* Make gcc happy: a label can't be at the end of a function */
 }
 
 static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self)