summaryrefslogtreecommitdiffstats
path: root/contrib/gcclibs/libcpp/expr.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2013-12-02 03:47:08 +0000
committerpfg <pfg@FreeBSD.org>2013-12-02 03:47:08 +0000
commitc21473fbdae21f01f569b7f2e9f6f11a68c2cf44 (patch)
tree2e7af369f15283c3155c0cad8aedf0a0986d6e1c /contrib/gcclibs/libcpp/expr.c
parent99b1bb9d11e38921b6a1b89e4b5a3b5c9a5dadd7 (diff)
downloadFreeBSD-src-c21473fbdae21f01f569b7f2e9f6f11a68c2cf44.zip
FreeBSD-src-c21473fbdae21f01f569b7f2e9f6f11a68c2cf44.tar.gz
libcpp: Merge fixes from upstream
GCC preprocessor/29966: * macro.c (lex_expansion_token): Save and restore cpp_reader's cur_token. (_cpp_create_definition): Don't restore cur_token here. * lex.c (_cpp_lex_token): Added assertion. GCC preprocessor/28709: * macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs. GCC c/31924 * expr.c (interpret_float_suffix): Check for invalid suffix. GCC preprocessor/14331 * lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF. Fixup whitespacing Obtained from: gcc per-4.3 (rev. 121340, 124356, 124358, 124730, 125212, 125255 ; GPLv2) MFC after: 3 weeks
Diffstat (limited to 'contrib/gcclibs/libcpp/expr.c')
-rw-r--r--contrib/gcclibs/libcpp/expr.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/contrib/gcclibs/libcpp/expr.c b/contrib/gcclibs/libcpp/expr.c
index 24fcb1b8..ac7252f 100644
--- a/contrib/gcclibs/libcpp/expr.c
+++ b/contrib/gcclibs/libcpp/expr.c
@@ -87,16 +87,19 @@ interpret_float_suffix (const uchar *s, size_t len)
while (len--)
switch (s[len])
{
- case 'f': case 'F': f++; break;
- case 'l': case 'L': l++; break;
- case 'i': case 'I':
- case 'j': case 'J': i++; break;
- case 'd': case 'D':
- /* Disallow fd, ld suffixes. */
- if (d && (f || l))
+ case 'f': case 'F':
+ if (d > 0)
+ return 0;
+ f++;
+ break;
+ case 'l': case 'L':
+ if (d > 0)
return 0;
- d++;
+ l++;
break;
+ case 'i': case 'I':
+ case 'j': case 'J': i++; break;
+ case 'd': case 'D': d++; break;
default:
return 0;
}
@@ -494,7 +497,7 @@ append_digit (cpp_num num, int digit, int base, size_t precision)
if (add_low + digit < add_low)
add_high++;
add_low += digit;
-
+
if (result.low + add_low < result.low)
add_high++;
if (result.high + add_high < result.high)
@@ -1580,7 +1583,8 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
{
if (negate)
result = num_negate (result, precision);
- result.overflow = num_positive (result, precision) ^ !negate;
+ result.overflow = (num_positive (result, precision) ^ !negate
+ && !num_zerop (result));
}
return result;
OpenPOWER on IntegriCloud