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