From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 29F0D385E83D for ; Tue, 19 Dec 2023 22:17:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29F0D385E83D 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 29F0D385E83D 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=1703024258; cv=none; b=Pa++Zyn16Ax9fQ3uB3vTZ0dowOiMBi2SS891nRfJFrWlCrRfX+ZbQUGPhBMng/xNru0f0DqxJmnLkC1cFFmz0t2ep1FPRHliAX61o1Z3wC5m0r9fc3g2avek9EWfp6/bsf+i5cLWccq7oFSakNL9UYWrU6W85gtSi5F9OI+7zo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703024258; c=relaxed/simple; bh=AFuWFWmVz6tuk9RWSkNZeop77WU0IKAfTVkP0S6JNrg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=a2h7JOeb3wR0ep1fhIffBDXkF6RcokDJQdq7gqoQEtsalobCS58sXbfFYmu4Qvw6VVXq26Hc1DUJJ9cucjsoAww/OTFrzH4sVLP8T+K0s5CP8x6Il7zwhwzbmI7JHtZXZFL4JA7+414gKdXNIEHrikrZNMEebIjUb7VHsWV6eMU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703024256; 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=qnfg9HvF6Zlb1d33Xg595udEsk95iAOk+rWkOuDM7Jg=; b=FwKvwlL61pcuba9b4ACGEOYgH4XqByDHgxHvn+NPNQtr3pkPm1w2f6Rni0TaSyJLzcAR3Z 2/DzDvAXJyQsRz6Ze1eNj8p/JZoDNaRR4p+RzMUro9ejxidgq3mE+A59ScgAYAB2w9MAQT 1SIwDmY1u4rWBk8nursdYjzyVBLznPo= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-50-MrgdwrYPNFGOE7_MCRnI0w-1; Tue, 19 Dec 2023 17:17:35 -0500 X-MC-Unique: MrgdwrYPNFGOE7_MCRnI0w-1 Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3b8b66d49easo5719591b6e.1 for ; Tue, 19 Dec 2023 14:17:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703024254; x=1703629054; 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=qnfg9HvF6Zlb1d33Xg595udEsk95iAOk+rWkOuDM7Jg=; b=oe9QShjyz55+YEYrCWIpzzJpmkiJasofer1NTk/e7U1lCbUynIpZYxsgiCOS34SREm 5VrZJGWecD/xlXrKH6kMJU2pYLlxAGm8vWwdxPodRLCOSvCD4xYECul7hd+vykTzMe8Y APa6tmoIoISk6Vihguj09pgOSt3shBaqy93Uu/AuDT034DfZWC8DTRfQOxrzQK5VG5dn GRBxjdWKAb3eA4jdPFLl/EYUulhDZVTGyJhV/TigWlPiB3iSpACQ8RQG7a1RzA8ayYmK W5o3L7sifEJToWfWMBS0GkaeBw75P6yniatUt7rsW07RGKigPl9UtpNgeY/toNgECrl/ RVRw== X-Gm-Message-State: AOJu0YzJIKBIrz9zimAjFO6tGevpk0GaF3bJRXvX4NsPfD5CjxTFSHf4 5aMCeI2OigwMc0uRo1tJ/FybTwNQc7M5ahm9yr+OWn4sj8XeMG3SskerZMBsq5yZG8uE018IOim 7tHCtyXcvL+C622FSCdFWXXBRt4U2Y6gUry2ml6mDnr9XL3gOdMYrh1xmrw1g/VGZB4rnILTbaA == X-Received: by 2002:a05:6808:4446:b0:3ba:133d:7c88 with SMTP id ep6-20020a056808444600b003ba133d7c88mr17511686oib.99.1703024254031; Tue, 19 Dec 2023 14:17:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsA4H2hh+OM9lKLdwOpASLgkZoXDgPFvAH43mMXw1Hf/PkoK8Vx3nDMCkfEaby3NF1S2zG5w== X-Received: by 2002:a05:6808:4446:b0:3ba:133d:7c88 with SMTP id ep6-20020a056808444600b003ba133d7c88mr17511670oib.99.1703024253560; Tue, 19 Dec 2023 14:17:33 -0800 (PST) Received: from jason.com (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 jo5-20020a056214500500b0067ef283845asm2911220qvb.41.2023.12.19.14.17.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 14:17:33 -0800 (PST) From: Jason Merrill To: gcc-patches@gcc.gnu.org, Joseph Myers Subject: [PATCH RFA] opts: -Werror=foo always implies -Wfoo [PR106213] Date: Tue, 19 Dec 2023 17:17:31 -0500 Message-Id: <20231219221731.2944661-1-jason@redhat.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.5 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,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-pc-linux-gnu, OK for trunk? -- 8< -- -Werror=foo implying -Wfoo wasn't working for -Wdeprecated-copy-dtor, because it is specified as the value 2 of warn_deprecated_copy, which shows up as CLVC_EQUAL, which is not one of the three var_types handled by control_warning_option. It seems to me that we can just unconditionally handle_generated_option, and only have special argument handling for those types. PR c++/106213 gcc/ChangeLog: * opts-common.cc (control_warning_option): Call handle_generated_option for all cl_var_types. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/depr-copy5.C: New test. --- gcc/opts-common.cc | 14 +++++++------- gcc/testsuite/g++.dg/cpp0x/depr-copy5.C | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/depr-copy5.C diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc index f0c5f483665..cc3216cf1f1 100644 --- a/gcc/opts-common.cc +++ b/gcc/opts-common.cc @@ -1907,14 +1907,14 @@ control_warning_option (unsigned int opt_index, int kind, const char *arg, diagnostic_classify_diagnostic (dc, opt_index, (diagnostic_t) kind, loc); if (imply) { - const struct cl_option *option = &cl_options[opt_index]; - /* -Werror=foo implies -Wfoo. */ + const struct cl_option *option = &cl_options[opt_index]; + HOST_WIDE_INT value = 1; + if (option->var_type == CLVC_INTEGER || option->var_type == CLVC_ENUM || option->var_type == CLVC_SIZE) { - HOST_WIDE_INT value = 1; if (arg && *arg == '\0' && !option->cl_missing_ok) arg = NULL; @@ -1961,11 +1961,11 @@ control_warning_option (unsigned int opt_index, int kind, const char *arg, return; } } - - handle_generated_option (opts, opts_set, - opt_index, arg, value, lang_mask, - kind, loc, handlers, false, dc); } + + handle_generated_option (opts, opts_set, + opt_index, arg, value, lang_mask, + kind, loc, handlers, false, dc); } } diff --git a/gcc/testsuite/g++.dg/cpp0x/depr-copy5.C b/gcc/testsuite/g++.dg/cpp0x/depr-copy5.C new file mode 100644 index 00000000000..377bf5dbec1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/depr-copy5.C @@ -0,0 +1,16 @@ +// PR c++/106213 +// { dg-additional-options -Werror=deprecated-copy-dtor } +// { dg-prune-output "warnings being treated as errors" } + +struct s { + int* i; + s(); + ~s() { delete i; } +}; + + +void bar(){ + s instance; + s instance2 = instance; + // { dg-error "deprecated-copy-dtor" "" { target c++11 } .-1 } +} base-commit: 1502d724df85163b14b04e8f67072ca88eac411d -- 2.39.3