015-fix-sqlite-without-threads.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. sqlite3: fix build when threads are not used/available
  2. When threads are not used/available, a function in the sqlite3 extension
  3. ends up with a label at the end:
  4. void _pysqlite_final_callback(sqlite3_context* context)
  5. {
  6. PyObject* function_result;
  7. PyObject** aggregate_instance;
  8. int ok;
  9. #ifdef WITH_THREAD
  10. PyGILState_STATE threadstate;
  11. threadstate = PyGILState_Ensure();
  12. #endif
  13. aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
  14. if (!*aggregate_instance) {
  15. goto error;
  16. }
  17. [......]
  18. error:
  19. #ifdef WITH_THREAD
  20. PyGILState_Release(threadstate);
  21. #endif
  22. }
  23. This is not valid, and gcc complains.
  24. Fix that by adding a dummy statement after the label, so that the label
  25. is never the last statement of the function.
  26. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  27. Index: b/Modules/_sqlite/connection.c
  28. ===================================================================
  29. --- a/Modules/_sqlite/connection.c
  30. +++ b/Modules/_sqlite/connection.c
  31. @@ -786,6 +786,7 @@
  32. #ifdef WITH_THREAD
  33. PyGILState_Release(threadstate);
  34. #endif
  35. + ; /* Make gcc happy: a label can't be at the end of a function */
  36. }
  37. static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self)