From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id EB7573858C83 for ; Fri, 22 Apr 2022 16:44:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB7573858C83 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ispras.ru Received: from [10.10.3.121] (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id 40A3D4076261; Fri, 22 Apr 2022 16:44:13 +0000 (UTC) Date: Fri, 22 Apr 2022 19:44:13 +0300 (MSK) From: Alexander Monakov To: Max Sagebaum cc: "gcc-help@gcc.gnu.org" Subject: Re: Detect '-fvisibility=hidden' during pre process or compile time In-Reply-To: <4fc5fa2b65c0f9f16a304250c6a41604485f0650.camel@scicomp.uni-kl.de> Message-ID: <879387da-db54-226-9bab-25fe98d14e40@ispras.ru> References: <6e75545cc24f1198502ec3a517a1a7dcb5054742.camel@scicomp.uni-kl.de> <59e49ece-4353-5a81-905a-34c296d3ec8@ispras.ru> <4fc5fa2b65c0f9f16a304250c6a41604485f0650.camel@scicomp.uni-kl.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2022 16:44:18 -0000 On Fri, 22 Apr 2022, Max Sagebaum wrote: > Hello Alexander, > > thank you for the answer. Unfortunately, the type needs to be a template > parameter. Is there any other way to change the visibility of a member or in > addition change the visibility of a template parameter? You can change visibility of the type used as the template parameter; in the small example in the Bugzilla, you could write struct __attribute__((visibility("default"))) S { }; or with a pragma: #pragma GCC visibility push(default) struct S { }; #pragma GCC visibility pop If in your actual library such 'struct S' has many members and you want to avoid making them default-visibility, you could move some of them into a subobject (which then may have hidden visibility). Alexander