aboutsummaryrefslogtreecommitdiff
path: root/gdb/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/regex.c')
-rw-r--r--gdb/regex.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gdb/regex.c b/gdb/regex.c
index 9b6dc5b..3f30284 100644
--- a/gdb/regex.c
+++ b/gdb/regex.c
@@ -93,8 +93,16 @@ init_syntax_once ()
#define BYTEWIDTH 8
-#ifndef SIGN_EXTEND_CHAR
-#define SIGN_EXTEND_CHAR(x) (x)
+/* We remove any previous definition of `SIGN_EXTEND_CHAR',
+ since ours (we hope) works properly with all combinations of
+ machines, compilers, `char' and `unsigned char' argument types.
+ (Per Bothner suggested the basic approach.) */
+#undef SIGN_EXTEND_CHAR
+#if __STDC__
+#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
+#else /* not __STDC__ */
+/* As in Harbison and Steele. */
+#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
#endif
static int obscure_syntax = 0;