From patchwork Sat Sep 21 00:47:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1988081 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AdHYk8Zb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X9VyY0yqrz1y2P for ; Sat, 21 Sep 2024 10:49:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 826D33858C39 for ; Sat, 21 Sep 2024 00:49:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 940DA3858D35 for ; Sat, 21 Sep 2024 00:49:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 940DA3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 940DA3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726879755; cv=none; b=HfL2CYojgoQTsWNlgOC8/nY7laBK0WB14wPdZgawIF7Fb///dfgYCERd8ms4ShZBaeKZplE3TPGbX1CHBX893Zr5OFUc+4g4j4wLv/IpqBSoLXjANdbWeAnIBZtLYLeuz6T8sqm0CP7NceOLRTk5+OWBEXS7GoaS1kLLZ0UDWd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726879755; c=relaxed/simple; bh=wrjooMZySvJU2+pajQnI8BGZgUrIdmswdrvFGPCRHTg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=wZQEU/3LAED7Y5AYd1bZ8qrpjM1NWRnPT+kKKP7UaLRM15iQNh94c3IT7c8rXrsisu1gMZZ+65Ob+APmn7TQbMBRSRHXUrYvTaSP4/rwbLz51dfrE+b3VnzoNiPxTvBIDzCHMuQqgROatQaDjjHDOiAL0isEPNkAWQp0Vm8J6Ps= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726879752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mDTVMWgNrM52Fe4mzrWTFoJ5QFgpwbS4tsKfL267Bjg=; b=AdHYk8ZbBe2x5cPL7DUVbPGqvTnR8RECda9echwy46K4i5oXBeVZh966+daJzmiLfKS0w5 K+OfrDEVeAOlJ26XTcVSs/JdBaeaSCESr8I8PDKOhgm6l1JoCKnK/5mkhZLa5PA75Ydt5D +wRJ8JMVX4KeF136OlJoWeUXnBqDrNw= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-0EQuRDa1NnK1VEQNYXrZ-A-1; Fri, 20 Sep 2024 20:49:10 -0400 X-MC-Unique: 0EQuRDa1NnK1VEQNYXrZ-A-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6c5be17fa0fso40831626d6.3 for ; Fri, 20 Sep 2024 17:49:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726879750; x=1727484550; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mDTVMWgNrM52Fe4mzrWTFoJ5QFgpwbS4tsKfL267Bjg=; b=ZiHw3VgJRV0jwqSttByo+VY+1zlQPMe3hmigfukcgTyWrsGZWi4qgc6fGTvxVlTpIl UeiFKhIFcSD5R0ryIVumOjhRn3Wfzcu4yi+u4fkVG/2XI/Bnz9/IHd3EF8ZxK9VdmTcG fUuDGWLLzZSUs+hrWzlWuV4fa5YktKARXH72QEKhipFiTA8mny040A8JoRHZdO5RX5TC tq6hmiwFelKIS0uVjH5Yup6IaWzeRpTrBO9CgC4FRN6eVCdTSIdsT1SJaChB+jgIUL5Z My4W48xZyCZNrCAiKrD+J1wFBcIWR1zivjRTxfutYg4qqSWUztXDOqQ1hSLu2NT4Pay1 5I4A== X-Gm-Message-State: AOJu0Ywlq9tynSGKMjHgjsBynDB8WcgnpfH/p+cwa8bY0Lu2UmLw8BX0 qZkklDdFAxdcelhisfFZdp1M5Qg9GY6R3syCyQdCQDisCic3TrWghUmD/mKaTJuvD3emTCfiPCz EbIi2Ob/bNOpKJhQpXQnaK2Pm8VG0ZxUWnTTiNsQ8y/mvPOqeaI2rAvSO6PLChNqOUDcBceIEuu cjmb/qokyifLXnY7TFmlIl4UGi0NxtAQtYOB0= X-Received: by 2002:a05:6214:5b0d:b0:6c5:9bc6:8962 with SMTP id 6a1803df08f44-6c7bc7409e3mr77903466d6.30.1726879749442; Fri, 20 Sep 2024 17:49:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnXkzKy5MT8TQky3PIIjYoOzqtG549MuNC7gjvH7cU+yqkX+NG3ZgZavjKiW3G7fthUXsisQ== X-Received: by 2002:a05:6214:5b0d:b0:6c5:9bc6:8962 with SMTP id 6a1803df08f44-6c7bc7409e3mr77903096d6.30.1726879748744; Fri, 20 Sep 2024 17:49:08 -0700 (PDT) Received: from jason-thinkpadp1gen4i.rmtusma.csb (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c75e44c0d4sm24231206d6.26.2024.09.20.17.49.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Sep 2024 17:49:08 -0700 (PDT) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [PATCH RFC] build: enable C++11 narrowing warnings Date: Fri, 20 Sep 2024 20:47:14 -0400 Message-ID: <20240921004906.819256-1-jason@redhat.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-pc-linux-gnu. OK for trunk? -- 8< -- We've been using -Wno-narrowing since gcc 4.7, but at this point narrowing diagnostics seem like a stable part of C++ and we should adjust. This patch changes -Wno-narrowing to -Wno-error=narrowing so that narrowing issues will still not break bootstrap, but we can see them. The rest of the patch fixes the narrowing warnings I see in an x86_64-pc-linux-gnu bootstrap. In most of the cases, by adjusting the types of various declarations so that we store the values in the same types we compute them in, which seems worthwhile anyway. This also allowed us to remove a few -Wsign-compare casts. The one place I didn't see how best to do this was in vect_prologue_cost_for_slp: changing const_nunits to unsigned int broke the call to TYPE_VECTOR_SUBPARTS (vectype).is_constant (&const_nunits), since poly_uint64.is_constant wants a pointer to unsigned HOST_WIDE_INT. So I added casts in that one place. Not too bad, I think. gcc/ChangeLog: * configure.ac (CXX_WARNING_OPTS): Change -Wno-narrowing to -Wno-error=narrowing. * configure: Regenerate. * config/i386/i386.h (debugger_register_map) (debugger64_register_map) (svr4_debugger_register_map): Make unsigned. * config/i386/i386.cc: Likewise. * diagnostic-event-id.h (diagnostic_thread_id_t): Make int. * vec.h (vec::size): Make unsigned int. * ipa-modref.cc (escape_point::arg): Make unsigned. (modref_lattice::add_escape_point): Use eaf_flags_t. (update_escape_summary_1): Use eaf_flags_t, && for bool. * pair-fusion.cc (pair_fusion_bb_info::track_access): Make mem_size unsigned int. * pretty-print.cc (format_phase_2): Cast va_arg to char. * tree-ssa-loop-ch.cc (ch_base::copy_headers): Make nheaders unsigned, remove cast. * tree-ssa-structalias.cc (push_fields_onto_fieldstack): Make offset unsigned, remove cast. * tree-vect-slp.cc (vect_prologue_cost_for_slp): Add cast. * tree-vect-stmts.cc (vect_truncate_gather_scatter_offset): Make scale unsigned. (vectorizable_operation): Make ncopies unsigned. * rtl-ssa/member-fns.inl: Make num_accesses unsigned int. --- gcc/config/i386/i386.h | 6 +++--- gcc/diagnostic-event-id.h | 2 +- gcc/vec.h | 2 +- gcc/config/i386/i386.cc | 6 +++--- gcc/ipa-modref.cc | 13 +++++++------ gcc/pair-fusion.cc | 2 +- gcc/pretty-print.cc | 2 +- gcc/tree-ssa-loop-ch.cc | 6 +++--- gcc/tree-ssa-structalias.cc | 6 +++--- gcc/tree-vect-slp.cc | 3 ++- gcc/tree-vect-stmts.cc | 7 ++++--- gcc/configure.ac | 3 +-- gcc/rtl-ssa/member-fns.inl | 3 ++- gcc/configure | 7 +++---- 14 files changed, 35 insertions(+), 33 deletions(-) base-commit: 2484ba167e1c4a52d4989b71e1f5d4d27755500f diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index c1ec92ffb15..751c250ddb3 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2091,9 +2091,9 @@ do { \ #define DEBUGGER_REGNO(N) \ (TARGET_64BIT ? debugger64_register_map[(N)] : debugger_register_map[(N)]) -extern int const debugger_register_map[FIRST_PSEUDO_REGISTER]; -extern int const debugger64_register_map[FIRST_PSEUDO_REGISTER]; -extern int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER]; +extern unsigned int const debugger_register_map[FIRST_PSEUDO_REGISTER]; +extern unsigned int const debugger64_register_map[FIRST_PSEUDO_REGISTER]; +extern unsigned int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER]; /* Before the prologue, RA is at 0(%esp). */ #define INCOMING_RETURN_ADDR_RTX \ diff --git a/gcc/diagnostic-event-id.h b/gcc/diagnostic-event-id.h index 8237ba34df3..06985d23c12 100644 --- a/gcc/diagnostic-event-id.h +++ b/gcc/diagnostic-event-id.h @@ -67,6 +67,6 @@ typedef diagnostic_event_id_t *diagnostic_event_id_ptr; /* A type for compactly referring to a particular thread within a diagnostic_path. Typically there is just one thread per path, with id 0. */ -typedef unsigned diagnostic_thread_id_t; +typedef int diagnostic_thread_id_t; #endif /* ! GCC_DIAGNOSTIC_EVENT_ID_H */ diff --git a/gcc/vec.h b/gcc/vec.h index bc83827f644..b13c4716428 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -2409,7 +2409,7 @@ public: const value_type &back () const; const value_type &operator[] (unsigned int i) const; - size_t size () const { return m_size; } + unsigned size () const { return m_size; } size_t size_bytes () const { return m_size * sizeof (T); } bool empty () const { return m_size == 0; } diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 7dbae1d72e3..2f736a3b346 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -181,7 +181,7 @@ enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER] = /* The "default" register map used in 32bit mode. */ -int const debugger_register_map[FIRST_PSEUDO_REGISTER] = +unsigned int const debugger_register_map[FIRST_PSEUDO_REGISTER] = { /* general regs */ 0, 2, 1, 3, 6, 7, 4, 5, @@ -212,7 +212,7 @@ int const debugger_register_map[FIRST_PSEUDO_REGISTER] = /* The "default" register map used in 64bit mode. */ -int const debugger64_register_map[FIRST_PSEUDO_REGISTER] = +unsigned int const debugger64_register_map[FIRST_PSEUDO_REGISTER] = { /* general regs */ 0, 1, 2, 3, 4, 5, 6, 7, @@ -294,7 +294,7 @@ int const debugger64_register_map[FIRST_PSEUDO_REGISTER] = 17 for %st(6) (gcc regno = 14) 18 for %st(7) (gcc regno = 15) */ -int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER] = +unsigned int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER] = { /* general regs */ 0, 2, 1, 3, 6, 7, 5, 4, diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc index 400a8856de2..19359662f8f 100644 --- a/gcc/ipa-modref.cc +++ b/gcc/ipa-modref.cc @@ -1997,7 +1997,7 @@ struct escape_point /* Value escapes to this call. */ gcall *call; /* Argument it escapes to. */ - int arg; + unsigned int arg; /* Flags already known about the argument (this can save us from recording escape points if local analysis did good job already). */ eaf_flags_t min_flags; @@ -2047,7 +2047,8 @@ public: bool merge_deref (const modref_lattice &with, bool ignore_stores); bool merge_direct_load (); bool merge_direct_store (); - bool add_escape_point (gcall *call, int arg, int min_flags, bool diret); + bool add_escape_point (gcall *call, unsigned int arg, + eaf_flags_t min_flags, bool direct); void dump (FILE *out, int indent = 0) const; }; @@ -2101,8 +2102,8 @@ modref_lattice::dump (FILE *out, int indent) const point exists. */ bool -modref_lattice::add_escape_point (gcall *call, int arg, int min_flags, - bool direct) +modref_lattice::add_escape_point (gcall *call, unsigned arg, + eaf_flags_t min_flags, bool direct) { escape_point *ep; unsigned int i; @@ -4415,12 +4416,12 @@ update_escape_summary_1 (cgraph_edge *e, continue; FOR_EACH_VEC_ELT (map[ee->parm_index], j, em) { - int min_flags = ee->min_flags; + eaf_flags_t min_flags = ee->min_flags; if (ee->direct && !em->direct) min_flags = deref_flags (min_flags, ignore_stores); struct escape_entry entry = {em->parm_index, ee->arg, min_flags, - ee->direct & em->direct}; + ee->direct && em->direct}; sum->esc.safe_push (entry); } } diff --git a/gcc/pair-fusion.cc b/gcc/pair-fusion.cc index cb0374f426b..653055fdcf6 100644 --- a/gcc/pair-fusion.cc +++ b/gcc/pair-fusion.cc @@ -444,7 +444,7 @@ pair_fusion_bb_info::track_access (insn_info *insn, bool load_p, rtx mem) const bool fpsimd_op_p = m_pass->fpsimd_op_p (reg_op, mem_mode, load_p); // Note pair_operand_mode_ok_p already rejected VL modes. - const HOST_WIDE_INT mem_size = GET_MODE_SIZE (mem_mode).to_constant (); + const unsigned mem_size = GET_MODE_SIZE (mem_mode).to_constant (); const lfs_fields lfs = { load_p, fpsimd_op_p, mem_size }; if (track_via_mem_expr (insn, mem, lfs)) diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc index 998e06e155f..0cd9b4d0a41 100644 --- a/gcc/pretty-print.cc +++ b/gcc/pretty-print.cc @@ -1923,7 +1923,7 @@ format_phase_2 (pretty_printer *pp, /* When quoting, print alphanumeric, punctuation, and the space character unchanged, and all others in hexadecimal with the "\x" prefix. Otherwise print them all unchanged. */ - int chr = va_arg (*text.m_args_ptr, int); + char chr = (char) va_arg (*text.m_args_ptr, int); if (ISPRINT (chr) || !quote) pp_character (pp, chr); else diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc index 525eb357858..6552ddd1ee2 100644 --- a/gcc/tree-ssa-loop-ch.cc +++ b/gcc/tree-ssa-loop-ch.cc @@ -839,8 +839,8 @@ ch_base::copy_headers (function *fun) copied. TODO -- handle while (a || b) - like cases, by not requiring the header to have just a single successor and copying up to postdominator. */ - int nheaders = 0; - int last_win_nheaders = 0; + unsigned int nheaders = 0; + unsigned int last_win_nheaders = 0; bool last_win_invariant_exit = false; ch_decision ret; auto_vec decision; @@ -893,7 +893,7 @@ ch_base::copy_headers (function *fun) } /* "Duplicate" all BBs with zero cost following last basic blocks we decided to copy. */ - while (last_win_nheaders < (int)decision.length () + while (last_win_nheaders < decision.length () && decision[last_win_nheaders] == ch_possible_zero_cost) { if (dump_file && (dump_flags & TDF_DETAILS)) diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc index a32ef1d5cc0..7adb50a896d 100644 --- a/gcc/tree-ssa-structalias.cc +++ b/gcc/tree-ssa-structalias.cc @@ -5925,7 +5925,7 @@ field_must_have_pointers (tree t) static bool push_fields_onto_fieldstack (tree type, vec *fieldstack, - HOST_WIDE_INT offset) + unsigned HOST_WIDE_INT offset) { tree field; bool empty_p = true; @@ -5943,7 +5943,7 @@ push_fields_onto_fieldstack (tree type, vec *fieldstack, if (TREE_CODE (field) == FIELD_DECL) { bool push = false; - HOST_WIDE_INT foff = bitpos_of_field (field); + unsigned HOST_WIDE_INT foff = bitpos_of_field (field); tree field_type = TREE_TYPE (field); if (!var_can_have_subvars (field) @@ -5988,7 +5988,7 @@ push_fields_onto_fieldstack (tree type, vec *fieldstack, && !must_have_pointers_p && !pair->must_have_pointers && !pair->has_unknown_size - && pair->offset + (HOST_WIDE_INT)pair->size == offset + foff) + && pair->offset + pair->size == offset + foff) { pair->size += tree_to_uhwi (DECL_SIZE (field)); } diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 9c817de18bd..0bd385f2328 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -7471,7 +7471,8 @@ vect_prologue_cost_for_slp (slp_tree node, nelt_limit = const_nunits; hash_set vector_ops; for (unsigned int i = 0; i < SLP_TREE_NUMBER_OF_VEC_STMTS (node); ++i) - if (!vector_ops.add ({ ops, i * const_nunits, const_nunits })) + if (!vector_ops.add + ({ ops, i * (unsigned)const_nunits, (unsigned)const_nunits })) starts.quick_push (i * const_nunits); } else diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 45003f762dd..688b8715a15 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -1711,11 +1711,11 @@ vect_truncate_gather_scatter_offset (stmt_vec_info stmt_info, count = max_iters.to_shwi (); /* Try scales of 1 and the element size. */ - int scales[] = { 1, vect_get_scalar_dr_size (dr_info) }; + unsigned int scales[] = { 1, vect_get_scalar_dr_size (dr_info) }; wi::overflow_type overflow = wi::OVF_NONE; for (int i = 0; i < 2; ++i) { - int scale = scales[i]; + unsigned int scale = scales[i]; widest_int factor; if (!wi::multiple_of_p (wi::to_widest (step), scale, SIGNED, &factor)) continue; @@ -6528,7 +6528,8 @@ vectorizable_operation (vec_info *vinfo, poly_uint64 nunits_in; poly_uint64 nunits_out; tree vectype_out; - int ncopies, vec_num; + unsigned int ncopies; + int vec_num; int i; vec vec_oprnds0 = vNULL; vec vec_oprnds1 = vNULL; diff --git a/gcc/configure.ac b/gcc/configure.ac index 8a2d2b0438e..23f4884eff9 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -585,7 +585,6 @@ AC_SUBST(aliasing_flags) # * 'long long' # * variadic macros # * overlong strings -# * C++11 narrowing conversions in { } # So, we only use -pedantic if we can disable those warnings. # In stage 1, disable -Wformat warnings from old GCCs about new % codes @@ -595,7 +594,7 @@ AC_ARG_ENABLE(build-format-warnings, AS_IF([test $enable_build_format_warnings = no], [wf_opt=-Wno-format],[wf_opt=]) ACX_PROG_CXX_WARNING_OPTS( - m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ], + m4_quote(m4_do([-W -Wall -Wno-error=narrowing -Wwrite-strings ], [-Wcast-qual $wf_opt])), [loose_warn]) ACX_PROG_CC_WARNING_OPTS( diff --git a/gcc/rtl-ssa/member-fns.inl b/gcc/rtl-ssa/member-fns.inl index d39184fb8cd..143c22c8c77 100644 --- a/gcc/rtl-ssa/member-fns.inl +++ b/gcc/rtl-ssa/member-fns.inl @@ -41,7 +41,8 @@ access_array_builder::quick_push (access_info *access) inline array_slice access_array_builder::finish () { - auto num_accesses = obstack_object_size (m_obstack) / sizeof (access_info *); + unsigned num_accesses + = obstack_object_size (m_obstack) / sizeof (access_info *); if (num_accesses == 0) return {}; diff --git a/gcc/configure b/gcc/configure index 3d301b6ecd3..5acc42c1e4d 100755 --- a/gcc/configure +++ b/gcc/configure @@ -7146,7 +7146,6 @@ fi # * 'long long' # * variadic macros # * overlong strings -# * C++11 narrowing conversions in { } # So, we only use -pedantic if we can disable those warnings. # In stage 1, disable -Wformat warnings from old GCCs about new % codes @@ -7170,7 +7169,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu loose_warn= save_CXXFLAGS="$CXXFLAGS" -for real_option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual $wf_opt; do +for real_option in -W -Wall -Wno-error=narrowing -Wwrite-strings -Wcast-qual $wf_opt; do # Do the check with the no- prefix removed since gcc silently # accepts any -Wno-* option on purpose case $real_option in @@ -21406,7 +21405,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21409 "configure" +#line 21408 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21512,7 +21511,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21515 "configure" +#line 21514 "configure" #include "confdefs.h" #if HAVE_DLFCN_H