diff options
Diffstat (limited to 'libcpp/expr.cc')
-rw-r--r-- | libcpp/expr.cc | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/libcpp/expr.cc b/libcpp/expr.cc index 6e5bf68e..b68bf0f 100644 --- a/libcpp/expr.cc +++ b/libcpp/expr.cc @@ -327,9 +327,9 @@ static unsigned int interpret_int_suffix (cpp_reader *pfile, const uchar *s, size_t len) { size_t orig_len = len; - size_t u, l, i, z; + size_t u, l, i, z, wb; - u = l = i = z = 0; + u = l = i = z = wb = 0; while (len--) switch (s[len]) @@ -343,11 +343,23 @@ interpret_int_suffix (cpp_reader *pfile, const uchar *s, size_t len) if (l == 2 && s[len] != s[len + 1]) return 0; break; + case 'b': + if (len == 0 || s[len - 1] != 'w') + return 0; + wb++; + len--; + break; + case 'B': + if (len == 0 || s[len - 1] != 'W') + return 0; + wb++; + len--; + break; default: return 0; } - if (l > 2 || u > 1 || i > 1 || z > 1) + if (l > 2 || u > 1 || i > 1 || z > 1 || wb > 1) return 0; if (z) @@ -358,6 +370,14 @@ interpret_int_suffix (cpp_reader *pfile, const uchar *s, size_t len) return 0; } + if (wb) + { + if (CPP_OPTION (pfile, cplusplus)) + return 0; + if (l > 0 || i > 0 || z > 0) + return 0; + } + if (i) { if (!CPP_OPTION (pfile, ext_numeric_literals)) @@ -376,7 +396,8 @@ interpret_int_suffix (cpp_reader *pfile, const uchar *s, size_t len) | (u ? CPP_N_UNSIGNED : 0) | ((l == 0) ? CPP_N_SMALL : (l == 1) ? CPP_N_MEDIUM : CPP_N_LARGE) - | (z ? CPP_N_SIZE_T : 0)); + | (z ? CPP_N_SIZE_T : 0) + | (wb ? CPP_N_BITINT : 0)); } /* Return the classification flags for an int suffix. */ |