+2006-12-20 Borut Razem <borut.razem AT siol.net>
+
+ * support/cpp2/cpphash.h, support/cpp2/cpplex.c: fixed bug #982435
+ * support/regression/tests/bug-1351710.c: renamed from bug-1351710.c,
+ added regression test for bug #982435
+
2006-12-18 Borut Razem <borut.razem AT siol.net>
* src/SDCCutil.c: fixed a bug in (get_pragma_token)
|| (((prevc) == 'p' || (prevc) == 'P') \
&& CPP_OPTION (pfile, extended_numbers))))
+/* Test if a X or x is valid within a preprocessing number. */
+#define VALID_HEX(c, prevc) \
+ (((c) == 'X' || (c) == 'x') && (prevc) == '0')
+
#define CPP_OPTION(PFILE, OPTION) ((PFILE)->opts.OPTION)
#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
#define CPP_BUF_COLUMN(BUF, CUR) ((CUR) - (BUF)->line_base + (BUF)->col_adjust)
if (c == '?' || c == '\\')
c = skip_escaped_newlines (pfile);
- if (!is_idchar (c))
- {
- if (!number_p)
- break;
- if (c != '.' && !VALID_SIGN (c, prevc))
+ if (number_p)
+ {
+ if (!ISXDIGIT (c) && c != '.' && !VALID_SIGN (c, prevc) && !VALID_HEX (c, prevc))
break;
- }
- /* Handle normal identifier characters in this loop. */
- do
- {
- prevc = c;
- obstack_1grow (stack, c);
+ obstack_1grow (stack, c);
- if (c == '$')
- saw_dollar++;
+ base = cur = buffer->cur;
+ while (ISXDIGIT (*cur))
+ ++cur;
- c = *buffer->cur++;
- }
- while (is_idchar (c));
+ if (cur != base)
+ obstack_grow (stack, base, cur - base);
+
+ prevc = cur[-1];
+ c = *cur++;
+ buffer->cur = cur;
+ }
+ else
+ {
+ if (!is_idchar (c))
+ break;
+
+ /* Handle normal identifier characters in this loop. */
+ do
+ {
+ prevc = c;
+ obstack_1grow (stack, c);
+
+ if (c == '$')
+ saw_dollar++;
+
+ c = *buffer->cur++;
+ }
+ while (is_idchar (c));
+ }
}
/* Step back over the unwanted char. */
/* Fast-path loop. Skim over a normal number.
N.B. ISIDNUM does not include $. */
cur = pfile->buffer->cur;
- while (ISIDNUM (*cur) || *cur == '.' || VALID_SIGN (*cur, cur[-1]))
+
+ while (ISXDIGIT (*cur) || *cur == '.' || VALID_SIGN (*cur, cur[-1]) || VALID_HEX (*cur, cur[-1]))
cur++;
/* Check for slow-path cases. */
--- /dev/null
+/*
+ preproc.c
+*/
+
+#include <testfwk.h>
+
+/*
+ * test for bug 135170
+ */
+const char *
+const_str(void)
+{
+return "A"
+
+
+
+/* just for testing, actually nop */
+#pragma save
+
+
+
+
+
+"B";
+#pragma restore
+}
+
+/*
+ * test for bug 982435
+ */
+#if !defined (__GNUC__) && !defined (_MSC_VER)
+/* since this fails on GCC cpp and MSVC cl -E... */
+#define LO_B(x) ((x) & 0xff)
+
+unsigned char
+hexeminus(void)
+{
+unsigned char a=0x\
+fe\
+-\
+LO_B(3);
+return a;
+}
+#endif