From 0217fc2816e47ee296472df71d1011f0eb2937e6 Mon Sep 17 00:00:00 2001
From: Vincent Fazio <vfazio@gmail.com>
Date: Fri, 27 Jan 2023 14:37:26 -0600
Subject: [PATCH] parse.y: fix compilation for non-multibyte builds

Builds configured with --disable-multibyte or when the toolchain does
not have WCHAR support would encounter a compile error due to an
undeclared reference to shell_input_line_property in shell_getc.

Add a HANDLE_MULTIBYTE guard to conditionally compile the block that
references shell_input_line_property in shell_getc as it's only declared
when HANDLE_MULTIBYTE is defined.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[Upstream status: https://savannah.gnu.org/patch/index.php?10309]
---
 parse.y | 2 ++
 y.tab.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/parse.y b/parse.y
index 1d12e639..8f1355c6 100644
--- a/parse.y
+++ b/parse.y
@@ -2640,6 +2640,7 @@ next_alias_char:
       parser_state |= PST_ENDALIAS;
       /* We need to do this to make sure last_shell_getc_is_singlebyte returns
 	 true, since we are returning a single-byte space. */
+#if defined (HANDLE_MULTIBYTE)
       if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
 	{
 #if 0
@@ -2653,6 +2654,7 @@ next_alias_char:
 	  shell_input_line_property[shell_input_line_index - 1] = 1;
 #endif
 	}
+#endif /* HANDLE_MULTIBYTE */
       return ' ';	/* END_ALIAS */
     }
 #endif
diff --git a/y.tab.c b/y.tab.c
index 50c5845b..799f730f 100644
--- a/y.tab.c
+++ b/y.tab.c
@@ -4955,6 +4955,7 @@ next_alias_char:
       parser_state |= PST_ENDALIAS;
       /* We need to do this to make sure last_shell_getc_is_singlebyte returns
 	 true, since we are returning a single-byte space. */
+#if defined (HANDLE_MULTIBYTE)
       if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
 	{
 #if 0
@@ -4968,6 +4969,7 @@ next_alias_char:
 	  shell_input_line_property[shell_input_line_index - 1] = 1;
 #endif
 	}
+#endif /* HANDLE_MULTIBYTE */
       return ' ';	/* END_ALIAS */
     }
 #endif
-- 
2.25.1

