From: Martin Sebor Date: Tue, 9 Jul 2019 16:36:00 +0000 (+0000) Subject: PR c++/61339 - add mismatch between struct and class [-Wmismatched-tags] to non-bugs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c1dae73cd2ceb6a326f786f6d4e8674863de45e;p=gcc.git PR c++/61339 - add mismatch between struct and class [-Wmismatched-tags] to non-bugs gcc/c/ChangeLog: PR c++/61339 * c-decl.c: Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * gimple-parser.c: Same. gcc/c-family/ChangeLog: PR c++/61339 * c-format.c (check_argument_type): Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * c-pretty-print.h: Same. gcc/cp/ChangeLog: PR c++/61339 * constexpr.c (cxx_eval_call_expression): Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * constraint.cc (get_concept_definition): Same. * cp-tree.h: Same. * cxx-pretty-print.h: Same. * error.c: Same. * logic.cc (term_list::replace): Same. * name-lookup.c (find_local_binding): Same. * pt.c (tsubst_binary_right_fold): Same. * search.c (field_accessor_p): Same. * semantics.c (expand_or_defer_fn): Same. gcc/lto/ChangeLog: PR c++/61339 * lto-dump.c: Change class-key from classi to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. gcc/ChangeLog: PR c++/61339 * align.h: Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * alloc-pool.h: Same. * asan.c (shadow_mem_size): Same. * auto-profile.c: Same. * basic-block.h: Same. * bitmap.h: Same. * cfgexpand.c (set_rtl): Same. (expand_one_stack_var_at): Same. * cfghooks.h: Same. * cfgloop.h: Same. * cgraph.h: Same. * config/i386/i386.h: Same. * df-problems.c (df_print_bb_index): Same. * df-scan.c: Same. * df.h (df_single_use): Same. * diagnostic-show-locus.c (layout::print_annotation_line): Same. (layout::annotation_line_showed_range_p): Same. (get_printed_columns): Same. (correction::ensure_terminated): Same. (line_corrections::~line_corrections): Same. * dojump.h: Same. * dse.c: Same. * dump-context.h: Same. * dumpfile.h: Same. * dwarf2out.c: Same. * edit-context.c: Same. * fibonacci_heap.c (test_union_of_equal_heaps): Same. * flags.h: Same. * function.c (assign_stack_local): Same. * function.h: Same. * gcc.c: Same. * gcov.c (block_info::block_info): Same. * genattrtab.c: Same. * genextract.c: Same. * genmatch.c (comparison_code_p): Same. (id_base::id_base): Same. (decision_tree::print): Same. * genoutput.c: Same. * genpreds.c (write_one_predicate_function): Same. * genrecog.c (validate_pattern): Same. (find_operand_positions): Same. (optimize_subroutine_group): Same. (merge_pattern_transition::merge_pattern_transition): Same. (merge_pattern_info::merge_pattern_info): Same. (merge_state_result::merge_state_result): Same. (merge_into_state): Same. * gensupport.c: Same. * gensupport.h: Same. * ggc-common.c (init_ggc_heuristics): Same. * ggc-tests.c (test_union): Same. * gimple-loop-interchange.cc (dump_induction): Same. * gimple-loop-versioning.cc: Same. * gimple-match.h (gimple_match_cond::any_else): Same. * gimple-ssa-backprop.c: Same. * gimple-ssa-sprintf.c: Same. * gimple-ssa-store-merging.c (store_operand_info::store_operand_info): Same. (store_immediate_info::store_immediate_info): Same. (merged_store_group::apply_stores): Same. (get_location_for_stmts): Same. * gimple-ssa-strength-reduction.c: Same. * gimple-ssa-warn-alloca.c: Same. * gimple-ssa-warn-restrict.c (pass_wrestrict::execute): Same. * godump.c (go_type_decl): Same. * hash-map-tests.c (test_map_of_strings_to_int): Same. * hash-map.h: Same. * hash-set-tests.c (test_set_of_strings): Same. * hsa-brig.c: Same. * hsa-common.h: Same. * hsa-gen.c (transformable_switch_to_sbr_p): Same. * input.c (assert_loceq): Same. * input.h: Same. * ipa-cp.c: Same. * ipa-devirt.c (possible_polymorphic_call_targets_1): Same. * ipa-fnsummary.h: Same. * ipa-inline.h: Same. * ipa-prop.h: Same. * ipa-split.c (visit_bb): Same. * ira-int.h (minmax_set_iter_next): Same. * loop-invariant.c: Same. * loop-iv.c: Same. * lra-eliminations.c: Same. * lra-int.h: Same. * lra-lives.c (mark_regno_dead): Same. * lra-remat.c: Same. * lra-spills.c: Same. * lto-streamer.h: Same. * mem-stats.h: Same. * omp-grid.c (omp_grid_lastprivate_predicate): Same. * omp-low.c (omp_clause_aligned_alignment): Same. * optabs-query.h (get_vcond_eq_icode): Same. * optabs.h: Same. * opts.c (wrap_help): Same. * poly-int.h: Same. * predict.c (predict_paths_leading_to_edge): Same. * pretty-print.h: Same. * profile-count.h: Same. * read-md.h: Same. * read-rtl-function.c: Same. * ree.c: Same. * reginfo.c: Same. * regrename.c: Same. * regrename.h: Same. * reload.h: Same. * rtl-iter.h: Same. * rtl.h (costs_add_n_insns): Same. * sanopt.c: Same. * sched-int.h: Same. * sel-sched-ir.h: Same. * selftest.h: Same. * sese.h (vec_find): Same. * stmt.c: Same. * target-globals.h: Same. * tree-affine.c (aff_combination_find_elt): Same. * tree-affine.h: Same. * tree-data-ref.h: Same. * tree-outof-ssa.c (ssa_is_replaceable_p): Same. * tree-predcom.c: Same. * tree-scalar-evolution.c (find_var_scev_info): Same. * tree-ssa-alias.h: Same. * tree-ssa-ccp.c: Same. * tree-ssa-coalesce.c (ssa_conflicts_dump): Same. * tree-ssa-loop-im.c (for_all_locs_in_loop): Same. (rewrite_mem_refs): Same. (execute_sm_if_changed): Same. (hoist_memory_references): Same. * tree-ssa-loop-ivopts.c (operator<=): Same. * tree-ssa-loop.h: Same. * tree-ssa-pre.c (get_or_alloc_expr_for_name): Same. * tree-ssa-structalias.c: Same. * tree-switch-conversion.h (cluster::cluster): Same. (simple_cluster::simple_cluster): Same. * tree-vect-patterns.c (type_conversion_p): Same. * tree-vectorizer.c (dump_stmt_cost): Same. * tree-vectorizer.h (loop_vec_info_for_loop): Same. * tree.c (protected_set_expr_location): Same. * tree.h (desired_pro_or_demotion_p): Same. (fndecl_built_in_p): Same. * unique-ptr-tests.cc: Same. * var-tracking.c (delete_variable_part): Same. * varasm.c (assemble_real): Same. (tree_output_constant_def): Same. * vec.c: Same. * wide-int-bitmask.h: Same. * wide-int.h (decompose): Same. From-SVN: r273308 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63f50e89b9d..1606b910391 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,152 @@ +2019-07-09 Martin Sebor + + PR c++/61339 + * align.h: Change class-key from class to struct and vice versa + to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. + * alloc-pool.h: Same. + * asan.c (shadow_mem_size): Same. + * auto-profile.c: Same. + * basic-block.h: Same. + * bitmap.h: Same. + * cfgexpand.c (set_rtl): Same. + (expand_one_stack_var_at): Same. + * cfghooks.h: Same. + * cfgloop.h: Same. + * cgraph.h: Same. + * config/i386/i386.h: Same. + * df-problems.c (df_print_bb_index): Same. + * df-scan.c: Same. + * df.h (df_single_use): Same. + * diagnostic-show-locus.c (layout::print_annotation_line): Same. + (layout::annotation_line_showed_range_p): Same. + (get_printed_columns): Same. + (correction::ensure_terminated): Same. + (line_corrections::~line_corrections): Same. + * dojump.h: Same. + * dse.c: Same. + * dump-context.h: Same. + * dumpfile.h: Same. + * dwarf2out.c: Same. + * edit-context.c: Same. + * fibonacci_heap.c (test_union_of_equal_heaps): Same. + * flags.h: Same. + * function.c (assign_stack_local): Same. + * function.h: Same. + * gcc.c: Same. + * gcov.c (block_info::block_info): Same. + * genattrtab.c: Same. + * genextract.c: Same. + * genmatch.c (comparison_code_p): Same. + (id_base::id_base): Same. + (decision_tree::print): Same. + * genoutput.c: Same. + * genpreds.c (write_one_predicate_function): Same. + * genrecog.c (validate_pattern): Same. + (find_operand_positions): Same. + (optimize_subroutine_group): Same. + (merge_pattern_transition::merge_pattern_transition): Same. + (merge_pattern_info::merge_pattern_info): Same. + (merge_state_result::merge_state_result): Same. + (merge_into_state): Same. + * gensupport.c: Same. + * gensupport.h: Same. + * ggc-common.c (init_ggc_heuristics): Same. + * ggc-tests.c (test_union): Same. + * gimple-loop-interchange.cc (dump_induction): Same. + * gimple-loop-versioning.cc: Same. + * gimple-match.h (gimple_match_cond::any_else): Same. + * gimple-ssa-backprop.c: Same. + * gimple-ssa-sprintf.c: Same. + * gimple-ssa-store-merging.c (store_operand_info::store_operand_info): Same. + (store_immediate_info::store_immediate_info): Same. + (merged_store_group::apply_stores): Same. + (get_location_for_stmts): Same. + * gimple-ssa-strength-reduction.c: Same. + * gimple-ssa-warn-alloca.c: Same. + * gimple-ssa-warn-restrict.c (pass_wrestrict::execute): Same. + * godump.c (go_type_decl): Same. + * hash-map-tests.c (test_map_of_strings_to_int): Same. + * hash-map.h: Same. + * hash-set-tests.c (test_set_of_strings): Same. + * hsa-brig.c: Same. + * hsa-common.h: Same. + * hsa-gen.c (transformable_switch_to_sbr_p): Same. + * input.c (assert_loceq): Same. + * input.h: Same. + * ipa-cp.c: Same. + * ipa-devirt.c (possible_polymorphic_call_targets_1): Same. + * ipa-fnsummary.h: Same. + * ipa-inline.h: Same. + * ipa-prop.h: Same. + * ipa-split.c (visit_bb): Same. + * ira-int.h (minmax_set_iter_next): Same. + * loop-invariant.c: Same. + * loop-iv.c: Same. + * lra-eliminations.c: Same. + * lra-int.h: Same. + * lra-lives.c (mark_regno_dead): Same. + * lra-remat.c: Same. + * lra-spills.c: Same. + * lto-streamer.h: Same. + * mem-stats.h: Same. + * omp-grid.c (omp_grid_lastprivate_predicate): Same. + * omp-low.c (omp_clause_aligned_alignment): Same. + * optabs-query.h (get_vcond_eq_icode): Same. + * optabs.h: Same. + * opts.c (wrap_help): Same. + * poly-int.h: Same. + * predict.c (predict_paths_leading_to_edge): Same. + * pretty-print.h: Same. + * profile-count.h: Same. + * read-md.h: Same. + * read-rtl-function.c: Same. + * ree.c: Same. + * reginfo.c: Same. + * regrename.c: Same. + * regrename.h: Same. + * reload.h: Same. + * rtl-iter.h: Same. + * rtl.h (costs_add_n_insns): Same. + * sanopt.c: Same. + * sched-int.h: Same. + * sel-sched-ir.h: Same. + * selftest.h: Same. + * sese.h (vec_find): Same. + * stmt.c: Same. + * target-globals.h: Same. + * tree-affine.c (aff_combination_find_elt): Same. + * tree-affine.h: Same. + * tree-data-ref.h: Same. + * tree-outof-ssa.c (ssa_is_replaceable_p): Same. + * tree-predcom.c: Same. + * tree-scalar-evolution.c (find_var_scev_info): Same. + * tree-ssa-alias.h: Same. + * tree-ssa-ccp.c: Same. + * tree-ssa-coalesce.c (ssa_conflicts_dump): Same. + * tree-ssa-loop-im.c (for_all_locs_in_loop): Same. + (rewrite_mem_refs): Same. + (execute_sm_if_changed): Same. + (hoist_memory_references): Same. + * tree-ssa-loop-ivopts.c (operator<=): Same. + * tree-ssa-loop.h: Same. + * tree-ssa-pre.c (get_or_alloc_expr_for_name): Same. + * tree-ssa-structalias.c: Same. + * tree-switch-conversion.h (cluster::cluster): Same. + (simple_cluster::simple_cluster): Same. + * tree-vect-patterns.c (type_conversion_p): Same. + * tree-vectorizer.c (dump_stmt_cost): Same. + * tree-vectorizer.h (loop_vec_info_for_loop): Same. + * tree.c (protected_set_expr_location): Same. + * tree.h (desired_pro_or_demotion_p): Same. + (fndecl_built_in_p): Same. + * unique-ptr-tests.cc: Same. + * var-tracking.c (delete_variable_part): Same. + * varasm.c (assemble_real): Same. + (tree_output_constant_def): Same. + * vec.c: Same. + * wide-int-bitmask.h: Same. + * wide-int.h (decompose): Same. + 2019-07-09 Richard Biener PR tree-optimization/91114 diff --git a/gcc/align.h b/gcc/align.h index 67684513c7e..6c98e2d9646 100644 --- a/gcc/align.h +++ b/gcc/align.h @@ -45,8 +45,9 @@ struct align_flags_tuple /* Alignment flags is structure used as value of -align-* options. It's used in target-dependant code. */ -struct align_flags +class align_flags { +public: /* Default constructor. */ align_flags (int log0 = 0, int maxskip0 = 0, int log1 = 0, int maxskip1 = 0) { diff --git a/gcc/alloc-pool.h b/gcc/alloc-pool.h index d3208100316..d8878b6b742 100644 --- a/gcc/alloc-pool.h +++ b/gcc/alloc-pool.h @@ -34,8 +34,9 @@ typedef unsigned long ALLOC_POOL_ID_TYPE; extern ALLOC_POOL_ID_TYPE last_id; /* Pool allocator memory usage. */ -struct pool_usage: public mem_usage +class pool_usage: public mem_usage { +public: /* Default contructor. */ pool_usage (): m_element_size (0), m_pool_name ("") {} /* Constructor. */ diff --git a/gcc/asan.c b/gcc/asan.c index 605d04f87f7..a731bd490b4 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1225,8 +1225,9 @@ shadow_mem_size (unsigned HOST_WIDE_INT size) #define RZ_BUFFER_SIZE 4 /* ASAN redzone buffer container that handles emission of shadow bytes. */ -struct asan_redzone_buffer +class asan_redzone_buffer { +public: /* Constructor. */ asan_redzone_buffer (rtx shadow_mem, HOST_WIDE_INT prev_offset): m_shadow_mem (shadow_mem), m_prev_offset (prev_offset), diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index 26353a21486..59100a0a47d 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -136,8 +136,9 @@ typedef std::map icall_target_map; typedef std::set stmt_set; /* Represent count info of an inline stack. */ -struct count_info +class count_info { +public: /* Sampled count of the inline stack. */ gcov_type count; diff --git a/gcc/basic-block.h b/gcc/basic-block.h index fba5526294e..964f2bd5784 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -23,7 +23,8 @@ along with GCC; see the file COPYING3. If not see #include /* Control flow edge information. */ -struct GTY((user)) edge_def { +class GTY((user)) edge_def { +public: /* The two blocks at the ends of the edge. */ basic_block src; basic_block dest; diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 39f509db611..0e3ffc8862f 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -212,8 +212,9 @@ along with GCC; see the file COPYING3. If not see #include "obstack.h" /* Bitmap memory usage. */ -struct bitmap_usage: public mem_usage +class bitmap_usage: public mem_usage { +public: /* Default contructor. */ bitmap_usage (): m_nsearches (0), m_search_iter (0) {} /* Constructor. */ @@ -321,7 +322,8 @@ struct GTY((chain_next ("%h.next"))) bitmap_element { /* Head of bitmap linked list. The 'current' member points to something already pointed to by the chain started by first, so GTY((skip)) it. */ -struct GTY(()) bitmap_head { +class GTY(()) bitmap_head { +public: static bitmap_obstack crashme; /* Poison obstack to not make it not a valid initialized GC bitmap. */ CONSTEXPR bitmap_head() diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 84d1f2e4f1d..4d8f967b341 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2019-07-09 Martin Sebor + + PR c++/61339 + * c-format.c (check_argument_type): Change class-key from class to + struct and vice versa to match convention and avoid -Wclass-is-pod + and -Wstruct-no-pod. + * c-pretty-print.h: Same. + 2019-07-03 Martin Liska * c-common.c (try_to_locate_new_include_insertion_point): Remove diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c index 6363fa4f686..d134116d598 100644 --- a/gcc/c-family/c-format.c +++ b/gcc/c-family/c-format.c @@ -1839,8 +1839,9 @@ class flag_chars_t /* Support struct for argument_parser and check_format_info_main. Encapsulates any length modifier applied to the current argument. */ -struct length_modifier +class length_modifier { +public: length_modifier () : chars (NULL), val (FMT_LEN_none), std (STD_C89), scalar_identity_flag (0) @@ -2853,8 +2854,9 @@ check_argument_type (const format_char_info *fci, /* Describes "paired tokens" within the format string that are expected to be balanced. */ -struct baltoks_t +class baltoks_t { +public: baltoks_t (): singlequote (), doublequote () { } typedef auto_vec balanced_tokens_t; diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h index 6084dcf9c06..8c516c3e56b 100644 --- a/gcc/c-family/c-pretty-print.h +++ b/gcc/c-family/c-pretty-print.h @@ -47,8 +47,9 @@ typedef void (*c_pretty_print_fn) (c_pretty_printer *, tree); facilities provided here. A derived pretty-printer can override any function listed in the vtable below. See cp/cxx-pretty-print.h and cp/cxx-pretty-print.c for an example of derivation. */ -struct c_pretty_printer : pretty_printer +class c_pretty_printer : public pretty_printer { +public: c_pretty_printer (); // Format string, possibly translated. diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 271ed4ba3e9..d2645a84dec 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2019-07-09 Martin Sebor + + PR c++/61339 + * c-decl.c: Change class-key from class to struct and vice versa + to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. + * gimple-parser.c: Same. + 2019-07-01 Richard Biener * gimple-parser.c (c_parser_gimple_postfix_expression): Handle diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index cb2f49fa5a2..35e15ba2a8b 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -574,8 +574,9 @@ typedef struct c_binding *c_binding_ptr; /* Information that we keep for a struct or union while it is being parsed. */ -struct c_struct_parse_info +class c_struct_parse_info { +public: /* If warn_cxx_compat, a list of types defined within this struct. */ auto_vec struct_types; diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index b2b364cc41a..e388d93b9e2 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -68,8 +68,9 @@ along with GCC; see the file COPYING3. If not see /* GIMPLE parser state. */ -struct gimple_parser +class gimple_parser { +public: gimple_parser (c_parser *p) : parser (p), edges(), current_bb(NULL) {} /* c_parser is not visible here, use composition and fake inheritance via a conversion operator. */ @@ -77,8 +78,9 @@ struct gimple_parser c_parser *parser; /* CFG build state. */ - struct gimple_parser_edge + class gimple_parser_edge { + public: int src; int dest; int flags; diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 1e84d2c4a4e..0128fca4e2b 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -305,8 +305,9 @@ set_rtl (tree t, rtx x) /* This structure holds data relevant to one variable that will be placed in a stack slot. */ -struct stack_var +class stack_var { +public: /* The Variable. */ tree decl; @@ -1021,8 +1022,9 @@ expand_one_stack_var_at (tree decl, rtx base, unsigned base_align, set_rtl (decl, x); } -struct stack_vars_data +class stack_vars_data { +public: /* Vector of offset pairs, always end of some padding followed by start of the padding that needs Address Sanitizer protection. The vector is in reversed, highest offset pairs come first. */ diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h index e9385c99443..9ed0c363158 100644 --- a/gcc/cfghooks.h +++ b/gcc/cfghooks.h @@ -58,8 +58,9 @@ typedef int_hash dependence_hash; /* Optional data for duplicate_block. */ -struct copy_bb_data +class copy_bb_data { +public: copy_bb_data() : dependence_map (NULL) {} ~copy_bb_data () { delete dependence_map; } diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index 2f8ab106d03..94140702055 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -46,7 +46,8 @@ enum iv_extend_code /* The structure describing a bound on number of iterations of a loop. */ -struct GTY ((chain_next ("%h.next"))) nb_iter_bound { +class GTY ((chain_next ("%h.next"))) nb_iter_bound { +public: /* The statement STMT is executed at most ... */ gimple *stmt; @@ -113,7 +114,8 @@ struct GTY ((chain_next ("%h.next"))) control_iv { }; /* Structure to hold information for each natural loop. */ -struct GTY ((chain_next ("%h.next"))) loop { +class GTY ((chain_next ("%h.next"))) loop { +public: /* Index into loops array. Note indices will never be reused after loop is destroyed. */ int num; @@ -422,8 +424,9 @@ void mark_loop_for_removal (loop_p); computation is done, which would enable it to be different from the outer one? */ -struct rtx_iv +class rtx_iv { +public: /* Its base and step (mode of base and step is supposed to be extend_mode, see the description above). */ rtx base, step; @@ -448,8 +451,9 @@ struct rtx_iv /* The description of an exit from the loop and of the number of iterations till we take the exit. */ -struct GTY(()) niter_desc +class GTY(()) niter_desc { +public: /* The edge out of the loop. */ edge out_edge; @@ -651,8 +655,9 @@ enum li_flags /* The iterator for loops. */ -struct loop_iterator +class loop_iterator { +public: loop_iterator (function *fn, loop_p *loop, unsigned flags); ~loop_iterator (); diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 18839a4a5ec..e5fd6dd133c 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -100,8 +100,8 @@ enum symbol_partitioning_class /* Base of all entries in the symbol table. The symtab_node is inherited by cgraph and varpol nodes. */ -class GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"), - chain_next ("%h.next"), chain_prev ("%h.previous"))) +struct GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"), + chain_next ("%h.next"), chain_prev ("%h.previous"))) symtab_node { public: @@ -912,7 +912,8 @@ struct cgraph_edge_hasher : ggc_ptr_hash /* The cgraph data structure. Each function decl has assigned cgraph_node listing callees and callers. */ -struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node { +class GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node +{ public: friend class symbol_table; @@ -1632,8 +1633,9 @@ private: /* Structure containing additional information about an indirect call. */ -struct GTY(()) cgraph_indirect_call_info +class GTY(()) cgraph_indirect_call_info { +public: /* When agg_content is set, an offset where the call pointer is located within the aggregate. */ HOST_WIDE_INT offset; @@ -1673,8 +1675,10 @@ struct GTY(()) cgraph_indirect_call_info unsigned vptr_changed : 1; }; -struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"), - for_user)) cgraph_edge { +class GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"), + for_user)) cgraph_edge +{ +public: friend class cgraph_node; friend class symbol_table; @@ -1856,8 +1860,8 @@ private: /* The varpool data structure. Each static variable decl has assigned varpool_node. */ -class GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node { -public: +struct GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node +{ /* Dump given varpool node to F. */ void dump (FILE *f); diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 1f70844fc45..a2fcdd4c644 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2417,8 +2417,9 @@ const wide_int_bitmask PTA_KNM = PTA_KNL | PTA_AVX5124VNNIW #include "insn-attr-common.h" -struct pta +class pta { +public: const char *const name; /* processor name or nickname. */ const enum processor_type processor; const enum attr_cpu schedule; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0fcbfe507e1..2dd3893f8ac 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,19 @@ +2019-07-09 Martin Sebor + + PR c++/61339 + * constexpr.c (cxx_eval_call_expression): Change class-key from class + to struct and vice versa to match convention and avoid -Wclass-is-pod + and -Wstruct-no-pod. + * constraint.cc (get_concept_definition): Same. + * cp-tree.h: Same. + * cxx-pretty-print.h: Same. + * error.c: Same. + * logic.cc (term_list::replace): Same. + * name-lookup.c (find_local_binding): Same. + * pt.c (tsubst_binary_right_fold): Same. + * search.c (field_accessor_p): Same. + * semantics.c (expand_or_defer_fn): Same. + 2019-07-08 Jakub Jelinek PR c++/91110 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index d11e7af3eb1..c1b8b9b8a5d 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1753,8 +1753,9 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, /* We build up the bindings list before we know whether we already have this call cached. If we don't end up saving these bindings, ggc_free them when this function exits. */ - struct free_bindings + class free_bindings { + public: tree &bindings; bool do_free; free_bindings (tree &b): bindings (b), do_free(true) { } diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index ed39ecce717..cc578bb5b39 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -517,8 +517,9 @@ get_concept_definition (tree decl) int expansion_level = 0; -struct expanding_concept_sentinel +class expanding_concept_sentinel { +public: expanding_concept_sentinel () { ++expansion_level; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e814bc973f8..970296df010 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -873,8 +873,9 @@ struct named_decl_hash : ggc_remove /* Simplified unique_ptr clone to release a tree vec on exit. */ -struct releasing_vec +class releasing_vec { +public: typedef vec vec_t; releasing_vec (vec_t *v): v(v) { } @@ -1728,8 +1729,9 @@ extern GTY(()) struct saved_scope *scope_chain; /* RAII sentinel to handle clearing processing_template_decl and restoring it when done. */ -struct processing_template_decl_sentinel +class processing_template_decl_sentinel { +public: int saved; processing_template_decl_sentinel (bool reset = true) : saved (processing_template_decl) @@ -1746,8 +1748,9 @@ struct processing_template_decl_sentinel /* RAII sentinel to disable certain warnings during template substitution and elsewhere. */ -struct warning_sentinel +class warning_sentinel { +public: int &flag; int val; warning_sentinel(int& flag, bool suppress=true) @@ -5267,8 +5270,9 @@ extern int cp_unevaluated_operand; /* RAII class used to inhibit the evaluation of operands during parsing and template instantiation. Evaluation warnings are also inhibited. */ -struct cp_unevaluated +class cp_unevaluated { +public: cp_unevaluated (); ~cp_unevaluated (); }; @@ -5276,8 +5280,9 @@ struct cp_unevaluated /* The reverse: an RAII class used for nested contexts that are evaluated even if the enclosing context is not. */ -struct cp_evaluated +class cp_evaluated { +public: int uneval; int inhibit; cp_evaluated () @@ -5304,8 +5309,9 @@ enum unification_kind_t { // specializations. When the stack goes out of scope, the // previous pointer map is restored. enum lss_policy { lss_blank, lss_copy }; -struct local_specialization_stack +class local_specialization_stack { +public: local_specialization_stack (lss_policy = lss_blank); ~local_specialization_stack (); @@ -6973,8 +6979,9 @@ extern bool perform_or_defer_access_check (tree, tree, tree, /* RAII sentinel to ensures that deferred access checks are popped before a function returns. */ -struct deferring_access_check_sentinel +class deferring_access_check_sentinel { +public: deferring_access_check_sentinel (enum deferring_kind kind = dk_deferred) { push_deferring_access_checks (kind); diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index aba3e84435f..347811fe735 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -29,8 +29,9 @@ enum cxx_pretty_printer_flags pp_cxx_flag_default_argument = 1 << pp_c_flag_last_bit }; -struct cxx_pretty_printer : c_pretty_printer +class cxx_pretty_printer : public c_pretty_printer { +public: cxx_pretty_printer (); void constant (tree); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index baeba7e1722..5943762fd2d 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -107,8 +107,9 @@ static bool cp_printer (pretty_printer *, text_info *, const char *, /* Struct for handling %H or %I, which require delaying printing the type until a postprocessing stage. */ -struct deferred_printed_type +class deferred_printed_type { +public: deferred_printed_type () : m_tree (NULL_TREE), m_buffer_ptr (NULL), m_verbose (false), m_quote (false) {} diff --git a/gcc/cp/logic.cc b/gcc/cp/logic.cc index 2ace8c3e157..13cc3212436 100644 --- a/gcc/cp/logic.cc +++ b/gcc/cp/logic.cc @@ -104,8 +104,9 @@ struct term_hasher : ggc_ptr_hash Each term list maintains an iterator that refers to the current term. This can be used by various tactics to support iteration and stateful manipulation of the list. */ -struct term_list +class term_list { +public: typedef std::list::iterator iterator; term_list (); @@ -220,8 +221,9 @@ term_list::replace (iterator iter, tree t1, tree t2) conclusions written as propositions in the constraint language (i.e., lists of trees). */ -struct proof_goal +class proof_goal { +public: term_list assumptions; term_list conclusions; }; @@ -230,8 +232,9 @@ struct proof_goal current sub-goal. The class also provides facilities for managing subgoals and constructing term lists. */ -struct proof_state : std::list +class proof_state : public std::list { +public: proof_state (); iterator branch (iterator i); diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index f4c34ed6a29..ad866298fa5 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -157,7 +157,7 @@ find_local_binding (cp_binding_level *b, tree name) return NULL; } -struct name_lookup +class name_lookup { public: typedef std::pair using_pair; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c5161a7782f..c0a04872001 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12032,8 +12032,9 @@ tsubst_binary_right_fold (tree t, tree args, tsubst_flags_t complain, /* Walk through the pattern of a pack expansion, adding everything in local_specializations to a list. */ -struct el_data +class el_data { +public: hash_set internal; tree extra; tsubst_flags_t complain; diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 372c4424747..a737e242b1c 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1803,8 +1803,9 @@ field_accessor_p (tree fn, tree field_decl, bool const_p) /* Callback data for dfs_locate_field_accessor_pre. */ -struct locate_field_data +class locate_field_data { +public: locate_field_data (tree field_decl_, bool const_p_) : field_decl (field_decl_), const_p (const_p_) {} diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index cd24490bc6b..ceb6c641750 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4380,8 +4380,9 @@ expand_or_defer_fn (tree fn) } } -struct nrv_data +class nrv_data { +public: nrv_data () : visited (37) {} tree var; diff --git a/gcc/df-problems.c b/gcc/df-problems.c index a9dfa6203cf..62b2cf6162f 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -144,8 +144,9 @@ df_print_bb_index (basic_block bb, FILE *file) /* Private data used to compute the solution for this problem. These data structures are not accessible outside of this module. */ -struct df_rd_problem_data +class df_rd_problem_data { +public: /* The set of defs to regs invalidated by call. */ bitmap_head sparse_invalidated_by_call; /* The set of defs to regs invalidate by call for rd. */ diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 81e221ee38f..ffaca0b66fd 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -44,8 +44,9 @@ static HARD_REG_SET elim_reg_set; /* Initialize ur_in and ur_out as if all hard registers were partially available. */ -struct df_collection_rec +class df_collection_rec { +public: auto_vec def_vec; auto_vec use_vec; auto_vec eq_use_vec; diff --git a/gcc/df.h b/gcc/df.h index d76d31baa84..13358f9ad3c 100644 --- a/gcc/df.h +++ b/gcc/df.h @@ -524,8 +524,9 @@ struct df_reg_info used by owners of the problem. ----------------------------------------------------------------------------*/ -struct df_d +class df_d { +public: /* The set of problems to be solved is stored in two arrays. In PROBLEMS_IN_ORDER, the problems are stored in the order that they @@ -830,8 +831,9 @@ struct df_scan_bb_info the ref except sparse_kill which is indexed by regno. For the LR&RD problem, the kill set is not complete: It does not contain DEFs killed because the set register has died in the LR set. */ -struct df_rd_bb_info +class df_rd_bb_info { +public: /* Local sets to describe the basic blocks. */ bitmap_head kill; bitmap_head sparse_kill; @@ -846,8 +848,9 @@ struct df_rd_bb_info /* Multiple reaching definitions. All bitmaps are referenced by the register number. */ -struct df_md_bb_info +class df_md_bb_info { +public: /* Local sets to describe the basic blocks. */ bitmap_head gen; /* Partial/conditional definitions live at BB out. */ bitmap_head kill; /* Other definitions that are live at BB out. */ @@ -862,8 +865,9 @@ struct df_md_bb_info /* Live registers, a backwards dataflow problem. All bitmaps are referenced by the register number. */ -struct df_lr_bb_info +class df_lr_bb_info { +public: /* Local sets to describe the basic blocks. */ bitmap_head def; /* The set of registers set in this block - except artificial defs at the top. */ @@ -879,8 +883,9 @@ struct df_lr_bb_info register number. Anded results of the forwards and backward live info. Note that the forwards live information is not available separately. */ -struct df_live_bb_info +class df_live_bb_info { +public: /* Local sets to describe the basic blocks. */ bitmap_head kill; /* The set of registers unset in this block. Calls, for instance, unset registers. */ @@ -897,8 +902,9 @@ struct df_live_bb_info pseudo. Only pseudos that have a size of 2 * UNITS_PER_WORD are meaningfully tracked. */ -struct df_word_lr_bb_info +class df_word_lr_bb_info { +public: /* Local sets to describe the basic blocks. */ bitmap_head def; /* The set of registers set in this block - except artificial defs at the top. */ @@ -911,8 +917,9 @@ struct df_word_lr_bb_info /* Must-initialized registers. All bitmaps are referenced by the register number. */ -struct df_mir_bb_info +class df_mir_bb_info { +public: /* Local sets to describe the basic blocks. */ bitmap_head kill; /* The set of registers unset in this block. Calls, for instance, unset registers. */ @@ -1222,7 +1229,7 @@ df_single_use (const df_insn_info *info) /* web */ -class web_entry_base +struct web_entry_base { private: /* Reference to the parent in the union/find tree. */ diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c index 89074beb6d1..4d563dda8f4 100644 --- a/gcc/diagnostic-show-locus.c +++ b/gcc/diagnostic-show-locus.c @@ -164,8 +164,9 @@ struct line_bounds splits the pertinent source lines into a list of disjoint line_span instances (e.g. lines 5-10, lines 15-20, line 23). */ -struct line_span +class line_span { +public: line_span (linenum_type first_line, linenum_type last_line) : m_first_line (first_line), m_last_line (last_line) { @@ -1409,8 +1410,9 @@ layout::print_annotation_line (linenum_type row, const line_bounds lbounds) A label within the given row of source. */ -struct line_label +class line_label { +public: line_label (int state_idx, int column, label_text text) : m_state_idx (state_idx), m_column (column), m_text (text), m_length (strlen (text.m_buffer)), @@ -1723,8 +1725,9 @@ layout::annotation_line_showed_range_p (linenum_type line, int start_column, /* A range of columns within a line. */ -struct column_range +class column_range { +public: column_range (int start_, int finish_) : start (start_), finish (finish_) { /* We must have either a range, or an insertion. */ @@ -1776,8 +1779,9 @@ get_printed_columns (const fixit_hint *hint) instances that affected the line, potentially consolidating hints into corrections to make the result easier for the user to read. */ -struct correction +class correction { +public: correction (column_range affected_columns, column_range printed_columns, const char *new_text, size_t new_text_len) @@ -1854,8 +1858,9 @@ correction::ensure_terminated () This is used by layout::print_trailing_fixits for planning how to print the fix-it hints affecting the line. */ -struct line_corrections +class line_corrections { +public: line_corrections (const char *filename, linenum_type row) : m_filename (filename), m_row (row) {} @@ -1881,8 +1886,9 @@ line_corrections::~line_corrections () /* A struct wrapping a particular source line, allowing run-time bounds-checking of accesses in a checked build. */ -struct source_line +class source_line { +public: source_line (const char *filename, int line); char_span as_span () { return char_span (chars, width); } diff --git a/gcc/dojump.h b/gcc/dojump.h index ad019293e17..f4dbc111c3f 100644 --- a/gcc/dojump.h +++ b/gcc/dojump.h @@ -37,8 +37,9 @@ extern void do_pending_stack_adjust (void); /* Struct for saving/restoring of pending_stack_adjust/stack_pointer_delta values. */ -struct saved_pending_stack_adjust +class saved_pending_stack_adjust { +public: /* Saved value of pending_stack_adjust. */ poly_int64 x_pending_stack_adjust; diff --git a/gcc/dse.c b/gcc/dse.c index 6f6f768f371..a3cefbf527f 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -220,8 +220,9 @@ static bitmap scratch = NULL; struct insn_info_type; /* This structure holds information about a candidate store. */ -struct store_info +class store_info { +public: /* False means this is a clobber. */ bool is_set; @@ -309,8 +310,9 @@ static object_allocator rtx_store_info_pool ("rtx_store_info_pool"); /* This structure holds information about a load. These are only built for rtx bases. */ -struct read_info_type +class read_info_type { +public: /* The id of the mem group of the base address. */ int group_id; diff --git a/gcc/dump-context.h b/gcc/dump-context.h index b17b86a400f..bb856c64daf 100644 --- a/gcc/dump-context.h +++ b/gcc/dump-context.h @@ -166,8 +166,9 @@ public: private: /* Information on an optinfo_item that was generated during phase 2 of formatting. */ - struct stashed_item + class stashed_item { + public: stashed_item (const char **buffer_ptr_, optinfo_item *item_) : buffer_ptr (buffer_ptr_), item (item_) {} const char **buffer_ptr; diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index 9bcaa25b0a5..8614483f36d 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -367,8 +367,9 @@ class dump_user_location_t /* A class for identifying where in the compiler's own source (or a plugin) that a dump message is being emitted from. */ -struct dump_impl_location_t +class dump_impl_location_t { +public: dump_impl_location_t ( #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) const char *file = __builtin_FILE (), diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 2c4cc6ccf89..0449c2b2912 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3104,7 +3104,8 @@ die_node; /* Set to TRUE while dwarf2out_early_global_decl is running. */ static bool early_dwarf; static bool early_dwarf_finished; -struct set_early_dwarf { +class set_early_dwarf { +public: bool saved; set_early_dwarf () : saved(early_dwarf) { diff --git a/gcc/edit-context.c b/gcc/edit-context.c index 93d10664ae9..4cd26c95e21 100644 --- a/gcc/edit-context.c +++ b/gcc/edit-context.c @@ -48,8 +48,9 @@ class line_event; /* A struct to hold the params of a print_diff call. */ -struct diff +class diff { +public: diff (pretty_printer *pp, bool show_filenames) : m_pp (pp), m_show_filenames (show_filenames) {} diff --git a/gcc/fibonacci_heap.c b/gcc/fibonacci_heap.c index aec6913a871..bddd0477694 100644 --- a/gcc/fibonacci_heap.c +++ b/gcc/fibonacci_heap.c @@ -219,8 +219,9 @@ test_union_of_equal_heaps () /* Dummy struct for testing. */ -struct heap_key +class heap_key { +public: heap_key (int k): key (k) { } diff --git a/gcc/flags.h b/gcc/flags.h index 0ea1812d33e..0cc7df2666c 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -42,8 +42,9 @@ extern bool final_insns_dump_p; /* Other basic status info about current function. */ -struct target_flag_state +class target_flag_state { +public: /* Each falign-foo can generate up to two levels of alignment: -falign-foo=N:M[:N2:M2] */ align_flags x_align_loops; diff --git a/gcc/function.c b/gcc/function.c index 0bce4ec6839..b44c4d0ee33 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -556,7 +556,8 @@ assign_stack_local (machine_mode mode, poly_int64 size, int align) result, all temporaries are preserved. A temporary is preserved by pretending it was allocated at the previous nesting level. */ -struct GTY(()) temp_slot { +class GTY(()) temp_slot { +public: /* Points to next temporary slot. */ struct temp_slot *next; /* Points to previous temporary slot. */ diff --git a/gcc/function.h b/gcc/function.h index bfe9919a760..c2596bf48d5 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -183,16 +183,18 @@ struct GTY(()) function_subsections { /* Describe an empty area of space in the stack frame. These can be chained into a list; this is used to keep track of space wasted for alignment reasons. */ -struct GTY(()) frame_space +class GTY(()) frame_space { +public: struct frame_space *next; poly_int64 start; poly_int64 length; }; -struct GTY(()) stack_usage +class GTY(()) stack_usage { +public: /* # of bytes of static stack space allocated by the function. */ HOST_WIDE_INT static_stack_size; diff --git a/gcc/gcc.c b/gcc/gcc.c index 0c0a686eb9c..a4323eb146e 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -57,7 +57,7 @@ compilation is specified by a string called a "spec". */ getenv (); Hence we need to use "get" for the accessor method, not "getenv". */ -class env_manager +struct env_manager { public: void init (bool can_restore, bool debug); @@ -8579,7 +8579,7 @@ static int n_mdswitches; /* Check whether a particular argument was used. The first time we canonicalize the switches to keep only the ones we care about. */ -class used_arg_t +struct used_arg_t { public: int operator () (const char *p, int len); diff --git a/gcc/gcov.c b/gcc/gcov.c index b06a6714c2e..1d9d3b25b5d 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -121,8 +121,9 @@ struct arc_info /* Describes which locations (lines and files) are associated with a basic block. */ -struct block_location_info +class block_location_info { +public: block_location_info (unsigned _source_file_idx): source_file_idx (_source_file_idx) {} @@ -134,8 +135,9 @@ struct block_location_info /* Describes a basic block. Contains lists of arcs to successor and predecessor blocks. */ -struct block_info +class block_info { +public: /* Constructor. */ block_info (); @@ -191,8 +193,9 @@ block_info::block_info (): succ (NULL), pred (NULL), num_succ (0), num_pred (0), /* Describes a single line of source. Contains a chain of basic blocks with code on it. */ -struct line_info +class line_info { +public: /* Default constructor. */ line_info (); @@ -230,8 +233,9 @@ static int flag_demangled_names = 0; /* Describes a single function. Contains an array of basic blocks. */ -struct function_info +class function_info { +public: function_info (); ~function_info (); @@ -356,8 +360,9 @@ struct coverage_info /* Describes a file mentioned in the block graph. Contains an array of line info. */ -struct source_info +class source_info { +public: /* Default constructor. */ source_info (); diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 78816ba3179..604526d6808 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -133,8 +133,9 @@ static struct obstack *temp_obstack = &obstack2; `struct insn_def'. This is done to allow attribute definitions to occur anywhere in the file. */ -struct insn_def +class insn_def { +public: struct insn_def *next; /* Next insn in chain. */ rtx def; /* The DEFINE_... */ int insn_code; /* Instruction number. */ @@ -169,8 +170,9 @@ struct attr_value /* Structure for each attribute. */ -struct attr_desc +class attr_desc { +public: char *name; /* Name of attribute. */ const char *enum_name; /* Enum name for DEFINE_ENUM_NAME. */ struct attr_desc *next; /* Next attribute. */ @@ -184,8 +186,9 @@ struct attr_desc /* Structure for each DEFINE_DELAY. */ -struct delay_desc +class delay_desc { +public: rtx def; /* DEFINE_DELAY expression. */ struct delay_desc *next; /* Next DEFINE_DELAY. */ file_location loc; /* Where in the .md files it occurs. */ diff --git a/gcc/genextract.c b/gcc/genextract.c index b26f56aa258..66886f6fc91 100644 --- a/gcc/genextract.c +++ b/gcc/genextract.c @@ -68,8 +68,9 @@ static struct code_ptr *peepholes; data that will be used to produce an extractions structure. */ -struct accum_extract +class accum_extract { +public: accum_extract () : oplocs (10), duplocs (10), dupnums (10), pathstr (20) {} auto_vec oplocs; diff --git a/gcc/genmatch.c b/gcc/genmatch.c index 109bd9e6f2d..7403ccb7482 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -347,8 +347,9 @@ comparison_code_p (enum tree_code code) /* Base class for all identifiers the parser knows. */ -struct id_base : nofree_ptr_hash +class id_base : public nofree_ptr_hash { +public: enum id_kind { CODE, FN, PREDICATE, USER, NULL_ID } kind; id_base (id_kind, const char *, int = -1); @@ -393,8 +394,9 @@ id_base::id_base (id_kind kind_, const char *id_, int nargs_) /* Identifier that maps to a tree code. */ -struct operator_id : public id_base +class operator_id : public id_base { +public: operator_id (enum tree_code code_, const char *id_, unsigned nargs_, const char *tcc_) : id_base (id_base::CODE, id_, nargs_), code (code_), tcc (tcc_) {} @@ -404,8 +406,9 @@ struct operator_id : public id_base /* Identifier that maps to a builtin or internal function code. */ -struct fn_id : public id_base +class fn_id : public id_base { +public: fn_id (enum built_in_function fn_, const char *id_) : id_base (id_base::FN, id_), fn (fn_) {} fn_id (enum internal_fn fn_, const char *id_) @@ -417,8 +420,9 @@ struct simplify; /* Identifier that maps to a user-defined predicate. */ -struct predicate_id : public id_base +class predicate_id : public id_base { +public: predicate_id (const char *id_) : id_base (id_base::PREDICATE, id_), matchers (vNULL) {} vec matchers; @@ -426,8 +430,9 @@ struct predicate_id : public id_base /* Identifier that maps to a operator defined by a 'for' directive. */ -struct user_id : public id_base +class user_id : public id_base { +public: user_id (const char *id_, bool is_oper_list_ = false) : id_base (id_base::USER, id_), substitutes (vNULL), used (false), is_oper_list (is_oper_list_) {} @@ -665,7 +670,8 @@ struct capture_info; /* The base class for operands. */ -struct operand { +class operand { +public: enum op_type { OP_PREDICATE, OP_EXPR, OP_CAPTURE, OP_C_EXPR, OP_IF, OP_WITH }; operand (enum op_type type_, location_t loc_) : type (type_), location (loc_) {} @@ -680,8 +686,9 @@ struct operand { /* A predicate operand. Predicates are leafs in the AST. */ -struct predicate : public operand +class predicate : public operand { +public: predicate (predicate_id *p_, location_t loc) : operand (OP_PREDICATE, loc), p (p_) {} predicate_id *p; @@ -690,8 +697,9 @@ struct predicate : public operand /* An operand that constitutes an expression. Expressions include function calls and user-defined predicate invocations. */ -struct expr : public operand +class expr : public operand { +public: expr (id_base *operation_, location_t loc, bool is_commutative_ = false) : operand (OP_EXPR, loc), operation (operation_), ops (vNULL), expr_type (NULL), is_commutative (is_commutative_), @@ -723,11 +731,13 @@ struct expr : public operand a leaf operand in the AST. This class is also used to represent the code to be generated for 'if' and 'with' expressions. */ -struct c_expr : public operand +class c_expr : public operand { +public: /* A mapping of an identifier and its replacement. Used to apply 'for' lowering. */ - struct id_tab { + class id_tab { + public: const char *id; const char *oper; id_tab (const char *id_, const char *oper_): id (id_), oper (oper_) {} @@ -753,8 +763,9 @@ struct c_expr : public operand /* A wrapper around another operand that captures its value. */ -struct capture : public operand +class capture : public operand { +public: capture (location_t loc, unsigned where_, operand *what_, bool value_) : operand (OP_CAPTURE, loc), where (where_), value_match (value_), what (what_) {} @@ -773,8 +784,9 @@ struct capture : public operand /* if expression. */ -struct if_expr : public operand +class if_expr : public operand { +public: if_expr (location_t loc) : operand (OP_IF, loc), cond (NULL), trueexpr (NULL), falseexpr (NULL) {} c_expr *cond; @@ -784,8 +796,9 @@ struct if_expr : public operand /* with expression. */ -struct with_expr : public operand +class with_expr : public operand { +public: with_expr (location_t loc) : operand (OP_WITH, loc), with (NULL), subexpr (NULL) {} c_expr *with; @@ -845,8 +858,9 @@ is_a_helper ::test (operand *op) duplicates all outer 'if' and 'for' expressions here so each simplify can exist in isolation. */ -struct simplify +class simplify { +public: enum simplify_kind { SIMPLIFY, MATCH }; simplify (simplify_kind kind_, unsigned id_, operand *match_, @@ -1598,8 +1612,9 @@ static unsigned current_id; /* Decision tree base class, used for DT_NODE. */ -struct dt_node +class dt_node { +public: enum dt_type { DT_NODE, DT_OPERAND, DT_TRUE, DT_MATCH, DT_SIMPLIFY }; enum dt_type type; @@ -1634,8 +1649,9 @@ struct dt_node /* Generic decision tree node used for DT_OPERAND, DT_MATCH and DT_TRUE. */ -struct dt_operand : public dt_node +class dt_operand : public dt_node { +public: operand *op; dt_operand *match_dop; unsigned pos; @@ -1660,8 +1676,9 @@ struct dt_operand : public dt_node /* Leaf node of the decision tree, used for DT_SIMPLIFY. */ -struct dt_simplify : public dt_node +class dt_simplify : public dt_node { +public: simplify *s; unsigned pattern_no; dt_operand **indexes; @@ -1697,8 +1714,9 @@ is_a_helper ::test (dt_node *n) /* A container for the actual decision tree. */ -struct decision_tree +class decision_tree { +public: dt_node *root; void insert (struct simplify *, unsigned); @@ -2070,8 +2088,9 @@ decision_tree::print (FILE *f) on the outermost match expression operands for cases we cannot handle. */ -struct capture_info +class capture_info { +public: capture_info (simplify *s, operand *, bool); void walk_match (operand *o, unsigned toplevel_arg, bool, bool); bool walk_result (operand *o, bool, operand *); diff --git a/gcc/genoutput.c b/gcc/genoutput.c index 37ee5093809..ab4c46a51f1 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -143,8 +143,9 @@ static struct operand_data **odata_end = &null_operand.next; /* Record in this chain all information that we will output, associated with the code number of the insn. */ -struct data +class data { +public: struct data *next; const char *name; const char *template_code; @@ -179,8 +180,9 @@ static void process_template (struct data *, const char *); static void validate_insn_alternatives (struct data *); static void validate_insn_operands (struct data *); -struct constraint_data +class constraint_data { +public: struct constraint_data *next_this_letter; file_location loc; unsigned int namelen; diff --git a/gcc/genpreds.c b/gcc/genpreds.c index 19b7dcb7a30..293930c695d 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -666,8 +666,9 @@ write_one_predicate_function (struct pred_data *p) verify that there are no duplicate names. */ /* All data from one constraint definition. */ -struct constraint_data +class constraint_data { +public: struct constraint_data *next_this_letter; struct constraint_data *next_textual; const char *name; diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 90e2508fa05..a3b8e683c63 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -818,11 +818,13 @@ validate_pattern (rtx pattern, md_rtx_info *info, rtx set, int set_code) to "T *prev, *next;" and a function "void set_parent (list_head *)" to set the parent list. */ template -struct list_head +class list_head { +public: /* A range of linked items. */ - struct range + class range { + public: range (T *); range (T *, T *); @@ -1008,8 +1010,9 @@ operator != (const acceptance_type &a, const acceptance_type &b) } /* Represents a parameter to a pattern routine. */ -struct parameter +class parameter { +public: /* The C type of parameter. */ enum type_enum { /* Represents an invalid parameter. */ @@ -1069,8 +1072,9 @@ operator != (const parameter ¶m1, const parameter ¶m2) an ad-hoc enum value on success and -1 on failure. The routine can be used by any subroutine type. The match can be parameterized by things like mode, code and UNSPEC number. */ -struct pattern_routine +class pattern_routine { +public: /* The state that implements the pattern. */ state *s; @@ -1096,8 +1100,9 @@ struct pattern_routine static vec patterns; /* Represents one use of a pattern routine. */ -struct pattern_use +class pattern_use { +public: /* The pattern routine to use. */ pattern_routine *routine; @@ -1107,8 +1112,9 @@ struct pattern_use }; /* Represents a test performed by a decision. */ -struct rtx_test +class rtx_test { +public: rtx_test (); /* The types of test that can be performed. Most of them take as input @@ -1427,8 +1433,9 @@ operator != (const rtx_test &a, const rtx_test &b) /* A simple set of transition labels. Most transitions have a singleton label, so try to make that case as efficient as possible. */ -struct int_set : public auto_vec +class int_set : public auto_vec { +public: typedef uint64_t *iterator; int_set (); @@ -1496,8 +1503,9 @@ struct decision; /* Represents a transition between states, dependent on the result of a test T. */ -struct transition +class transition { +public: transition (const int_set &, state *, bool); void set_parent (list_head *); @@ -1536,8 +1544,9 @@ struct transition to the transition's target state. If no suitable transition exists, the machine either falls through to the next decision or, if there are no more decisions to try, fails the match. */ -struct decision : list_head +class decision : public list_head { +public: decision (const rtx_test &); void set_parent (list_head *s); @@ -1556,8 +1565,9 @@ struct decision : list_head /* Represents one machine state. For each state the machine tries a list of decisions, in order, and acts on the first match. It fails without further backtracking if no decisions match. */ -struct state : list_head +class state : public list_head { +public: void set_parent (list_head *) {} }; @@ -1767,8 +1777,9 @@ const unsigned char TESTED_CODE = 1; const unsigned char TESTED_VECLEN = 2; /* Represents a set of conditions that are known to hold. */ -struct known_conditions +class known_conditions { +public: /* A mask of TESTED_ values for each position, indexed by the position's id field. */ auto_vec position_tests; @@ -2095,8 +2106,9 @@ find_operand_positions (state *s, vec &operand_pos) } /* Statistics about a matching routine. */ -struct stats +class stats { +public: stats (); /* The total number of decisions in the routine, excluding trivial @@ -2235,8 +2247,9 @@ optimize_subroutine_group (const char *type, state *root) struct merge_pattern_info; /* Represents a transition from one pattern to another. */ -struct merge_pattern_transition +class merge_pattern_transition { +public: merge_pattern_transition (merge_pattern_info *); /* The target pattern. */ @@ -2256,8 +2269,9 @@ merge_pattern_transition::merge_pattern_transition (merge_pattern_info *to_in) /* Represents a pattern that can might match several states. The pattern may replace parts of the test with a parameter value. It may also replace transition labels with parameters. */ -struct merge_pattern_info +class merge_pattern_info { +public: merge_pattern_info (unsigned int); /* If PARAM_TEST_P, the state's singleton test should be generalized @@ -2329,8 +2343,9 @@ merge_pattern_info::merge_pattern_info (unsigned int num_transitions) /* Describes one way of matching a particular state to a particular pattern. */ -struct merge_state_result +class merge_state_result { +public: merge_state_result (merge_pattern_info *, position *, merge_state_result *); /* A pattern that matches the state. */ @@ -2360,8 +2375,9 @@ merge_state_result::merge_state_result (merge_pattern_info *pattern_in, /* Information about a state, used while trying to match it against a pattern. */ -struct merge_state_info +class merge_state_info { +public: merge_state_info (state *); /* The state itself. */ @@ -3860,7 +3876,8 @@ merge_into_state (state *s1, state *s2) /* Pairs a pattern that needs to be matched with the rtx position at which the pattern should occur. */ -struct pattern_pos { +class pattern_pos { +public: pattern_pos () {} pattern_pos (rtx, position *); @@ -4384,8 +4401,9 @@ enum exit_state { /* Information used while writing out code. */ -struct output_state +class output_state { +public: /* The type of routine that we're generating. */ routine_type type; diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 0150346d409..07aa8391f28 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -65,8 +65,9 @@ static htab_t condition_table; define_cond_exec and define_subst patterns, then return them one at a time. */ -struct queue_elem +class queue_elem { +public: rtx data; file_location loc; struct queue_elem *next; diff --git a/gcc/gensupport.h b/gcc/gensupport.h index 5c432036e6a..10a5c7a9073 100644 --- a/gcc/gensupport.h +++ b/gcc/gensupport.h @@ -26,7 +26,8 @@ struct obstack; extern struct obstack *rtl_obstack; /* Information about an .md define_* rtx. */ -struct md_rtx_info { +class md_rtx_info { +public: /* The rtx itself. */ rtx def; diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 6fb5a3d5ceb..0968d9769fa 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -818,8 +818,9 @@ init_ggc_heuristics (void) } /* GGC memory usage. */ -struct ggc_usage: public mem_usage +class ggc_usage: public mem_usage { +public: /* Default constructor. */ ggc_usage (): m_freed (0), m_collected (0), m_overhead (0) {} /* Constructor. */ diff --git a/gcc/ggc-tests.c b/gcc/ggc-tests.c index 752f4467999..1ea5e4cfc10 100644 --- a/gcc/ggc-tests.c +++ b/gcc/ggc-tests.c @@ -176,8 +176,9 @@ test_union () /* Verify that destructors get run when instances are collected. */ -struct GTY(()) test_struct_with_dtor +class GTY(()) test_struct_with_dtor { +public: /* This struct has a destructor; it *ought* to be called by the ggc machinery when instances are collected. */ ~test_struct_with_dtor () { dtor_call_count++; } diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc index b188ce86d5e..1324489e85a 100644 --- a/gcc/gimple-loop-interchange.cc +++ b/gcc/gimple-loop-interchange.cc @@ -172,8 +172,9 @@ dump_induction (struct loop *loop, induction_p iv) /* Loop candidate for interchange. */ -struct loop_cand +class loop_cand { +public: loop_cand (struct loop *, struct loop *); ~loop_cand (); diff --git a/gcc/gimple-loop-versioning.cc b/gcc/gimple-loop-versioning.cc index fe273001423..468f5860d69 100644 --- a/gcc/gimple-loop-versioning.cc +++ b/gcc/gimple-loop-versioning.cc @@ -179,8 +179,9 @@ struct address_term_info /* Information about an address calculation, and the range of constant offsets applied to it. */ -struct address_info +class address_info { +public: static const unsigned int MAX_TERMS = 8; /* One statement that calculates the address. If multiple statements @@ -210,8 +211,9 @@ struct address_info_hasher : nofree_ptr_hash }; /* Information about the versioning we'd like to apply to a loop. */ -struct loop_info +class loop_info { +public: bool worth_versioning_p () const; /* True if we've decided not to version this loop. The remaining diff --git a/gcc/gimple-match.h b/gcc/gimple-match.h index ad7f73040f1..ea0f66f06b1 100644 --- a/gcc/gimple-match.h +++ b/gcc/gimple-match.h @@ -43,8 +43,9 @@ private: /* Represents the condition under which an operation should happen, and the value to use otherwise. The condition applies elementwise (as for VEC_COND_EXPR) if the values are vectors. */ -struct gimple_match_cond +class gimple_match_cond { +public: enum uncond { UNCOND }; /* Build an unconditional op. */ @@ -79,8 +80,9 @@ gimple_match_cond::any_else () const /* Represents an operation to be simplified, or the result of the simplification. */ -struct gimple_match_op +class gimple_match_op { +public: gimple_match_op (); gimple_match_op (const gimple_match_cond &, code_helper, tree, unsigned int); gimple_match_op (const gimple_match_cond &, diff --git a/gcc/gimple-ssa-backprop.c b/gcc/gimple-ssa-backprop.c index 30fb7cbc96b..0aeac4e1c4c 100644 --- a/gcc/gimple-ssa-backprop.c +++ b/gcc/gimple-ssa-backprop.c @@ -107,8 +107,9 @@ along with GCC; see the file COPYING3. If not see namespace { /* Information about a group of uses of an SSA name. */ -struct usage_info +class usage_info { +public: usage_info () : flag_word (0) {} usage_info &operator &= (const usage_info &); usage_info operator & (const usage_info &) const; diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index a0934bcaf87..6ba3d86f211 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -520,8 +520,9 @@ enum format_lengths /* Description of the result of conversion either of a single directive or the whole format string. */ -struct fmtresult +class fmtresult { +public: /* Construct a FMTRESULT object with all counters initialized to MIN. KNOWNRANGE is set when MIN is valid. */ fmtresult (unsigned HOST_WIDE_INT min = HOST_WIDE_INT_MAX) diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c index 5a93830ab4b..1f50e3af03e 100644 --- a/gcc/gimple-ssa-store-merging.c +++ b/gcc/gimple-ssa-store-merging.c @@ -1324,8 +1324,9 @@ namespace { and the other fields also reflect the memory load, or an SSA name, then VAL represents the SSA name and all the other fields are zero, */ -struct store_operand_info +class store_operand_info { +public: tree val; tree base_addr; poly_uint64 bitsize; @@ -1347,8 +1348,9 @@ store_operand_info::store_operand_info () to memory. These are created in the first phase and coalesced into merged_store_group objects in the second phase. */ -struct store_immediate_info +class store_immediate_info { +public: unsigned HOST_WIDE_INT bitsize; unsigned HOST_WIDE_INT bitpos; unsigned HOST_WIDE_INT bitregion_start; @@ -1413,8 +1415,9 @@ store_immediate_info::store_immediate_info (unsigned HOST_WIDE_INT bs, These are produced by the second phase (coalescing) and consumed in the third phase that outputs the widened stores. */ -struct merged_store_group +class merged_store_group { +public: unsigned HOST_WIDE_INT start; unsigned HOST_WIDE_INT width; unsigned HOST_WIDE_INT bitregion_start; @@ -2083,8 +2086,9 @@ merged_store_group::apply_stores () /* Structure describing the store chain. */ -struct imm_store_chain_info +class imm_store_chain_info { +public: /* Doubly-linked list that imposes an order on chain processing. PNXP (prev's next pointer) points to the head of a list, or to the next field in the previous chain in the list. @@ -3064,8 +3068,9 @@ get_location_for_stmts (vec &stmts) /* Used to decribe a store resulting from splitting a wide store in smaller regularly-sized stores in split_group. */ -struct split_store +class split_store { +public: unsigned HOST_WIDE_INT bytepos; unsigned HOST_WIDE_INT size; unsigned HOST_WIDE_INT align; diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index bfda44a1028..aa5a8567a1b 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -226,8 +226,9 @@ enum cand_kind CAND_PHI }; -struct slsr_cand_d +class slsr_cand_d { +public: /* The candidate statement S1. */ gimple *cand_stmt; @@ -329,8 +330,9 @@ typedef const struct cand_chain_d *const_cand_chain_t; of the cost of initializers. The absolute value of the increment is stored in the incr_info. */ -struct incr_info_d +class incr_info_d { +public: /* The increment that relates a candidate to its basis. */ widest_int incr; diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c index d8041461336..73726c1a670 100644 --- a/gcc/gimple-ssa-warn-alloca.c +++ b/gcc/gimple-ssa-warn-alloca.c @@ -118,7 +118,8 @@ enum alloca_type { }; // Type of an alloca call with its corresponding limit, if applicable. -struct alloca_type_and_limit { +class alloca_type_and_limit { +public: enum alloca_type type; // For ALLOCA_BOUND_MAYBE_LARGE and ALLOCA_BOUND_DEFINITELY_LARGE // types, this field indicates the assumed limit if known or diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c index 0c571efb666..64175f258ae 100644 --- a/gcc/gimple-ssa-warn-restrict.c +++ b/gcc/gimple-ssa-warn-restrict.c @@ -124,8 +124,9 @@ pass_wrestrict::execute (function *fun) /* Description of a memory reference by a built-in function. This is similar to ao_ref but made especially suitable for -Wrestrict and not for optimization. */ -struct builtin_memref +class builtin_memref { +public: /* The original pointer argument to the built-in function. */ tree ptr; /* The referenced subobject or NULL if not available, and the base diff --git a/gcc/godump.c b/gcc/godump.c index 617a96486cd..39cce5e6b36 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -535,8 +535,9 @@ go_type_decl (tree decl, int local) /* A container for the data we pass around when generating information at the end of the compilation. */ -struct godump_container +class godump_container { +public: /* DECLs that we have already seen. */ hash_set decls_seen; diff --git a/gcc/hash-map-tests.c b/gcc/hash-map-tests.c index 5888f259b20..f3b216be07c 100644 --- a/gcc/hash-map-tests.c +++ b/gcc/hash-map-tests.c @@ -103,8 +103,9 @@ test_map_of_strings_to_int () ASSERT_EQ (1, string_map.elements ()); } -typedef struct hash_map_test_val_t +typedef class hash_map_test_val_t { +public: static int ndefault; static int ncopy; static int nassign; diff --git a/gcc/hash-map.h b/gcc/hash-map.h index f3f1f9a89ff..ba20fe79f23 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -253,7 +253,8 @@ public: /* Can't use std::pair here, because GCC before 4.3 don't handle std::pair where template parameters are references well. See PR86739. */ - struct reference_pair { + class reference_pair { + public: const Key &first; Value &second; diff --git a/gcc/hash-set-tests.c b/gcc/hash-set-tests.c index c96fe538d9f..ce59059bee1 100644 --- a/gcc/hash-set-tests.c +++ b/gcc/hash-set-tests.c @@ -134,8 +134,9 @@ test_set_of_strings () ASSERT_EQ (2, t.elements ()); } -typedef struct hash_set_test_value_t +typedef class hash_set_test_value_t { +public: static int ndefault; static int ncopy; static int nassign; diff --git a/gcc/hsa-brig.c b/gcc/hsa-brig.c index 016e61f7d6a..424eac7ef47 100644 --- a/gcc/hsa-brig.c +++ b/gcc/hsa-brig.c @@ -195,8 +195,9 @@ hash_table *hsa_emitted_internal_decls; /* List of sbr instructions. */ static vec *switch_instructions; -struct function_linkage_pair +class function_linkage_pair { +public: function_linkage_pair (tree decl, unsigned int off) : function_decl (decl), offset (off) {} diff --git a/gcc/hsa-common.h b/gcc/hsa-common.h index 9c61786a78c..121c4eab8e7 100644 --- a/gcc/hsa-common.h +++ b/gcc/hsa-common.h @@ -55,8 +55,9 @@ class hsa_bb; /* Class representing an input argument, output argument (result) or a variable, that will eventually end up being a symbol directive. */ -struct hsa_symbol +class hsa_symbol { +public: /* Constructor. */ hsa_symbol (BrigType16_t type, BrigSegment8_t segment, BrigLinkage8_t linkage, bool global_scope_p = false, @@ -1213,8 +1214,9 @@ enum hsa_function_kind HSA_FUNCTION }; -struct hsa_function_summary +class hsa_function_summary { +public: /* Default constructor. */ hsa_function_summary (); diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index f52c49c3fa2..54d98a5f507 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -6213,8 +6213,9 @@ transformable_switch_to_sbr_p (gswitch *s) /* Structure hold connection between PHI nodes and immediate values hold by there nodes. */ -struct phi_definition +class phi_definition { +public: phi_definition (unsigned phi_i, unsigned label_i, tree imm): phi_index (phi_i), label_index (label_i), phi_value (imm) {} diff --git a/gcc/input.c b/gcc/input.c index 1e84d2ee2d1..baab42af9ae 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -32,11 +32,13 @@ along with GCC; see the file COPYING3. If not see /* This is a cache used by get_next_line to store the content of a file to be searched for file lines. */ -struct fcache +class fcache { +public: /* These are information used to store a line boundary. */ - struct line_info + class line_info { + public: /* The line number. It starts from 1. */ size_t line_num; @@ -1691,8 +1693,9 @@ assert_loceq (const char *exp_filename, int exp_linenum, int exp_colnum, The following struct describes a particular case within our test matrix. */ -struct line_table_case +class line_table_case { +public: line_table_case (int default_range_bits, int base_location) : m_default_range_bits (default_range_bits), m_base_location (base_location) @@ -2085,8 +2088,9 @@ class cpp_reader_ptr /* A struct for writing lexer tests. */ -struct lexer_test +class lexer_test { +public: lexer_test (const line_table_case &case_, const char *content, lexer_test_options *options); ~lexer_test (); diff --git a/gcc/input.h b/gcc/input.h index 3c7cf3673a4..3e038207bd0 100644 --- a/gcc/input.h +++ b/gcc/input.h @@ -175,8 +175,9 @@ void diagnostics_file_cache_fini (void); void diagnostics_file_cache_forcibly_evict_file (const char *file_path); -struct GTY(()) string_concat +class GTY(()) string_concat { +public: string_concat (int num, location_t *locs); int m_num; diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index b6e781f7450..e62a9a03ef9 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -130,7 +130,7 @@ template class ipcp_value; /* Describes a particular source for an IPA-CP value. */ template -class ipcp_value_source +struct ipcp_value_source { public: /* Aggregate offset of the source, negative if the source is scalar value of @@ -209,7 +209,7 @@ public: contains_variable flag should be disregarded. */ template -class ipcp_lattice +struct ipcp_lattice { public: /* The list of known values and types in this lattice. Note that values are @@ -236,7 +236,7 @@ public: /* Lattice of tree values with an offset to describe a part of an aggregate. */ -class ipcp_agg_lattice : public ipcp_lattice +struct ipcp_agg_lattice : public ipcp_lattice { public: /* Offset that is being described by this lattice. */ @@ -3385,8 +3385,9 @@ static call_summary *edge_clone_summaries = NULL; /* Edge clone summary. */ -struct edge_clone_summary +class edge_clone_summary { +public: /* Default constructor. */ edge_clone_summary (): prev_clone (NULL), next_clone (NULL) {} diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 252d9206181..a5e3a63b66d 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -2626,8 +2626,9 @@ possible_polymorphic_call_targets_1 (vec &nodes, polymorphic calls in the program, so we memoize all the previous queries and avoid duplicated work. */ -struct polymorphic_call_target_d +class polymorphic_call_target_d { +public: HOST_WIDE_INT otr_token; ipa_polymorphic_call_context context; odr_type type; @@ -2949,8 +2950,9 @@ struct decl_warn_count /* Information about type and decl warnings. */ -struct final_warning_record +class final_warning_record { +public: /* If needed grow type_warnings vector and initialize new decl_warn_count to have dyn_count set to profile_count::zero (). */ void grow_type_warnings (unsigned newlen); diff --git a/gcc/ipa-fnsummary.h b/gcc/ipa-fnsummary.h index 0f08e84ed53..7b077042b8e 100644 --- a/gcc/ipa-fnsummary.h +++ b/gcc/ipa-fnsummary.h @@ -72,8 +72,9 @@ struct agg_position_info /* Representation of function body size and time depending on the call context. We keep simple array of record, every containing of predicate and time/size to account. */ -struct GTY(()) size_time_entry +class GTY(()) size_time_entry { +public: /* Predicate for code to be executed. */ predicate exec_predicate; /* Predicate for value to be constant and optimized out in a specialized copy. @@ -85,8 +86,9 @@ struct GTY(()) size_time_entry }; /* Function inlining information. */ -struct GTY(()) ipa_fn_summary +class GTY(()) ipa_fn_summary { +public: /* Keep all field empty so summary dumping works during its computation. This is useful for debugging. */ ipa_fn_summary () @@ -205,8 +207,9 @@ extern GTY(()) fast_function_summary *ipa_fn_summaries; /* Information kept about callgraph edges. */ -struct ipa_call_summary +class ipa_call_summary { +public: /* Keep all field empty so summary dumping works during its computation. This is useful for debugging. */ ipa_call_summary () diff --git a/gcc/ipa-inline.h b/gcc/ipa-inline.h index f6eb677d618..18c8e1eebd0 100644 --- a/gcc/ipa-inline.h +++ b/gcc/ipa-inline.h @@ -23,8 +23,9 @@ along with GCC; see the file COPYING3. If not see /* Data we cache about callgraph edges during inlining to avoid expensive re-computations during the greedy algorithm. */ -struct edge_growth_cache_entry +class edge_growth_cache_entry { +public: sreal time, nonspec_time; int size; ipa_hints hints; diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 7257a6d04f1..7605911f701 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -144,8 +144,9 @@ struct GTY(()) ipa_agg_jump_function typedef struct ipa_agg_jump_function *ipa_agg_jump_function_p; /* Information about zero/non-zero bits. */ -struct GTY(()) ipa_bits +class GTY(()) ipa_bits { +public: /* The propagated value. */ widest_int value; /* Mask corresponding to the value. @@ -156,8 +157,9 @@ struct GTY(()) ipa_bits /* Info about value ranges. */ -struct GTY(()) ipa_vr +class GTY(()) ipa_vr { +public: /* The data fields below are valid only if known is true. */ bool known; enum value_range_kind type; @@ -319,8 +321,9 @@ struct GTY(()) ipa_param_descriptor and some other information for interprocedural passes that operate on parameters (such as ipa-cp). */ -struct GTY((for_user)) ipa_node_params +class GTY((for_user)) ipa_node_params { +public: /* Default constructor. */ ipa_node_params (); diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 5eaf8257f98..44ae2c7d077 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -108,8 +108,9 @@ along with GCC; see the file COPYING3. If not see /* Per basic block info. */ -struct split_bb_info +class split_bb_info { +public: unsigned int size; sreal time; }; @@ -118,8 +119,9 @@ static vec bb_info_vec; /* Description of split point. */ -struct split_point +class split_point { +public: /* Size of the partitions. */ sreal header_time, split_time; unsigned int header_size, split_size; @@ -979,8 +981,9 @@ visit_bb (basic_block bb, basic_block return_bb, /* Stack entry for recursive DFS walk in find_split_point. */ -struct stack_entry +class stack_entry { +public: /* Basic block we are examining. */ basic_block bb; diff --git a/gcc/ira-int.h b/gcc/ira-int.h index 1ea35f7e364..08848f0e817 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -597,8 +597,9 @@ extern int ira_copies_num; /* The following structure describes a stack slot used for spilled pseudo-registers. */ -struct ira_spilled_reg_stack_slot +class ira_spilled_reg_stack_slot { +public: /* pseudo-registers assigned to the stack slot. */ bitmap_head spilled_regs; /* RTL representation of the stack slot. */ @@ -774,7 +775,8 @@ minmax_set_iter_next (minmax_set_iterator *i) minmax_set_iter_cond (&(ITER), &(N)); \ minmax_set_iter_next (&(ITER))) -struct target_ira_int { +class target_ira_int { +public: ~target_ira_int (); void free_ira_costs (); diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index b880ead3d15..4fc73d4917b 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -58,8 +58,9 @@ along with GCC; see the file COPYING3. If not see /* The data stored for the loop. */ -struct loop_data +class loop_data { +public: struct loop *outermost_exit; /* The outermost exit of the loop. */ bool has_call; /* True if the loop contains a call. */ /* Maximal register pressure inside loop for given register class diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 207b5e2bfa3..f078a68d8bf 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -85,8 +85,9 @@ enum iv_grd_result /* Information about a biv. */ -struct biv_entry +class biv_entry { +public: unsigned regno; /* The register of the biv. */ struct rtx_iv iv; /* Value of the biv. */ }; diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c index 051839a2717..e583bca4261 100644 --- a/gcc/lra-eliminations.c +++ b/gcc/lra-eliminations.c @@ -71,8 +71,9 @@ along with GCC; see the file COPYING3. If not see /* This structure is used to record information about hard register eliminations. */ -struct lra_elim_table +class lra_elim_table { +public: /* Hard register number to be eliminated. */ int from; /* Hard register number used as replacement. */ diff --git a/gcc/lra-int.h b/gcc/lra-int.h index d0a8facc50e..cc47c4daba2 100644 --- a/gcc/lra-int.h +++ b/gcc/lra-int.h @@ -64,8 +64,9 @@ struct lra_copy }; /* Common info about a register (pseudo or hard register). */ -struct lra_reg +class lra_reg { +public: /* Bitmap of UIDs of insns (including debug insns) referring the reg. */ bitmap_head insn_bitmap; @@ -210,8 +211,9 @@ struct lra_static_insn_data /* LRA internal info about an insn (LRA internal insn representation). */ -struct lra_insn_recog_data +class lra_insn_recog_data { +public: /* The insn code. */ int icode; /* The alternative should be used for the insn, LRA_UNKNOWN_ALT if diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c index 55b2adc2a5b..975e5230a91 100644 --- a/gcc/lra-lives.c +++ b/gcc/lra-lives.c @@ -384,8 +384,9 @@ mark_regno_dead (int regno, machine_mode mode) /* Structure describing local BB data used for pseudo live-analysis. */ -struct bb_data_pseudos +class bb_data_pseudos { +public: /* Basic block about which the below data are. */ basic_block bb; bitmap_head killed_pseudos; /* pseudos killed in the BB. */ diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c index 10838116143..51d3543efdc 100644 --- a/gcc/lra-remat.c +++ b/gcc/lra-remat.c @@ -124,8 +124,9 @@ static cand_t *regno_cands; /* Data about basic blocks used for the rematerialization sub-pass. */ -struct remat_bb_data +class remat_bb_data { +public: /* Basic block about which the below data are. */ basic_block bb; /* Registers changed in the basic block: */ diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index c19b76a579c..5db94dc8629 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -97,8 +97,9 @@ static struct pseudo_slot *pseudo_slots; /* The structure describes a register or a stack slot which can be used for several spilled pseudos. */ -struct slot +class slot { +public: /* First pseudo with given stack slot. */ int regno; /* Hard reg into which the slot pseudos are spilled. The value is diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index f1593d64c71..d5dbeb73b32 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -735,8 +735,9 @@ struct output_block /* Data and descriptors used when reading from an LTO file. */ -struct data_in +class data_in { +public: /* The global decls and types. */ struct lto_file_decl_data *file_data; diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 871598cae51..f3796f56b77 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2019-07-09 Martin Sebor + + PR c++/61339 + * lto-dump.c: Change class-key from class to struct and vice versa + to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. + 2019-07-04 Martin Liska PR lto/91078 diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c index e9de33cf5d8..262f9f24d85 100644 --- a/gcc/lto/lto-dump.c +++ b/gcc/lto/lto-dump.c @@ -38,8 +38,9 @@ along with GCC; see the file COPYING3. If not see /* Stores details of symbols for dumping symbol list. */ -struct symbol_entry +class symbol_entry { +public: symtab_node *node; symbol_entry (symtab_node *node_): node (node_) {} @@ -70,8 +71,9 @@ struct symbol_entry /* Stores variable specific details of symbols for dumping symbol list. */ -struct variable_entry: public symbol_entry +class variable_entry: public symbol_entry { +public: variable_entry (varpool_node *node_): symbol_entry (node_) {} @@ -100,8 +102,9 @@ struct variable_entry: public symbol_entry /* Stores function specific details of symbols for dumping symbol list. */ -struct function_entry: public symbol_entry +class function_entry: public symbol_entry { +public: function_entry (cgraph_node *node_): symbol_entry (node_) {} diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h index 77960595753..9ceb9ccc55b 100644 --- a/gcc/mem-stats.h +++ b/gcc/mem-stats.h @@ -31,8 +31,9 @@ class hash_map; #define LOCATION_LINE_WIDTH 48 /* Memory allocation location. */ -struct mem_location +class mem_location { +public: /* Default constructor. */ inline mem_location () {} @@ -123,8 +124,9 @@ struct mem_location }; /* Memory usage register to a memory location. */ -struct mem_usage +class mem_usage { +public: /* Default constructor. */ mem_usage (): m_allocated (0), m_times (0), m_peak (0), m_instances (1) {} @@ -260,8 +262,9 @@ struct mem_usage /* Memory usage pair that connectes memory usage and number of allocated bytes. */ template -struct mem_usage_pair +class mem_usage_pair { +public: mem_usage_pair (T *usage_, size_t allocated_): usage (usage_), allocated (allocated_) {} diff --git a/gcc/omp-grid.c b/gcc/omp-grid.c index 1ff65aa160c..898d73f8a60 100644 --- a/gcc/omp-grid.c +++ b/gcc/omp-grid.c @@ -83,8 +83,9 @@ omp_grid_lastprivate_predicate (struct omp_for_data *fd) /* Structure describing the basic properties of the loop we ara analyzing whether it can be gridified and when it is gridified. */ -struct grid_prop +class grid_prop { +public: /* True when we are doing tiling gridification, i.e. when there is a distinct distribute loop over groups and a loop construct over work-items. False when distribute and parallel for loops form a combined construct. */ diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 3fe466fae03..a855c5b2f8b 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -3777,7 +3777,8 @@ omp_clause_aligned_alignment (tree clause) /* This structure is part of the interface between lower_rec_simd_input_clauses and lower_rec_input_clauses. */ -struct omplow_simd_context { +class omplow_simd_context { +public: omplow_simd_context () { memset (this, 0, sizeof (*this)); } tree idx; tree lane; diff --git a/gcc/optabs-query.h b/gcc/optabs-query.h index b0f50a9eb0f..d998fcaf7db 100644 --- a/gcc/optabs-query.h +++ b/gcc/optabs-query.h @@ -144,8 +144,9 @@ get_vcond_eq_icode (machine_mode vmode, machine_mode cmode) enum extraction_pattern { EP_insv, EP_extv, EP_extzv }; /* Describes an instruction that inserts or extracts a bitfield. */ -struct extraction_insn +class extraction_insn { +public: /* The code of the instruction. */ enum insn_code icode; diff --git a/gcc/optabs.h b/gcc/optabs.h index 17b5dfb67fd..ca7e06366f3 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -41,7 +41,8 @@ enum expand_operand_type { }; /* Information about an operand for instruction expansion. */ -struct expand_operand { +class expand_operand { +public: /* The type of operand. */ ENUM_BITFIELD (expand_operand_type) type : 8; diff --git a/gcc/opts.c b/gcc/opts.c index b38bfb15a56..46a19a27887 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1282,8 +1282,9 @@ wrap_help (const char *help, /* Data structure used to print list of valid option values. */ -struct option_help_tuple +class option_help_tuple { +public: option_help_tuple (int code, vec values): m_code (code), m_values (values) {} @@ -1801,8 +1802,9 @@ const struct sanitizer_opts_s coverage_sanitizer_opts[] = /* A struct for describing a run of chars within a string. */ -struct string_fragment +class string_fragment { +public: string_fragment (const char *start, size_t len) : m_start (start), m_len (len) {} diff --git a/gcc/poly-int.h b/gcc/poly-int.h index d68a652b5fa..635f1ebeef6 100644 --- a/gcc/poly-int.h +++ b/gcc/poly-int.h @@ -335,7 +335,7 @@ struct poly_result /* A base POD class for polynomial integers. The polynomial has N coefficients of type C. */ template -class poly_int_pod +struct poly_int_pod { public: template diff --git a/gcc/predict.c b/gcc/predict.c index ad19d1295e0..766f418aa69 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -3236,8 +3236,9 @@ predict_paths_leading_to_edge (edge e, enum br_predictor pred, /* This is used to carry information about basic blocks. It is attached to the AUX field of the standard CFG block. */ -struct block_info +class block_info { +public: /* Estimated frequency of execution of basic_block. */ sreal frequency; @@ -3249,8 +3250,9 @@ struct block_info }; /* Similar information for edges. */ -struct edge_prob_info +class edge_prob_info { +public: /* In case edge is a loopback edge, the probability edge will be reached in case header is. Estimated number of iterations of the loop can be then computed as 1 / (1 - back_edge_prob). */ diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index e4df6590719..2d03b3f9e8d 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -74,8 +74,9 @@ struct chunk_info /* The output buffer datatype. This is best seen as an abstract datatype whose fields should not be accessed directly by clients. */ -struct output_buffer +class output_buffer { +public: output_buffer (); ~output_buffer (); @@ -214,8 +215,9 @@ class format_postprocessor /* The data structure that contains the bare minimum required to do proper pretty-printing. Clients may derived from this structure and add additional fields they need. */ -struct pretty_printer +class pretty_printer { +public: /* Default construct a pretty printer with specified maximum line length cut off limit. */ explicit pretty_printer (int = 0); diff --git a/gcc/profile-count.h b/gcc/profile-count.h index cbab5965ed6..e584aab641f 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -676,7 +676,7 @@ public: class sreal; -class GTY(()) profile_count +struct GTY(()) profile_count { public: /* Use 62bit to hold basic block counters. Should be at least diff --git a/gcc/read-md.h b/gcc/read-md.h index 327f378eac0..9cb75694ffe 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -23,7 +23,8 @@ along with GCC; see the file COPYING3. If not see #include "obstack.h" /* Records a position in the file. */ -struct file_location { +class file_location { +public: file_location () {} file_location (const char *, int, int); diff --git a/gcc/read-rtl-function.c b/gcc/read-rtl-function.c index 3cf34ba99a8..f41f54a0d4a 100644 --- a/gcc/read-rtl-function.c +++ b/gcc/read-rtl-function.c @@ -52,8 +52,9 @@ class fixup; at LOC, which will be turned into an actual CFG edge once the "insn-chain" is fully parsed. */ -struct deferred_edge +class deferred_edge { +public: deferred_edge (file_location loc, int src_bb_idx, int dest_bb_idx, int flags) : m_loc (loc), m_src_bb_idx (src_bb_idx), m_dest_bb_idx (dest_bb_idx), m_flags (flags) diff --git a/gcc/ree.c b/gcc/ree.c index 104f8dbf435..c63e1591ae3 100644 --- a/gcc/ree.c +++ b/gcc/ree.c @@ -579,8 +579,9 @@ struct ATTRIBUTE_PACKED ext_modified }; /* Vectors used by combine_reaching_defs and its helpers. */ -struct ext_state +class ext_state { +public: /* In order to avoid constant alloc/free, we keep these 4 vectors live through the entire find_and_remove_re and just truncate them each time. */ diff --git a/gcc/reginfo.c b/gcc/reginfo.c index bec2d40fe95..4832affd436 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -50,8 +50,9 @@ int max_regno; /* Used to cache the results of simplifiable_subregs. SHAPE is the input parameter and SIMPLIFIABLE_REGS is the result. */ -struct simplifiable_subreg +class simplifiable_subreg { +public: simplifiable_subreg (const subreg_shape &); subreg_shape shape; diff --git a/gcc/regrename.c b/gcc/regrename.c index 5259d565e58..7dbbeb91a6d 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -547,8 +547,9 @@ struct incoming_reg_info { A pointer to such a structure is stored in each basic block's aux field during regrename_analyze, except for blocks we know can't be optimized (such as entry and exit blocks). */ -struct bb_rename_info +class bb_rename_info { +public: /* The basic block corresponding to this structure. */ basic_block bb; /* Copies of the global information. */ diff --git a/gcc/regrename.h b/gcc/regrename.h index 37f5e398ded..e9f28236cde 100644 --- a/gcc/regrename.h +++ b/gcc/regrename.h @@ -22,8 +22,9 @@ along with GCC; see the file COPYING3. If not see /* We keep linked lists of DU_HEAD structures, each of which describes a chain of occurrences of a reg. */ -struct du_head +class du_head { +public: /* The next chain. */ struct du_head *next_chain; /* The first and last elements of this chain. */ diff --git a/gcc/reload.h b/gcc/reload.h index 813075b6f00..edfeebfff0e 100644 --- a/gcc/reload.h +++ b/gcc/reload.h @@ -278,8 +278,9 @@ extern int num_not_at_initial_offset; /* This structure describes instructions which are relevant for reload. Apart from all regular insns, this also includes CODE_LABELs, since they must be examined for register elimination. */ -struct insn_chain +class insn_chain { +public: /* Links to the neighbor instructions. */ struct insn_chain *next, *prev; diff --git a/gcc/rtl-iter.h b/gcc/rtl-iter.h index e48ae4f8bfe..ba5e692f70c 100644 --- a/gcc/rtl-iter.h +++ b/gcc/rtl-iter.h @@ -56,8 +56,9 @@ class generic_subrtx_iterator typedef typename T::rtunion_type rtunion_type; public: - struct array_type + class array_type { + public: array_type (); ~array_type (); value_type stack[LOCAL_ELEMS]; diff --git a/gcc/rtl.h b/gcc/rtl.h index a4fde4ed8e5..ad2f3cd5de6 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -145,8 +145,9 @@ struct addr_diff_vec_flags /* Structure used to describe the attributes of a MEM. These are hashed so MEMs that the same attributes share a data structure. This means they cannot be modified in place. */ -struct GTY(()) mem_attrs +class GTY(()) mem_attrs { +public: mem_attrs (); /* The expression that the MEM accesses, or null if not known. @@ -187,7 +188,8 @@ struct GTY(()) mem_attrs object in the low part of a 4-byte register, the OFFSET field will be -3 rather than 0. */ -struct GTY((for_user)) reg_attrs { +class GTY((for_user)) reg_attrs { +public: tree decl; /* decl corresponding to REG. */ poly_int64 offset; /* Offset from start of DECL. */ }; @@ -449,8 +451,9 @@ struct GTY((desc("0"), tag("0"), /* A node for constructing singly-linked lists of rtx. */ -class GTY(()) rtx_expr_list : public rtx_def +struct GTY(()) rtx_expr_list : public rtx_def { +private: /* No extra fields, but adds invariant: (GET_CODE (X) == EXPR_LIST). */ public: @@ -469,8 +472,9 @@ is_a_helper ::test (rtx rt) return rt->code == EXPR_LIST; } -class GTY(()) rtx_insn_list : public rtx_def +struct GTY(()) rtx_insn_list : public rtx_def { +private: /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST). This is an instance of: @@ -501,8 +505,9 @@ is_a_helper ::test (rtx rt) /* A node with invariant GET_CODE (X) == SEQUENCE i.e. a vector of rtx, typically (but not always) of rtx_insn *, used in the late passes. */ -class GTY(()) rtx_sequence : public rtx_def +struct GTY(()) rtx_sequence : public rtx_def { +private: /* No extra fields, but adds invariant: (GET_CODE (X) == SEQUENCE). */ public: @@ -533,7 +538,7 @@ is_a_helper ::test (const_rtx rt) return rt->code == SEQUENCE; } -class GTY(()) rtx_insn : public rtx_def +struct GTY(()) rtx_insn : public rtx_def { public: /* No extra fields, but adds the invariant: @@ -567,7 +572,7 @@ public: /* Subclasses of rtx_insn. */ -class GTY(()) rtx_debug_insn : public rtx_insn +struct GTY(()) rtx_debug_insn : public rtx_insn { /* No extra fields, but adds the invariant: DEBUG_INSN_P (X) aka (GET_CODE (X) == DEBUG_INSN) @@ -578,7 +583,7 @@ class GTY(()) rtx_debug_insn : public rtx_insn from rtl.def. */ }; -class GTY(()) rtx_nonjump_insn : public rtx_insn +struct GTY(()) rtx_nonjump_insn : public rtx_insn { /* No extra fields, but adds the invariant: NONJUMP_INSN_P (X) aka (GET_CODE (X) == INSN) @@ -589,7 +594,7 @@ class GTY(()) rtx_nonjump_insn : public rtx_insn from rtl.def. */ }; -class GTY(()) rtx_jump_insn : public rtx_insn +struct GTY(()) rtx_jump_insn : public rtx_insn { public: /* No extra fields, but adds the invariant: @@ -616,7 +621,7 @@ public: inline void set_jump_target (rtx_code_label *); }; -class GTY(()) rtx_call_insn : public rtx_insn +struct GTY(()) rtx_call_insn : public rtx_insn { /* No extra fields, but adds the invariant: CALL_P (X) aka (GET_CODE (X) == CALL_INSN) @@ -629,7 +634,7 @@ class GTY(()) rtx_call_insn : public rtx_insn from rtl.def. */ }; -class GTY(()) rtx_jump_table_data : public rtx_insn +struct GTY(()) rtx_jump_table_data : public rtx_insn { /* No extra fields, but adds the invariant: JUMP_TABLE_DATA_P (X) aka (GET_CODE (INSN) == JUMP_TABLE_DATA) @@ -640,8 +645,6 @@ class GTY(()) rtx_jump_table_data : public rtx_insn DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "uuBe0000", RTX_INSN) from rtl.def. */ -public: - /* This can be either: (a) a table of absolute jumps, in which case PATTERN (this) is an @@ -657,7 +660,7 @@ public: inline scalar_int_mode get_data_mode () const; }; -class GTY(()) rtx_barrier : public rtx_insn +struct GTY(()) rtx_barrier : public rtx_insn { /* No extra fields, but adds the invariant: BARRIER_P (X) aka (GET_CODE (X) == BARRIER) @@ -668,7 +671,7 @@ class GTY(()) rtx_barrier : public rtx_insn from rtl.def. */ }; -class GTY(()) rtx_code_label : public rtx_insn +struct GTY(()) rtx_code_label : public rtx_insn { /* No extra fields, but adds the invariant: LABEL_P (X) aka (GET_CODE (X) == CODE_LABEL) @@ -679,7 +682,7 @@ class GTY(()) rtx_code_label : public rtx_insn from rtl.def. */ }; -class GTY(()) rtx_note : public rtx_insn +struct GTY(()) rtx_note : public rtx_insn { /* No extra fields, but adds the invariant: NOTE_P(X) aka (GET_CODE (X) == NOTE) @@ -2096,7 +2099,8 @@ costs_add_n_insns (struct full_rtx_costs *c, int n) inner_mode == the mode of the SUBREG_REG offset == the SUBREG_BYTE outer_mode == the mode of the SUBREG itself. */ -struct subreg_shape { +class subreg_shape { +public: subreg_shape (machine_mode, poly_uint16, machine_mode); bool operator == (const subreg_shape &) const; bool operator != (const subreg_shape &) const; diff --git a/gcc/sanopt.c b/gcc/sanopt.c index 5cb98e1b50e..bf9fdc9cb83 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -207,8 +207,9 @@ struct sanopt_tree_couple_hash : typed_noop_remove /* This is used to carry various hash maps and variables used in sanopt_optimize_walker. */ -struct sanopt_ctx +class sanopt_ctx { +public: /* This map maps a pointer (the first argument of UBSAN_NULL) to a vector of UBSAN_NULL call statements that check this pointer. */ hash_map > null_check_map; diff --git a/gcc/sched-int.h b/gcc/sched-int.h index 3ca5e263ab4..5fef221a0ea 100644 --- a/gcc/sched-int.h +++ b/gcc/sched-int.h @@ -454,8 +454,9 @@ struct deps_reg }; /* Describe state of dependencies used during sched_analyze phase. */ -struct deps_desc +class deps_desc { +public: /* The *_insns and *_mems are paired lists. Each pending memory operation will have a pointer to the MEM rtx on one list and a pointer to the containing insn on the other list in the same place in the list. */ diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h index 5dd273f40a4..2a24a920991 100644 --- a/gcc/sel-sched-ir.h +++ b/gcc/sel-sched-ir.h @@ -713,8 +713,9 @@ struct transformed_insns /* Indexed by INSN_LUID, the collection of all data associated with a single instruction that is in the stream. */ -struct _sel_insn_data +class _sel_insn_data { +public: /* The expression that contains vinsn for this insn and some flow-sensitive data like priority. */ expr_def expr; diff --git a/gcc/selftest.h b/gcc/selftest.h index d278f0a2900..6152ef54782 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -30,8 +30,9 @@ namespace selftest { /* A struct describing the source-location of a selftest, to make it easier to track down failing tests. */ -struct location +class location { +public: location (const char *file, int line, const char *function) : m_file (file), m_line (line), m_function (function) {} diff --git a/gcc/sese.h b/gcc/sese.h index 8931b28b29f..0319da6508f 100644 --- a/gcc/sese.h +++ b/gcc/sese.h @@ -26,8 +26,9 @@ typedef struct ifsese_s *ifsese; /* A Single Entry, Single Exit region is a part of the CFG delimited by two edges. */ -struct sese_l +class sese_l { +public: sese_l (edge e, edge x) : entry (e), exit (x) {} operator bool () const { return entry && exit; } @@ -71,8 +72,9 @@ vec_find (const vec &v, const T &elem) } /* A helper structure for bookkeeping information about a scop in graphite. */ -typedef struct sese_info_t +typedef class sese_info_t { +public: /* The SESE region. */ sese_l region; diff --git a/gcc/stmt.c b/gcc/stmt.c index 8ed3bf5aa2f..040899e2731 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -68,8 +68,9 @@ along with GCC; see the file COPYING3. If not see */ -struct simple_case_node +class simple_case_node { +public: simple_case_node (tree low, tree high, tree code_label): m_low (low), m_high (high), m_code_label (code_label) {} diff --git a/gcc/target-globals.h b/gcc/target-globals.h index 5af846c9f54..57cb42f320e 100644 --- a/gcc/target-globals.h +++ b/gcc/target-globals.h @@ -39,7 +39,8 @@ extern struct target_bb_reorder *this_target_bb_reorder; extern struct target_lower_subreg *this_target_lower_subreg; #endif -struct GTY(()) target_globals { +class GTY(()) target_globals { +public: ~target_globals (); struct target_flag_state *GTY((skip)) flag_state; diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c index b8a62a6aff1..ee7e010a1a5 100644 --- a/gcc/tree-affine.c +++ b/gcc/tree-affine.c @@ -695,8 +695,9 @@ aff_combination_find_elt (aff_tree *comb, tree val, unsigned *idx) /* Element of the cache that maps ssa name NAME to its expanded form as an affine expression EXPANSION. */ -struct name_expansion +class name_expansion { +public: aff_tree expansion; /* True if the expansion for the name is just being generated. */ diff --git a/gcc/tree-affine.h b/gcc/tree-affine.h index 257e8f69d03..23c6096254b 100644 --- a/gcc/tree-affine.h +++ b/gcc/tree-affine.h @@ -28,8 +28,9 @@ along with GCC; see the file COPYING3. If not see /* Element of an affine combination. */ -struct aff_comb_elt +class aff_comb_elt { +public: /* The value of the element. */ tree val; @@ -37,8 +38,9 @@ struct aff_comb_elt widest_int coef; }; -struct aff_tree +class aff_tree { +public: /* Type of the result of the combination. */ tree type; diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index 69d5a82c564..d7cd98d589d 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -203,8 +203,9 @@ typedef struct data_reference *data_reference_p; including the data ref itself and the segment length for aliasing checks. This is used to merge alias checks. */ -struct dr_with_seg_len +class dr_with_seg_len { +public: dr_with_seg_len (data_reference_p d, tree len, unsigned HOST_WIDE_INT size, unsigned int a) : dr (d), seg_len (len), access_size (size), align (a) {} @@ -224,8 +225,9 @@ struct dr_with_seg_len /* This struct contains two dr_with_seg_len objects with aliasing data refs. Two comparisons are generated from them. */ -struct dr_with_seg_len_pair_t +class dr_with_seg_len_pair_t { +public: dr_with_seg_len_pair_t (const dr_with_seg_len& d1, const dr_with_seg_len& d2) : first (d1), second (d2) {} diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index d8c8249e8ac..eb35ebf8d99 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -129,8 +129,9 @@ ssa_is_replaceable_p (gimple *stmt) rarely more than 6, and in the bootstrap of gcc, the maximum number of nodes encountered was 12. */ -struct elim_graph +class elim_graph { +public: elim_graph (var_map map); /* Size of the elimination vectors. */ diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 8e83a715a24..dfb21460d58 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -243,8 +243,9 @@ along with GCC; see the file COPYING3. If not see /* Data references (or phi nodes that carry data reference values across loop iterations). */ -typedef struct dref_d +typedef class dref_d { +public: /* The reference itself. */ struct data_reference *ref; diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index b1c15dc11ba..08c882edd6f 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -370,8 +370,9 @@ find_var_scev_info (basic_block instantiated_below, tree var) analyzing a scalar evolution, instantiating a CHREC or resolving mixers. */ -struct instantiate_cache_type +class instantiate_cache_type { +public: htab_t map; vec entries; diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h index ddd28ec3c75..c7c6020efc0 100644 --- a/gcc/tree-ssa-alias.h +++ b/gcc/tree-ssa-alias.h @@ -68,8 +68,9 @@ struct GTY(()) pt_solution /* Simplified and cached information about a memory reference tree. Used by the alias-oracle internally and externally in alternate interfaces. */ -struct ao_ref +class ao_ref { +public: /* The original full memory reference tree or NULL_TREE if that is not available. */ tree ref; diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 51b9d9f53d2..4dd703558b1 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -157,7 +157,8 @@ typedef enum VARYING } ccp_lattice_t; -struct ccp_prop_value_t { +class ccp_prop_value_t { +public: /* Lattice value. */ ccp_lattice_t lattice_val; diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index 2ea0a66ac27..2ca0d02d9a0 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -674,8 +674,9 @@ ssa_conflicts_dump (FILE *file, ssa_conflicts *ptr) marked as being live. This delays clearing of these bitmaps until they are actually needed again. */ -struct live_track +class live_track { +public: bitmap_obstack obstack; /* A place to allocate our bitmaps. */ bitmap_head live_base_var; /* Indicates if a basevar is live. */ bitmap_head *live_base_partitions; /* Live partitions for each basevar. */ diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 2064c2900fb..f8bcabc0aa5 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -113,8 +113,9 @@ struct mem_ref_loc /* Description of a memory reference. */ -struct im_mem_ref +class im_mem_ref { +public: unsigned id : 30; /* ID assigned to the memory reference (its index in memory_accesses.refs_list) */ unsigned ref_canonical : 1; /* Whether mem.ref was canonicalized. */ @@ -1756,8 +1757,9 @@ for_all_locs_in_loop (struct loop *loop, im_mem_ref *ref, FN fn) /* Rewrites location LOC by TMP_VAR. */ -struct rewrite_mem_ref_loc +class rewrite_mem_ref_loc { +public: rewrite_mem_ref_loc (tree tmp_var_) : tmp_var (tmp_var_) {} bool operator () (mem_ref_loc *loc); tree tmp_var; @@ -1781,8 +1783,9 @@ rewrite_mem_refs (struct loop *loop, im_mem_ref *ref, tree tmp_var) /* Stores the first reference location in LOCP. */ -struct first_mem_ref_loc_1 +class first_mem_ref_loc_1 { +public: first_mem_ref_loc_1 (mem_ref_loc **locp_) : locp (locp_) {} bool operator () (mem_ref_loc *loc); mem_ref_loc **locp; @@ -2017,8 +2020,9 @@ execute_sm_if_changed (edge ex, tree mem, tree tmp_var, tree flag, /* When REF is set on the location, set flag indicating the store. */ -struct sm_set_flag_if_changed +class sm_set_flag_if_changed { +public: sm_set_flag_if_changed (tree flag_, hash_set *bbs_) : flag (flag_), bbs (bbs_) {} bool operator () (mem_ref_loc *loc); @@ -2151,8 +2155,9 @@ hoist_memory_references (struct loop *loop, bitmap mem_refs, } } -struct ref_always_accessed +class ref_always_accessed { +public: ref_always_accessed (struct loop *loop_, bool stored_p_) : loop (loop_), stored_p (stored_p_) {} bool operator () (mem_ref_loc *loc); diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index bbae83cbc6e..cb189aba533 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -175,8 +175,9 @@ enum use_type }; /* Cost of a computation. */ -struct comp_cost +class comp_cost { +public: comp_cost (): cost (0), complexity (0), scratch (0) {} @@ -352,8 +353,9 @@ operator<= (comp_cost cost1, comp_cost cost2) struct iv_inv_expr_ent; /* The candidate - cost pair. */ -struct cost_pair +class cost_pair { +public: struct iv_cand *cand; /* The candidate. */ comp_cost cost; /* The cost. */ enum tree_code comp; /* For iv elimination, the comparison. */ @@ -442,8 +444,9 @@ struct iv_cand }; /* Hashtable entry for common candidate derived from iv uses. */ -struct iv_common_cand +class iv_common_cand { +public: tree base; tree step; /* IV uses from which this common candidate is derived. */ @@ -616,8 +619,9 @@ struct ivopts_data /* An assignment of iv candidates to uses. */ -struct iv_ca +class iv_ca { +public: /* The number of uses covered by the assignment. */ unsigned upto; diff --git a/gcc/tree-ssa-loop.h b/gcc/tree-ssa-loop.h index 2fc9e8c8051..24fad0f3e10 100644 --- a/gcc/tree-ssa-loop.h +++ b/gcc/tree-ssa-loop.h @@ -36,8 +36,9 @@ struct affine_iv the structure can be evaluated at the end of the loop's preheader (and due to ssa form, also anywhere inside the body of the loop). */ -struct tree_niter_desc +class tree_niter_desc { +public: tree assumptions; /* The boolean expression. If this expression evaluates to false, then the other fields in this structure should not be used; there is no guarantee that they diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 231ac00c1d1..36da4c6a1e1 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -428,8 +428,9 @@ get_or_alloc_expr_for_name (tree name) /* An unordered bitmap set. One bitmap tracks values, the other, expressions. */ -typedef struct bitmap_set +typedef class bitmap_set { +public: bitmap_head expressions; bitmap_head values; } *bitmap_set_t; diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 29688d2618d..f470f31d295 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -1393,8 +1393,9 @@ static bitmap changed; /* Strongly Connected Component visitation info. */ -struct scc_info +class scc_info { +public: scc_info (size_t size); ~scc_info (); diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h index a9a959c39db..653007f0e17 100644 --- a/gcc/tree-switch-conversion.h +++ b/gcc/tree-switch-conversion.h @@ -44,8 +44,9 @@ enum cluster_type |-jump_table_cluster (JUMP_TABLE) `-bit_test_cluster (BIT_TEST). */ -struct cluster +class cluster { +public: /* Constructor. */ cluster (tree case_label_expr, basic_block case_bb, profile_probability prob, profile_probability subtree_prob); @@ -117,8 +118,9 @@ cluster::cluster (tree case_label_expr, basic_block case_bb, /* Subclass of cluster representing a simple contiguous range from [low..high]. */ -struct simple_cluster: public cluster +class simple_cluster: public cluster { +public: /* Constructor. */ simple_cluster (tree low, tree high, tree case_label_expr, basic_block case_bb, profile_probability prob); @@ -196,8 +198,9 @@ simple_cluster::simple_cluster (tree low, tree high, tree case_label_expr, /* Abstract subclass of jump table and bit test cluster, handling a collection of simple_cluster instances. */ -struct group_cluster: public cluster +class group_cluster: public cluster { +public: /* Constructor. */ group_cluster (vec &clusters, unsigned start, unsigned end); @@ -233,8 +236,9 @@ struct group_cluster: public cluster The "emit" vfunc gernerates a nested switch statement which is later lowered to a jump table. */ -struct jump_table_cluster: public group_cluster +class jump_table_cluster: public group_cluster { +public: /* Constructor. */ jump_table_cluster (vec &clusters, unsigned start, unsigned end) : group_cluster (clusters, start, end) @@ -332,8 +336,9 @@ This transformation was contributed by Roger Sayle, see this e-mail: http://gcc.gnu.org/ml/gcc-patches/2003-01/msg01950.html */ -struct bit_test_cluster: public group_cluster +class bit_test_cluster: public group_cluster { +public: /* Constructor. */ bit_test_cluster (vec &clusters, unsigned start, unsigned end, bool handles_entire_switch) @@ -417,8 +422,9 @@ struct bit_test_cluster: public group_cluster /* Helper struct to find minimal clusters. */ -struct min_cluster_item +class min_cluster_item { +public: /* Constructor. */ min_cluster_item (unsigned count, unsigned start, unsigned non_jt_cases): m_count (count), m_start (start), m_non_jt_cases (non_jt_cases) @@ -436,8 +442,9 @@ struct min_cluster_item /* Helper struct to represent switch decision tree. */ -struct case_tree_node +class case_tree_node { +public: /* Empty Constructor. */ case_tree_node (); @@ -503,8 +510,9 @@ bool jump_table_cluster::is_enabled (void) is used to quickly identify all cases in this set without looking at label_to_block for every case label. */ -struct case_bit_test +class case_bit_test { +public: wide_int mask; basic_block target_bb; tree label; @@ -515,8 +523,9 @@ struct case_bit_test static int cmp (const void *p1, const void *p2); }; -struct switch_decision_tree +class switch_decision_tree { +public: /* Constructor. */ switch_decision_tree (gswitch *swtch): m_switch (swtch), m_phi_mapping (), m_case_bbs (), m_case_node_pool ("struct case_node pool"), @@ -681,8 +690,9 @@ This transformation was contributed by Martin Jambor, see this e-mail: http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00011.html */ /* The main structure of the pass. */ -struct switch_conversion +class switch_conversion { +public: /* Constructor. */ switch_conversion (); diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index ff952d6f464..0157ba4992e 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -286,7 +286,8 @@ type_conversion_p (tree name, stmt_vec_info stmt_vinfo, bool check_sign, /* Holds information about an input operand after some sign changes and type promotions have been peeled away. */ -struct vect_unpromoted_value { +class vect_unpromoted_value { +public: vect_unpromoted_value (); void set_op (tree, vect_def_type, stmt_vec_info = NULL); diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 325ef58722d..868dc5c675c 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -188,8 +188,9 @@ dump_stmt_cost (FILE *f, void *data, int count, enum vect_cost_for_stmt kind, /* For mapping simduid to vectorization factor. */ -struct simduid_to_vf : free_ptr_hash +class simduid_to_vf : public free_ptr_hash { +public: unsigned int simduid; poly_uint64 vf; diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index f7432f05847..6e76b7eaab5 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -141,7 +141,8 @@ struct _slp_tree { /* SLP instance is a sequence of stmts in a loop that can be packed into SIMD stmts. */ -typedef struct _slp_instance { +typedef class _slp_instance { +public: /* The root of SLP tree. */ slp_tree root; @@ -181,7 +182,8 @@ typedef std::pair vec_object_pair; /* Records that vectorization is only possible if abs (EXPR) >= MIN_VALUE. UNSIGNED_P is true if we can assume that abs (EXPR) == EXPR. */ -struct vec_lower_bound { +class vec_lower_bound { +public: vec_lower_bound () {} vec_lower_bound (tree e, bool u, poly_uint64 m) : expr (e), unsigned_p (u), min_value (m) {} @@ -193,7 +195,8 @@ struct vec_lower_bound { /* Vectorizer state shared between different analyses like vector sizes of the same CFG region. */ -struct vec_info_shared { +class vec_info_shared { +public: vec_info_shared(); ~vec_info_shared(); @@ -213,7 +216,8 @@ struct vec_info_shared { }; /* Vectorizer state common between loop and basic-block vectorization. */ -struct vec_info { +class vec_info { +public: enum vec_kind { bb, loop }; vec_info (vec_kind, void *, vec_info_shared *); @@ -377,7 +381,8 @@ typedef auto_vec vec_loop_masks; /*-----------------------------------------------------------------*/ /* Info on vectorized loops. */ /*-----------------------------------------------------------------*/ -typedef struct _loop_vec_info : public vec_info { +typedef class _loop_vec_info : public vec_info { +public: _loop_vec_info (struct loop *, vec_info_shared *); ~_loop_vec_info (); @@ -650,8 +655,9 @@ loop_vec_info_for_loop (struct loop *loop) return (loop_vec_info) loop->aux; } -typedef struct _bb_vec_info : public vec_info +typedef class _bb_vec_info : public vec_info { +public: _bb_vec_info (gimple_stmt_iterator, gimple_stmt_iterator, vec_info_shared *); ~_bb_vec_info (); @@ -790,7 +796,8 @@ enum vect_memory_access_type { VMAT_GATHER_SCATTER }; -struct dr_vec_info { +class dr_vec_info { +public: /* The data reference itself. */ data_reference *dr; /* The statement that contains the data reference. */ @@ -807,7 +814,8 @@ struct dr_vec_info { typedef struct data_reference *dr_p; -struct _stmt_vec_info { +class _stmt_vec_info { +public: enum stmt_vec_info_type type; diff --git a/gcc/tree.c b/gcc/tree.c index 563af6fbdda..7892c20e5c4 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5107,8 +5107,9 @@ protected_set_expr_location (tree t, location_t loc) /* Data used when collecting DECLs and TYPEs for language data removal. */ -struct free_lang_data_d +class free_lang_data_d { +public: free_lang_data_d () : decls (100), types (100) {} /* Worklist to avoid excessive recursion. */ diff --git a/gcc/tree.h b/gcc/tree.h index 3dce602dfba..992abd12f7a 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -5984,8 +5984,9 @@ desired_pro_or_demotion_p (const_tree to_type, const_tree from_type) /* Pointer type used to declare builtins before we have seen its real declaration. */ -struct builtin_structptr_type +class builtin_structptr_type { +public: tree& node; tree& base; const char *str; @@ -6069,8 +6070,9 @@ fndecl_built_in_p (const_tree node, built_in_function name) where it is not. */ -struct op_location_t +class op_location_t { +public: location_t m_operator_loc; location_t m_combined_loc; diff --git a/gcc/unique-ptr-tests.cc b/gcc/unique-ptr-tests.cc index 9e0f2a9bb6c..45c189b2e97 100644 --- a/gcc/unique-ptr-tests.cc +++ b/gcc/unique-ptr-tests.cc @@ -31,8 +31,9 @@ namespace { /* A class for counting ctor and dtor invocations. */ -struct stats +class stats { +public: stats () : ctor_count (0), dtor_count (0) {} int ctor_count; @@ -59,8 +60,9 @@ private: /* A struct for testing unique_ptr. */ -struct has_default_ctor +class has_default_ctor { +public: has_default_ctor () : m_field (42) {} int m_field; }; diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index c2b4204c0cb..65df25dfb52 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -929,8 +929,9 @@ static poly_int64 hard_frame_pointer_adjustment = -1; /* Data for adjust_mems callback. */ -struct adjust_mem_data +class adjust_mem_data { +public: bool store; machine_mode mem_mode; HOST_WIDE_INT stack_adjust; @@ -8061,8 +8062,9 @@ delete_variable_part (dataflow_set *set, rtx loc, decl_or_value dv, /* Structure for passing some other parameters to function vt_expand_loc_callback. */ -struct expand_loc_callback_data +class expand_loc_callback_data { +public: /* The variables and values active at this point. */ variable_table_type *vars; diff --git a/gcc/varasm.c b/gcc/varasm.c index 626a4c9f9a0..827a37092fd 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2899,7 +2899,8 @@ assemble_real (REAL_VALUE_TYPE d, scalar_float_mode mode, unsigned int align, Store them both in the structure *VALUE. EXP must be reducible. */ -struct addr_const { +class addr_const { +public: rtx base; poly_int64 offset; }; @@ -3621,7 +3622,8 @@ tree_output_constant_def (tree exp) return decl; } -struct GTY((chain_next ("%h.next"), for_user)) constant_descriptor_rtx { +class GTY((chain_next ("%h.next"), for_user)) constant_descriptor_rtx { +public: struct constant_descriptor_rtx *next; rtx mem; rtx sym; diff --git a/gcc/vec.c b/gcc/vec.c index f4749229ca2..cbd2db010f9 100644 --- a/gcc/vec.c +++ b/gcc/vec.c @@ -49,8 +49,9 @@ along with GCC; see the file COPYING3. If not see vnull vNULL; /* Vector memory usage. */ -struct vec_usage: public mem_usage +class vec_usage: public mem_usage { +public: /* Default constructor. */ vec_usage (): m_items (0), m_items_peak (0), m_element_size (0) {} diff --git a/gcc/wide-int-bitmask.h b/gcc/wide-int-bitmask.h index 529756f299d..e95e46349ad 100644 --- a/gcc/wide-int-bitmask.h +++ b/gcc/wide-int-bitmask.h @@ -20,8 +20,9 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_WIDE_INT_BITMASK_H #define GCC_WIDE_INT_BITMASK_H -struct wide_int_bitmask +class wide_int_bitmask { +public: inline wide_int_bitmask (); inline wide_int_bitmask (uint64_t l); inline wide_int_bitmask (uint64_t l, uint64_t h); diff --git a/gcc/wide-int.h b/gcc/wide-int.h index 25ea0545439..18e76b7ab1f 100644 --- a/gcc/wide-int.h +++ b/gcc/wide-int.h @@ -642,8 +642,9 @@ namespace wi { /* Contains the components of a decomposed integer for easy, direct access. */ - struct storage_ref + class storage_ref { + public: storage_ref () {} storage_ref (const HOST_WIDE_INT *, unsigned int, unsigned int); @@ -968,7 +969,7 @@ decompose (HOST_WIDE_INT *, unsigned int precision, wide_int, with the optimization that VAL is normally a pointer to another integer's storage, so that no array copy is needed. */ template -struct wide_int_ref_storage : public wi::storage_ref +class wide_int_ref_storage : public wi::storage_ref { private: /* Scratch space that can be used when decomposing the original integer. @@ -1357,7 +1358,7 @@ namespace wi bytes beyond the sizeof need to be allocated. Use set_precision to initialize the structure. */ template -class GTY((user)) trailing_wide_ints +struct GTY((user)) trailing_wide_ints { private: /* The shared precision of each number. */ @@ -1554,8 +1555,9 @@ namespace wi { /* Stores HWI-sized integer VAL, treating it as having signedness SGN and precision PRECISION. */ - struct hwi_with_prec + class hwi_with_prec { + public: hwi_with_prec () {} hwi_with_prec (HOST_WIDE_INT, unsigned int, signop); HOST_WIDE_INT val; diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index ff5f0aa8e06..c6e8e04b46e 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2019-07-09 Martin Sebor + + * include/line-map.h: Change class-key from class to struct and vice + versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. + * mkdeps.c: Same. + 2019-07-03 Martin Liska * line-map.c (linemap_get_expansion_filename): Remove diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 7649700e8a5..3961b636e23 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -770,7 +770,8 @@ struct GTY(()) location_adhoc_data_map { }; /* A set of chronological line_map structures. */ -struct GTY(()) line_maps { +class GTY(()) line_maps { +public: ~line_maps (); @@ -1783,8 +1784,9 @@ protected: of localized text, and a flag to determine if the caller should "free" the buffer. */ -struct label_text +class label_text { +public: label_text () : m_buffer (NULL), m_caller_owned (false) {} diff --git a/libcpp/mkdeps.c b/libcpp/mkdeps.c index 50f0fb2a80d..6693c21db52 100644 --- a/libcpp/mkdeps.c +++ b/libcpp/mkdeps.c @@ -29,7 +29,7 @@ along with this program; see the file COPYING3. If not see /* Keep this structure local to this file, so clients don't find it easy to start making assumptions. */ -struct mkdeps +class mkdeps { public: /* T has trivial cctor & dtor. */