From patchwork Fri Jun 8 11:09:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 926682 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-479327-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FE5HOnHD"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 412KSQ4LR4z9s3q for ; Fri, 8 Jun 2018 21:09:56 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=E13kmqsG4JDT/hKQV Lglf96uwL4OjdPo8vdqhzORySHfPQfRKzkd/5xNczAgzjzilsTdApqzpAA/Db58V e/prSiiByo8HYevEJqdkv8Msqf1B+77MZbBKxEm1HjHNfP/icfK46r6ipBgXFlpi OiSyUOxZdSW9zfegh6Jo/Lj1AE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=ljxoN/9e4Vrru09X1EM2MC+ uyfY=; b=FE5HOnHD5/1LhON1WsHchR/zUaoWg+1KveagBiTkuX8wpSasyxwKz3A 2YG3stV9YviQBMkWU23XzEQsG1DpZ/vs5SWMAmQ79uj538c1CpJy/RWTl7MuFJLE VkCG0LJvi3vt0jlLdpb8rBlMA1Ko9X9FUm1W1xeujWJ8hps+l1EU= Received: (qmail 73358 invoked by alias); 8 Jun 2018 11:09:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 73349 invoked by uid 89); 8 Jun 2018 11:09:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=cc1, Undocumented, undocumented, warning_at X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 08 Jun 2018 11:09:45 +0000 Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CC44FAF48; Fri, 8 Jun 2018 11:09:42 +0000 (UTC) Subject: [PATCH] Come up with Deprecated option flag. From: =?utf-8?q?Martin_Li=C5=A1ka?= To: GCC Patches Cc: Ilya Enkovich , Richard Biener , =?utf-8?q?Jan_Hubi=C4=8D?= =?utf-8?q?ka?= References: <8d95daa6-fc51-9433-7f4b-06bac83c9b9a@suse.cz> Message-ID: Date: Fri, 8 Jun 2018 13:09:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <8d95daa6-fc51-9433-7f4b-06bac83c9b9a@suse.cz> X-IsSubscribed: yes Hi. First follow-up MPX removal patch comes up with Deprecated option flag. That prints warning for options that have no effect: $ ./xgcc -B. /tmp/main.c -Wchkp -static-libmpxwrappers xgcc: warning: deprecated command line option ‘-static-libmpxwrappers’ cc1: warning: deprecated command line option ‘-Wchkp’ Is the string OK, or? Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Martin From 0b1473e517373386e674c6736de5007960138d03 Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 8 Jun 2018 10:52:23 +0200 Subject: [PATCH] Come up with Deprecated option flag. gcc/ChangeLog: 2018-06-08 Martin Liska * config/i386/i386.opt: Make MPX-related options as Deprecated. * opt-functions.awk: Handle Deprecated flag. * opts-common.c (decode_cmdline_option): Handle cl_deprecated and report error. (read_cmdline_option): Report warning for a deprecated option. * opts.h (struct cl_option): Add new field cl_deprecated. (CL_ERR_DEPRECATED): New. gcc/c-family/ChangeLog: 2018-06-08 Martin Liska * c.opt: Make MPX-related options as Deprecated. gcc/testsuite/ChangeLog: 2018-06-08 Martin Liska * g++.dg/opt/mpx.C: New test. * gcc.target/i386/mpx.c: New test. --- gcc/c-family/c.opt | 42 ++++++++++++++--------------- gcc/config/i386/i386.opt | 2 +- gcc/opt-functions.awk | 3 ++- gcc/opts-common.c | 10 +++++++ gcc/opts.h | 3 +++ gcc/testsuite/g++.dg/opt/mpx.C | 5 ++++ gcc/testsuite/gcc.target/i386/mpx.c | 3 +++ 7 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/mpx.C create mode 100644 gcc/testsuite/gcc.target/i386/mpx.c diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 1d7eafff1f7..b4aefd8d5f6 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -409,7 +409,7 @@ C ObjC C++ ObjC++ Var(warn_char_subscripts) Warning LangEnabledBy(C ObjC C++ Obj Warn about subscripts whose type is \"char\". Wchkp -C ObjC C++ ObjC++ Var(warn_chkp) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) +C ObjC C++ ObjC++ Var(warn_chkp) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Deprecated Deprecated in GCC 9. This switch has no effect. Wclobbered @@ -1259,86 +1259,86 @@ C ObjC C++ ObjC++ Where shorter, use canonicalized paths to systems headers. fcheck-pointer-bounds -C ObjC C++ ObjC++ LTO Report Var(flag_check_pointer_bounds) +C ObjC C++ ObjC++ LTO Report Var(flag_check_pointer_bounds) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-check-incomplete-type -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_incomplete_type) Init(1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_incomplete_type) Init(1) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-zero-input-bounds-for-main -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_zero_input_bounds_for_main) Init(0) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_zero_input_bounds_for_main) Init(0) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-first-field-has-own-bounds -C ObjC C++ ObjC++ LTO RejectNegative Report Var(flag_chkp_first_field_has_own_bounds) +C ObjC C++ ObjC++ LTO RejectNegative Report Var(flag_chkp_first_field_has_own_bounds) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-narrow-bounds -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_narrow_bounds) Init(1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_narrow_bounds) Init(1) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-narrow-to-innermost-array -C ObjC C++ ObjC++ LTO RejectNegative Report Var(flag_chkp_narrow_to_innermost_arrray) +C ObjC C++ ObjC++ LTO RejectNegative Report Var(flag_chkp_narrow_to_innermost_arrray) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-flexible-struct-trailing-arrays -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_flexible_struct_trailing_arrays) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_flexible_struct_trailing_arrays) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-optimize C ObjC C++ ObjC++ LTO Report Var(flag_chkp_optimize) Init(-1) fchkp-use-fast-string-functions -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_fast_string_functions) Init(0) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_fast_string_functions) Init(0) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-use-nochk-string-functions -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_nochk_string_functions) Init(0) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_nochk_string_functions) Init(0) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-use-static-bounds -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_static_bounds) Init(1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_static_bounds) Init(1) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-use-static-const-bounds -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_static_const_bounds) Init(-1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_static_const_bounds) Init(-1) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-treat-zero-dynamic-size-as-infinite -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_zero_dynamic_size_as_infinite) Init(0) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_zero_dynamic_size_as_infinite) Init(0) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-check-read -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_check_read) Init(1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_check_read) Init(1) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-check-write -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_check_write) Init(1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_check_write) Init(1) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-store-bounds -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_store_bounds) Init(1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_store_bounds) Init(1) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-instrument-calls -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_instrument_calls) Init(1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_instrument_calls) Init(1) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-instrument-marked-only -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_instrument_marked_only) Init(0) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_instrument_marked_only) Init(0) Deprecated Deprecated in GCC 9. This switch has no effect. fchkp-use-wrappers -C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_wrappers) Init(1) +C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_wrappers) Init(1) Deprecated Deprecated in GCC 9. This switch has no effect. static-libmpx -Driver +Driver Deprecated Deprecated in GCC 9. This switch has no effect. static-libmpxwrappers -Driver +Driver Deprecated Deprecated in GCC 9. This switch has no effect. fcilkplus Undocumented diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index 01a0385dfa4..a34d4acf1a2 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -951,7 +951,7 @@ Target Report Mask(ISA_RTM) Var(ix86_isa_flags) Save Support RTM built-in functions and code generation. mmpx -Target Report +Target Report Deprecated Deprecated in GCC 9. This switch has no effect. mmwaitx diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index 819a9629ab9..2c371e5a23a 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -136,7 +136,8 @@ function switch_bit_fields (flags) flag_init("UInteger", flags) \ flag_init("Host_Wide_Int", hwi) \ flag_init("ToLower", flags) \ - flag_init("Report", flags) + flag_init("Report", flags) \ + flag_init("Deprecated", flags) sub(", $", "", result) return result diff --git a/gcc/opts-common.c b/gcc/opts-common.c index c6b94188b40..004da73e614 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -667,6 +667,10 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, if (!option_ok_for_language (option, lang_mask)) errors |= CL_ERR_WRONG_LANG; + /* Mark all deprecated options. */ + if (option->cl_deprecated) + errors |= CL_ERR_DEPRECATED; + /* Convert the argument to lowercase if appropriate. */ if (arg && option->cl_tolower) { @@ -1250,6 +1254,12 @@ read_cmdline_option (struct gcc_options *opts, return; } + if (decoded->errors & CL_ERR_DEPRECATED) + { + warning_at (loc, 0, "deprecated command line option %qs", opt); + return; + } + gcc_assert (!decoded->errors); if (!handle_option (opts, opts_set, decoded, lang_mask, DK_UNSPECIFIED, diff --git a/gcc/opts.h b/gcc/opts.h index 484fc1c39d9..3c4065eae92 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -100,6 +100,8 @@ struct cl_option BOOL_BITFIELD cl_tolower : 1; /* Report argument with -fverbose-asm */ BOOL_BITFIELD cl_report : 1; + /* Deprecated option */ + BOOL_BITFIELD cl_deprecated: 1; /* Offset of field for this option in struct gcc_options, or (unsigned short) -1 if none. */ unsigned short flag_var_offset; @@ -209,6 +211,7 @@ extern const unsigned int cl_enums_count; #define CL_ERR_NEGATIVE (1 << 6) /* Negative form of option not permitted (together with OPT_SPECIAL_unknown). */ +#define CL_ERR_DEPRECATED (1 << 7) /* Deprecated option. */ /* Structure describing the result of decoding an option. */ diff --git a/gcc/testsuite/g++.dg/opt/mpx.C b/gcc/testsuite/g++.dg/opt/mpx.C new file mode 100644 index 00000000000..6ae0cef8790 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/mpx.C @@ -0,0 +1,5 @@ +// { dg-do compile } +// { dg-options "-fcheck-pointer-bounds -fchkp-first-field-has-own-bounds" } + +// { dg-warning "deprecated command line option .-fcheck-pointer-bounds." "" { target *-*-* } 0 } +// { dg-warning "deprecated command line option .-fchkp-first-field-has-own-bounds." "" { target *-*-* } 0 } diff --git a/gcc/testsuite/gcc.target/i386/mpx.c b/gcc/testsuite/gcc.target/i386/mpx.c new file mode 100644 index 00000000000..f152ae94ecb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +// { dg-options "-mmpx" } +// { dg-warning "deprecated command line option .-mmpx." "" { target *-*-* } 0 } -- 2.17.0