From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46141 invoked by alias); 19 Dec 2019 21:47:50 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 46106 invoked by uid 89); 19 Dec 2019 21:47:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=explains, grain, RejectNegative, rejectnegative X-HELO: mail.theobroma-systems.com Received: from vegas.theobroma-systems.com (HELO mail.theobroma-systems.com) (144.76.126.164) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Dec 2019 21:47:48 +0000 Received: from 198-48-134-99.cpe.pppoe.ca ([198.48.134.99]:50890 helo=[192.168.1.119]) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1ii3e3-0007i6-MQ; Thu, 19 Dec 2019 22:47:43 +0100 From: Erick Ochoa Subject: Option flag with string arguments To: GCC Development Cc: =?UTF-8?Q?Christoph_M=c3=bcllner?= , "Dr. Philipp Tomsich" Message-ID: <880c8375-41c6-eb54-7a3c-79e88c066b33@theobroma-systems.com> Date: Thu, 19 Dec 2019 21:47:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-12/txt/msg00343.txt.bz2 Hello, I am working on testing an optimization. I am starting to write tests in the GCC testing suite. However, I want to develop some fine grain testing for my own sake. This optimization I am working on, is a variant of struct reordering. One way I would like to test my pass is for example, making a test case and guaranteeing that my pass is able to detect global variables of a specific struct type. For example, given the following C file ``` /* { dg-lto-options {{-flto -fipa-struct-reorg -fipa-struct-reorg-assert-has-structs=astruct_s}} } */ struct astruct_s { _Bool a; }; struct astruct_s astruct; int main() { }; ``` I would like to create the option flag that has a list of string arguments -fipa-struct-reorg-assert-has-structs=+ such that during the analysis time, I'd be able to have an assertion to make sure that my pass has actually collected the types identified by the strings. I'm not very familiar on the DSL to specify option flags. I've looked at gcc/common.opt for some examples and found this one: ``` frandom-seed= Common Joined RejectNegative Var(common_deferred_options) Defer -frandom-seed= Make compile reproducible using . ``` Could anyone explain how to specify my flag? Or possibly point to some documentation/source that explains Common, Joined, etc...?