0013-sqlite3-fix-build-when-threads-are-not-used-availabl.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 0f0be88526ece7d2f6ee21c1f59b1546ec6dc7c0 Mon Sep 17 00:00:00 2001
  2. From: "Yann E. MORIN" <yann.morin.1998@free.fr>
  3. Date: Tue, 7 Mar 2017 22:25:14 +0100
  4. Subject: [PATCH] sqlite3: fix build when threads are not used/available
  5. When threads are not used/available, a function in the sqlite3 extension
  6. ends up with a label at the end:
  7. void _pysqlite_final_callback(sqlite3_context* context)
  8. {
  9. PyObject* function_result;
  10. PyObject** aggregate_instance;
  11. int ok;
  12. #ifdef WITH_THREAD
  13. PyGILState_STATE threadstate;
  14. threadstate = PyGILState_Ensure();
  15. #endif
  16. aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
  17. if (!*aggregate_instance) {
  18. goto error;
  19. }
  20. [......]
  21. error:
  22. #ifdef WITH_THREAD
  23. PyGILState_Release(threadstate);
  24. #endif
  25. }
  26. This is not valid, and gcc complains.
  27. Fix that by adding a dummy statement after the label, so that the label
  28. is never the last statement of the function.
  29. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  30. ---
  31. Modules/_sqlite/connection.c | 1 +
  32. 1 file changed, 1 insertion(+)
  33. diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
  34. index 237d6e4..cdf69ab 100644
  35. --- a/Modules/_sqlite/connection.c
  36. +++ b/Modules/_sqlite/connection.c
  37. @@ -794,6 +794,7 @@ error:
  38. #ifdef WITH_THREAD
  39. PyGILState_Release(threadstate);
  40. #endif
  41. + ; /* Make gcc happy: a label can't be at the end of a function */
  42. }
  43. static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self)
  44. --
  45. 2.7.4