diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 28 | ||||
-rw-r--r-- | gcc/c/c-decl.cc | 18 | ||||
-rw-r--r-- | gcc/c/c-objc-common.cc | 3 | ||||
-rw-r--r-- | gcc/c/c-parser.cc | 8 | ||||
-rw-r--r-- | gcc/c/gimple-parser.cc | 109 |
5 files changed, 75 insertions, 91 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index c8f9206..4c8fde7 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,31 @@ +2025-04-28 David Malcolm <dmalcolm@redhat.com> + + * c-decl.cc: Drop include of "make-unique.h". + Replace uses of ::make_unique with std::make_unique. + * c-objc-common.cc: Likewise. + * c-parser.cc: Likewise. + +2025-04-28 David Malcolm <dmalcolm@redhat.com> + + * c-decl.cc: Include "make-unique.h". + (lookup_name_fuzzy): Use ::make_unique rather than "new" when + making suggest_missing_header and suggest_missing_option. + * c-parser.cc: Include "make-unique.h" + (c_parser_error_richloc): Use ::make_unique rather than "new" when + making suggest_missing_header. + +2025-04-28 Andrew Pinski <quic_apinski@quicinc.com> + + PR c/119432 + * gimple-parser.cc (gimple_binary_identifier_code): Add + __ROTATE_LEFT and __ROTATE_RIGHT. + +2025-04-28 Andrew Pinski <quic_apinski@quicinc.com> + + * gimple-parser.cc (gimple_binary_identifier_code): New variable. + (c_parser_gimple_binary_expression): Use gimple_binary_identifier_code + instead of doing if statements on the strings. + 2025-04-27 H.J. Lu <hjl.tools@gmail.com> PR c/48274 diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index e7aee8a..4e200f9 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -4547,10 +4547,11 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc) = get_c_stdlib_header_for_name (IDENTIFIER_POINTER (name)); if (header_hint) - return name_hint (NULL, - new suggest_missing_header (loc, - IDENTIFIER_POINTER (name), - header_hint)); + return name_hint + (nullptr, + std::make_unique<suggest_missing_header> (loc, + IDENTIFIER_POINTER (name), + header_hint)); /* Next, look for exact matches for builtin defines that would have been defined if the user had passed a command-line option (e.g. -fopenmp @@ -4558,10 +4559,11 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc) diagnostic_option_id option_id = get_option_for_builtin_define (IDENTIFIER_POINTER (name)); if (option_id.m_idx > 0) - return name_hint (nullptr, - new suggest_missing_option (loc, - IDENTIFIER_POINTER (name), - option_id)); + return name_hint + (nullptr, + std::make_unique<suggest_missing_option> (loc, + IDENTIFIER_POINTER (name), + option_id)); /* Only suggest names reserved for the implementation if NAME begins with an underscore. */ diff --git a/gcc/c/c-objc-common.cc b/gcc/c/c-objc-common.cc index 7e227d3..2016eae 100644 --- a/gcc/c/c-objc-common.cc +++ b/gcc/c/c-objc-common.cc @@ -32,7 +32,6 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "attribs.h" #include "dwarf2.h" -#include "make-unique.h" static bool c_tree_printer (pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, pp_token_list &); @@ -412,7 +411,7 @@ has_c_linkage (const_tree decl ATTRIBUTE_UNUSED) void c_initialize_diagnostics (diagnostic_context *context) { - context->set_pretty_printer (::make_unique<c_pretty_printer> ()); + context->set_pretty_printer (std::make_unique<c_pretty_printer> ()); c_common_diagnostics_set_defaults (context); context->set_format_decoder (&c_tree_printer); } diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 22ec0f8..8a63dc5 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -1072,9 +1072,11 @@ c_parser_error_richloc (c_parser *parser, const char *gmsgid, const char *header_hint = get_c_stdlib_header_for_string_macro_name (token_name); if (header_hint != NULL) - h = name_hint (NULL, new suggest_missing_header (token->location, - token_name, - header_hint)); + h = name_hint (nullptr, + std::make_unique<suggest_missing_header> + (token->location, + token_name, + header_hint)); } c_parse_error (gmsgid, diff --git a/gcc/c/gimple-parser.cc b/gcc/c/gimple-parser.cc index 90b9beb..5fd1db8 100644 --- a/gcc/c/gimple-parser.cc +++ b/gcc/c/gimple-parser.cc @@ -963,6 +963,29 @@ c_parser_gimple_statement (gimple_parser &parser, gimple_seq *seq) return; } +/* A mapping between an identifier to a tree code for binary operations. */ +static const std::pair<const char *, tree_code> gimple_binary_identifier_code[] = + { + {"__MULT_HIGHPART", MULT_HIGHPART_EXPR}, + {"__UNLT", UNLT_EXPR}, + {"__UNLE", UNLE_EXPR}, + {"__UNGT", UNGT_EXPR}, + {"__UNGE", UNGE_EXPR}, + {"__UNEQ", UNEQ_EXPR}, + {"__UNORDERED", UNORDERED_EXPR}, + {"__ORDERED", ORDERED_EXPR}, + {"__LTGT", LTGT_EXPR}, + {"__FLOOR_DIV", FLOOR_DIV_EXPR}, + {"__ROUND_DIV", ROUND_DIV_EXPR}, + {"__EXACT_DIV", EXACT_DIV_EXPR}, + {"__CEIL_DIV", CEIL_DIV_EXPR}, + {"__FLOOR_MOD", FLOOR_MOD_EXPR}, + {"__ROUND_MOD", ROUND_MOD_EXPR}, + {"__CEIL_MOD", CEIL_MOD_EXPR}, + {"__ROTATE_LEFT", LROTATE_EXPR}, + {"__ROTATE_RIGHT", RROTATE_EXPR}, + }; + /* Parse gimple binary expr. gimple-binary-expression: @@ -1061,86 +1084,16 @@ c_parser_gimple_binary_expression (gimple_parser &parser, tree ret_type) case CPP_NAME: { tree id = c_parser_peek_token (parser)->value; - if (strcmp (IDENTIFIER_POINTER (id), "__MULT_HIGHPART") == 0) - { - code = MULT_HIGHPART_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__UNLT") == 0) - { - code = UNLT_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__UNLE") == 0) - { - code = UNLE_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__UNGT") == 0) - { - code = UNGT_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__UNGE") == 0) - { - code = UNGE_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__UNEQ") == 0) - { - code = UNEQ_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__UNORDERED") == 0) - { - code = UNORDERED_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__ORDERED") == 0) - { - code = ORDERED_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__LTGT") == 0) + for (auto &p : gimple_binary_identifier_code) { - code = LTGT_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__FLOOR_DIV") == 0) - { - code = FLOOR_DIV_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__ROUND_DIV") == 0) - { - code = ROUND_DIV_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__EXACT_DIV") == 0) - { - code = EXACT_DIV_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__CEIL_DIV") == 0) - { - code = CEIL_DIV_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__FLOOR_MOD") == 0) - { - code = FLOOR_MOD_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__ROUND_MOD") == 0) - { - code = ROUND_MOD_EXPR; - break; - } - else if (strcmp (IDENTIFIER_POINTER (id), "__CEIL_MOD") == 0) - { - code = CEIL_MOD_EXPR; - break; + if (strcmp (IDENTIFIER_POINTER (id), p.first) == 0) + { + code = p.second; + break; + } } + if (code != ERROR_MARK) + break; } /* Fallthru. */ default: |