Mercurial > hg > CbC > CbC_gcc
diff libcpp/expr.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/libcpp/expr.c Fri Oct 27 22:46:09 2017 +0900 +++ b/libcpp/expr.c Thu Oct 25 07:37:49 2018 +0900 @@ -1,5 +1,5 @@ /* Parse C expressions for cpplib. - Copyright (C) 1987-2017 Free Software Foundation, Inc. + Copyright (C) 1987-2018 Free Software Foundation, Inc. Contributed by Per Bothner, 1994. This program is free software; you can redistribute it and/or modify it @@ -90,6 +90,8 @@ static unsigned int interpret_float_suffix (cpp_reader *pfile, const uchar *s, size_t len) { + size_t orig_len = len; + const uchar *orig_s = s; size_t flags; size_t f, d, l, w, q, i, fn, fnx, fn_bits; @@ -269,8 +271,21 @@ if (fn && fn_bits == 96) return 0; - if (i && !CPP_OPTION (pfile, ext_numeric_literals)) - return 0; + if (i) + { + if (!CPP_OPTION (pfile, ext_numeric_literals)) + return 0; + + /* In C++14 and up these suffixes are in the standard library, so treat + them as user-defined literals. */ + if (CPP_OPTION (pfile, cplusplus) + && CPP_OPTION (pfile, lang) > CLK_CXX11 + && orig_s[0] == 'i' + && (orig_len == 1 + || (orig_len == 2 + && (orig_s[1] == 'f' || orig_s[1] == 'l')))) + return 0; + } if ((w || q) && !CPP_OPTION (pfile, ext_numeric_literals)) return 0; @@ -299,6 +314,7 @@ 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; u = l = i = 0; @@ -321,8 +337,19 @@ if (l > 2 || u > 1 || i > 1) return 0; - if (i && !CPP_OPTION (pfile, ext_numeric_literals)) - return 0; + if (i) + { + if (!CPP_OPTION (pfile, ext_numeric_literals)) + return 0; + + /* In C++14 and up these suffixes are in the standard library, so treat + them as user-defined literals. */ + if (CPP_OPTION (pfile, cplusplus) + && CPP_OPTION (pfile, lang) > CLK_CXX11 + && s[0] == 'i' + && (orig_len == 1 || (orig_len == 2 && s[1] == 'l'))) + return 0; + } return ((i ? CPP_N_IMAGINARY : 0) | (u ? CPP_N_UNSIGNED : 0) @@ -1038,23 +1065,7 @@ "this use of \"defined\" may not be portable"); _cpp_mark_macro_used (node); - if (!(node->flags & NODE_USED)) - { - node->flags |= NODE_USED; - if (node->type == NT_MACRO) - { - if ((node->flags & NODE_BUILTIN) - && pfile->cb.user_builtin_macro) - pfile->cb.user_builtin_macro (pfile, node); - if (pfile->cb.used_define) - pfile->cb.used_define (pfile, pfile->directive_line, node); - } - else - { - if (pfile->cb.used_undef) - pfile->cb.used_undef (pfile, pfile->directive_line, node); - } - } + _cpp_maybe_notify_macro_use (pfile, node); /* A possible controlling macro of the form #if !defined (). _cpp_parse_expr checks there was no other junk on the line. */ @@ -1070,8 +1081,8 @@ result.unsignedp = false; result.high = 0; result.overflow = false; - result.low = (node && node->type == NT_MACRO - && (node->flags & NODE_CONDITIONAL) == 0); + result.low = (node && cpp_macro_p (node) + && !(node->flags & NODE_CONDITIONAL)); return result; }