1From 0217fc2816e47ee296472df71d1011f0eb2937e6 Mon Sep 17 00:00:00 2001
2From: Vincent Fazio <vfazio@gmail.com>
3Date: Fri, 27 Jan 2023 14:37:26 -0600
4Subject: [PATCH] parse.y: fix compilation for non-multibyte builds
5
6Builds configured with --disable-multibyte or when the toolchain does
7not have WCHAR support would encounter a compile error due to an
8undeclared reference to shell_input_line_property in shell_getc.
9
10Add a HANDLE_MULTIBYTE guard to conditionally compile the block that
11references shell_input_line_property in shell_getc as it's only declared
12when HANDLE_MULTIBYTE is defined.
13
14Signed-off-by: Vincent Fazio <vfazio@gmail.com>
15[Upstream status: https://savannah.gnu.org/patch/index.php?10309]
16---
17 parse.y | 2 ++
18 y.tab.c | 2 ++
19 2 files changed, 4 insertions(+)
20
21diff --git a/parse.y b/parse.y
22index 1d12e639..8f1355c6 100644
23--- a/parse.y
24+++ b/parse.y
25@@ -2625,6 +2625,7 @@ next_alias_char:
26       parser_state |= PST_ENDALIAS;
27       /* We need to do this to make sure last_shell_getc_is_singlebyte returns
28 	 true, since we are returning a single-byte space. */
29+#if defined (HANDLE_MULTIBYTE)
30       if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
31 	{
32 #if 0
33@@ -2638,6 +2639,7 @@ next_alias_char:
34 	  shell_input_line_property[shell_input_line_index - 1] = 1;
35 #endif
36 	}
37+#endif /* HANDLE_MULTIBYTE */
38       return ' ';	/* END_ALIAS */
39     }
40 #endif
41diff --git a/y.tab.c b/y.tab.c
42index 50c5845b..799f730f 100644
43--- a/y.tab.c
44+++ b/y.tab.c
45@@ -4936,6 +4936,7 @@ next_alias_char:
46       parser_state |= PST_ENDALIAS;
47       /* We need to do this to make sure last_shell_getc_is_singlebyte returns
48 	 true, since we are returning a single-byte space. */
49+#if defined (HANDLE_MULTIBYTE)
50       if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
51 	{
52 #if 0
53@@ -4949,6 +4950,7 @@ next_alias_char:
54 	  shell_input_line_property[shell_input_line_index - 1] = 1;
55 #endif
56 	}
57+#endif /* HANDLE_MULTIBYTE */
58       return ' ';	/* END_ALIAS */
59     }
60 #endif
61--
622.25.1
63
64