diff options
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 21 | ||||
-rw-r--r-- | libcpp/config.in | 3 | ||||
-rwxr-xr-x | libcpp/configure | 2 | ||||
-rw-r--r-- | libcpp/configure.ac | 4 | ||||
-rw-r--r-- | libcpp/expr.cc | 28 | ||||
-rw-r--r-- | libcpp/files.cc | 9 | ||||
-rw-r--r-- | libcpp/po/ChangeLog | 4 | ||||
-rw-r--r-- | libcpp/po/de.po | 18 |
8 files changed, 70 insertions, 19 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index ec5a730..e2ed956 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,24 @@ +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/119391 + * expr.cc (num_lshift): Add pfile argument. Don't set num.overflow + for !num.unsignedp in C++20 or later unless n >= precision. For + C++11 to C++17 set it if orig >> (precision - 1 - n) as logical + shift results in value > 1. + (num_binary_op): Pass pfile to num_lshift. + (num_div_op): Likewise. + +2025-03-28 Jeremy Bettis <jbettis@google.com> + + PR preprocessor/108900 + * files.cc (_cpp_stack_file): Do not decrement highest_location + across distinct maps. + +2025-03-27 Roland McGrath <mcgrathr@google.com> + + * configure.ac: Check for setlocale. + * configure, config.in: Regenerated. + 2025-03-12 Jakub Jelinek <jakub@redhat.com> PR preprocessor/119202 diff --git a/libcpp/config.in b/libcpp/config.in index b2e2f4e8..c81ee08 100644 --- a/libcpp/config.in +++ b/libcpp/config.in @@ -210,6 +210,9 @@ /* Define to 1 if you have the `putc_unlocked' function. */ #undef HAVE_PUTC_UNLOCKED +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + /* Define to 1 if you can assemble SSSE3 insns. */ #undef HAVE_SSSE3 diff --git a/libcpp/configure b/libcpp/configure index 1391081..e3c39f4 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -6034,7 +6034,7 @@ _ACEOF -for ac_func in clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked +for ac_func in clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked setlocale do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 981f97c4..845dd64 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -81,7 +81,7 @@ define(libcpp_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl putchar_unlocked putc_unlocked) -AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS) +AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS setlocale) AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, getopt, vasprintf]) AC_CHECK_DECLS(m4_split(m4_normalize(libcpp_UNLOCKED_FUNCS))) @@ -172,7 +172,7 @@ do esac done IFS="$ac_save_IFS" - + if test x$ac_checking != x ; then AC_DEFINE(CHECKING_P, 1, [Define to 1 if you want more run-time sanity checks.]) diff --git a/libcpp/expr.cc b/libcpp/expr.cc index 4573752..7bb57a3 100644 --- a/libcpp/expr.cc +++ b/libcpp/expr.cc @@ -53,7 +53,7 @@ static cpp_num num_equality_op (cpp_reader *, cpp_num, cpp_num, static cpp_num num_mul (cpp_reader *, cpp_num, cpp_num); static cpp_num num_div_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype, location_t); -static cpp_num num_lshift (cpp_num, size_t, size_t); +static cpp_num num_lshift (cpp_reader *, cpp_num, size_t, size_t); static cpp_num num_rshift (cpp_num, size_t, size_t); static cpp_num append_digit (cpp_num, int, int, size_t); @@ -2049,7 +2049,7 @@ num_rshift (cpp_num num, size_t precision, size_t n) /* Shift NUM, of width PRECISION, left by N bits. */ static cpp_num -num_lshift (cpp_num num, size_t precision, size_t n) +num_lshift (cpp_reader *pfile, cpp_num num, size_t precision, size_t n) { if (n >= precision) { @@ -2075,8 +2075,26 @@ num_lshift (cpp_num num, size_t precision, size_t n) } num = num_trim (num, precision); - if (num.unsignedp) + if (num.unsignedp + /* For C++20 or later since P1236R1, there is no overflow for signed + left shifts, it is as if the shift was in uintmax_t and cast + back to intmax_t afterwards. */ + || (CPP_OPTION (pfile, cplusplus) + && CPP_OPTION (pfile, lang) >= CLK_GNUCXX20)) num.overflow = false; + else if (CPP_OPTION (pfile, cplusplus) + && CPP_OPTION (pfile, lang) >= CLK_GNUCXX11 + && num_positive (orig, precision)) + { + /* For C++11 - C++17 since CWG1457, 1 << 63 is allowed because it is + representable in uintmax_t, but 3 << 63 is not. + Test whether num >> (precision - 1 - n) as logical + shift is > 1. */ + maybe_orig = orig; + maybe_orig.unsignedp = true; + maybe_orig = num_rshift (maybe_orig, precision, precision - 1 - n); + num.overflow = maybe_orig.high || maybe_orig.low > 1; + } else { maybe_orig = num_rshift (num, precision, n); @@ -2149,7 +2167,7 @@ num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op) else n = rhs.low; if (op == CPP_LSHIFT) - lhs = num_lshift (lhs, precision, n); + lhs = num_lshift (pfile, lhs, precision, n); else lhs = num_rshift (lhs, precision, n); break; @@ -2347,7 +2365,7 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op, rhs.unsignedp = true; lhs.unsignedp = true; i = precision - i - 1; - sub = num_lshift (rhs, precision, i); + sub = num_lshift (pfile, rhs, precision, i); result.high = result.low = 0; for (;;) diff --git a/libcpp/files.cc b/libcpp/files.cc index 1ed19c5..c1abde6 100644 --- a/libcpp/files.cc +++ b/libcpp/files.cc @@ -1046,6 +1046,15 @@ _cpp_stack_file (cpp_reader *pfile, _cpp_file *file, include_type type, && type < IT_DIRECTIVE_HWM && (pfile->line_table->highest_location != LINE_MAP_MAX_LOCATION - 1)); + + if (decrement && LINEMAPS_ORDINARY_USED (pfile->line_table)) + { + const line_map_ordinary *map + = LINEMAPS_LAST_ORDINARY_MAP (pfile->line_table); + if (map && map->start_location == pfile->line_table->highest_location) + decrement = false; + } + if (decrement) pfile->line_table->highest_location--; diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog index 54968db..aedfd2c 100644 --- a/libcpp/po/ChangeLog +++ b/libcpp/po/ChangeLog @@ -1,3 +1,7 @@ +2025-03-20 Joseph Myers <josmyers@redhat.com> + + * de.po: Update. + 2025-03-18 Joseph Myers <josmyers@redhat.com> * fr.po, sv.po: Update. diff --git a/libcpp/po/de.po b/libcpp/po/de.po index 9914e57..72a33de 100644 --- a/libcpp/po/de.po +++ b/libcpp/po/de.po @@ -9,10 +9,10 @@ # msgid "" msgstr "" -"Project-Id-Version: cpplib 15-b20250216\n" +"Project-Id-Version: cpplib 15.1-b20250316\n" "Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n" "POT-Creation-Date: 2025-03-14 22:05+0000\n" -"PO-Revision-Date: 2025-03-10 22:32+0100\n" +"PO-Revision-Date: 2025-03-20 07:49+0100\n" "Last-Translator: Roland Illig <roland.illig@gmx.de>\n" "Language-Team: German <translation-team-de@lists.sourceforge.net>\n" "Language: de\n" @@ -211,10 +211,8 @@ msgstr "%<\\x{%> ohne dazugehöriges %<}%> nach %.*s" msgid "hex escape sequence out of range" msgstr "Hex-Escape-Sequenz außerhalb des Wertebereiches" -# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119202 #: charset.cc:2247 -#, fuzzy, gcc-internal-format -#| msgid "%<\\o%> not followed by %<}%>" +#, gcc-internal-format msgid "%<\\o%> not followed by %<{%>" msgstr "%<\\o%> ohne folgendes %<{%>" @@ -467,16 +465,14 @@ msgid "%<#embed%> not supported in traditional C" msgstr "%<#embed%> wird in traditionellem C nicht unterstützt" #: directives.cc:1370 -#, fuzzy, gcc-internal-format -#| msgid "%<#%s%> before C++23 is a GCC extension" +#, gcc-internal-format msgid "%<#%s%> before C++26 is a GCC extension" -msgstr "%<#%s%> vor C++23 ist eine GCC-Erweiterung" +msgstr "%<#%s%> vor C++26 ist eine GCC-Erweiterung" #: directives.cc:1379 -#, fuzzy, gcc-internal-format -#| msgid "%<#%s%> is a GCC extension" +#, gcc-internal-format msgid "%<#%s%> is a C23 feature" -msgstr "%<#%s%> ist eine GCC-Erweiterung" +msgstr "%<#%s%> ist ein C23-Feature" #: directives.cc:1436 #, gcc-internal-format |