0002-Fix-mismatched-usage-length-build-fail-on-g.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 5a0c9f6358169b447840acdb721250ce932cb180 Mon Sep 17 00:00:00 2001
  2. From: Martin Erik Werner <martinerikwerner@gmail.com>
  3. Date: Wed, 8 Mar 2017 22:51:16 +0100
  4. Subject: [PATCH] Fix mismatched usage length, build fail on g++
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The length of const option::Descriptor usage[] is intended to be
  9. inferred based on the initialisation in Source/main.cpp, however, the
  10. extern declaration in Source/Game.hpp hard-codes it to 13.
  11. Remove the hard-coded 13 in the extern declaration, in favour of the
  12. inferred length.
  13. This also fixes the follwoing build failure with g++ (Debian 4.9.2-10)
  14. 4.9.2:
  15. (...)/Source/main.cpp:602:5: error: uninitialized const member ‘option::Descriptor::index’
  16. };
  17. ^
  18. (...)/Source/main.cpp:602:5: warning: missing initializer for member ‘option::Descriptor::index’ [-Wmissing-field-initializers]
  19. (...)/Source/main.cpp:602:5: error: uninitialized const member ‘option::Descriptor::type’
  20. (...)/Source/main.cpp:602:5: warning: missing initializer for member ‘option::Descriptor::type’ [-Wmissing-field-initializers]
  21. (...)/Source/main.cpp:602:5: error: uninitialized const member ‘option::Descriptor::shortopt’
  22. (...)/Source/main.cpp:602:5: warning: missing initializer for member ‘option::Descriptor::shortopt’ [-Wmissing-field-initializers]
  23. (...)/Source/main.cpp:602:5: error: uninitialized const member ‘option::Descriptor::longopt’
  24. (...)/Source/main.cpp:602:5: warning: missing initializer for member ‘option::Descriptor::longopt’ [-Wmissing-field-initializers]
  25. (...)/Source/main.cpp:602:5: error: uninitialized const member ‘option::Descriptor::check_arg’
  26. (...)/Source/main.cpp:602:5: warning: missing initializer for member ‘option::Descriptor::check_arg’ [-Wmissing-field-initializers]
  27. (...)/Source/main.cpp:602:5: warning: missing initializer for member ‘option::Descriptor::help’ [-Wmissing-field-initializers]
  28. CMakeFiles/lugaru.dir/build.make:54: recipe for target 'CMakeFiles/lugaru.dir/Source/main.cpp.o' failed
  29. Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
  30. [Romain: backport to v1.2]
  31. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  32. (cherry picked from commit dd685fe9080c2853422d8272792691358ea07dfc)
  33. ---
  34. Source/Game.hpp | 2 +-
  35. 1 file changed, 1 insertion(+), 1 deletion(-)
  36. diff --git a/Source/Game.hpp b/Source/Game.hpp
  37. index 51232cc..9bb6adb 100644
  38. --- a/Source/Game.hpp
  39. +++ b/Source/Game.hpp
  40. @@ -234,7 +234,7 @@ enum optionIndex
  41. /* Number of options + 1 */
  42. const int commandLineOptionsNumber = 10;
  43. -extern const option::Descriptor usage[13];
  44. +extern const option::Descriptor usage[];
  45. extern option::Option commandLineOptions[commandLineOptionsNumber];
  46. extern option::Option* commandLineOptionsBuffer;
  47. --
  48. 2.9.4