You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
3.4 KiB

  1. From d7f13fdc516ffa36b16b89e7f398a8a36b4188d9 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Christoph=20M=C3=BCllner?= <christophm30@gmail.com>
  3. Date: Sat, 2 Dec 2017 00:08:55 +0100
  4. Subject: [PATCH 1/6] Eliminate protobuf AddDescriptors() call.
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Eliminating protobuf's AddDescriptors() calls enabled
  9. forward-compatibility with libprotobuf. That allows to
  10. run OLA on recent Linux distrubutions.
  11. Tested on x86_64 running Fedora 27 with protobuf 3.3.1
  12. in combination with QLC+ and a uDMX controller.
  13. See #1192.
  14. Signed-off-by: Christoph Müllner <christophm30@gmail.com>
  15. ---
  16. config/ola.m4 | 3 ---
  17. protoc/CppFileGenerator.cpp | 8 --------
  18. protoc/GeneratorHelpers.cpp | 5 -----
  19. protoc/GeneratorHelpers.h | 3 ---
  20. 4 files changed, 19 deletions(-)
  21. diff --git a/config/ola.m4 b/config/ola.m4
  22. index 6080932e9..d3b8cc8f8 100644
  23. --- a/config/ola.m4
  24. +++ b/config/ola.m4
  25. @@ -24,9 +24,6 @@ AC_DEFUN([PROTOBUF_SUPPORT],
  26. AC_REQUIRE_CPP()
  27. PKG_CHECK_MODULES(libprotobuf, [protobuf >= $1])
  28. -PKG_CHECK_MODULES(libprotobuf2, [protobuf < 3.2], [],
  29. - [AC_MSG_ERROR([OLA currently requires protobuf < 3.2, see issue 1192])])
  30. -
  31. AC_SUBST([libprotobuf_CFLAGS])
  32. AC_ARG_WITH([protoc],
  33. diff --git a/protoc/CppFileGenerator.cpp b/protoc/CppFileGenerator.cpp
  34. index 518c17879..e7dd95ccb 100644
  35. --- a/protoc/CppFileGenerator.cpp
  36. +++ b/protoc/CppFileGenerator.cpp
  37. @@ -196,14 +196,6 @@ void FileGenerator::GenerateBuildDescriptors(Printer* printer) {
  38. "assigndescriptorsname", GlobalAssignDescriptorsName(m_output_name));
  39. printer->Indent();
  40. - // Make sure the file has found its way into the pool. If a descriptor
  41. - // is requested *during* static init then AddDescriptors() may not have
  42. - // been called yet, so we call it manually. Note that it's fine if
  43. - // AddDescriptors() is called multiple times.
  44. - printer->Print(
  45. - "$adddescriptorsname$();\n",
  46. - "adddescriptorsname", GlobalAddDescriptorsName(m_file->name()));
  47. -
  48. // Get the file's descriptor from the pool.
  49. printer->Print(
  50. "const ::google::protobuf::FileDescriptor* file =\n"
  51. diff --git a/protoc/GeneratorHelpers.cpp b/protoc/GeneratorHelpers.cpp
  52. index 19609181e..6f619b5c0 100644
  53. --- a/protoc/GeneratorHelpers.cpp
  54. +++ b/protoc/GeneratorHelpers.cpp
  55. @@ -104,11 +104,6 @@ string FilenameIdentifier(const string& filename) {
  56. return result;
  57. }
  58. -// Return the name of the AddDescriptors() function for a given file.
  59. -string GlobalAddDescriptorsName(const string& filename) {
  60. - return "protobuf_AddDesc_" + FilenameIdentifier(filename);
  61. -}
  62. -
  63. // Return the name of the AssignDescriptors() function for a given file.
  64. string GlobalAssignDescriptorsName(const string& filename) {
  65. return "protobuf_AssignDesc_" + FilenameIdentifier(filename);
  66. diff --git a/protoc/GeneratorHelpers.h b/protoc/GeneratorHelpers.h
  67. index 35efdbb04..fa91a915d 100644
  68. --- a/protoc/GeneratorHelpers.h
  69. +++ b/protoc/GeneratorHelpers.h
  70. @@ -67,9 +67,6 @@ string StripProto(const string& filename);
  71. // Convert a file name into a valid identifier.
  72. string FilenameIdentifier(const string& filename);
  73. -// Return the name of the AddDescriptors() function for a given file.
  74. -string GlobalAddDescriptorsName(const string& filename);
  75. -
  76. // Return the name of the AssignDescriptors() function for a given file.
  77. string GlobalAssignDescriptorsName(const string& filename);
  78. --
  79. 2.11.0