From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D7FB11F5AE for ; Sat, 5 Jun 2021 16:21:18 +0000 (UTC) Received: from localhost ([::1]:51876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpZ2z-0002r1-Vz for normalperson@yhbt.net; Sat, 05 Jun 2021 12:21:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpZ2w-0002qW-JO for bug-gnulib@gnu.org; Sat, 05 Jun 2021 12:21:14 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:33313) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpZ2u-0005ZE-Lf for bug-gnulib@gnu.org; Sat, 05 Jun 2021 12:21:14 -0400 Received: by mail-ot1-x334.google.com with SMTP id q9-20020a9d66490000b02903c741e5b703so11103438otm.0 for ; Sat, 05 Jun 2021 09:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/rvRwTFzIm2PzrOU+ac3oA/KSUHJY37PW9NS5zKdv8I=; b=Up1EgZsvo5Wf/RY8nxI/6nkgxjwROhEMQ/KwNvuNM2cHfpapJ/5prijvLhO7XZDSvW IpEJCveMD7lkZEvobEXOdgnrIzArTBa2jEMOxs9Ki1AAc57E/SOalfsH+pFUkyd3vMMO 29AhCK3sqLvkcgyxkawiD/1r4Wao/MA5tzTUdFE6VSIc8CKUxu7+KEYMBYOdhXUlvi8s pgJybpiM1AU96/nSEJX6d0uI+4wdcSgsD2pRJ+sVkBVpZVDRDZO1JCi/vbWY3IAvYiNQ EgYgP63ZOSVw/0lzAltAYp28AkWED1akbuaZBuGNEg5GU9KlCGC9Qqke+wGNvQbEL1Wu wFKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/rvRwTFzIm2PzrOU+ac3oA/KSUHJY37PW9NS5zKdv8I=; b=IxEgPr5kOibFb4r8lqsno/9r5KH9b6Y7R/tOCNA5UhiaTH0se64ot1848mF3kitJC5 drkU7qoSrfJYMWi/fMe8cwa2Lt2jrMnAPj4h3YXlYeh/WiT+e9AFsLLUpZPy3y4sBO1S Wh/8jSBNn/gE562AEE2z7hwtPfKPB796AJoC+gDzHCUz6mdQAHY03/bTRC4lY5xjIWYM 8N0HdgXnlolDFrVkHxzSAEX6yUzI6xTYjgqyobQOc5hqhIwq4B32jUxBpqIL2H3Gm0vR ISVHCi7SaKumMTECw5zlCzb07ax+/azuaWQcjX6ncKmvuwhh9oLCqYc+OgjWqP/ITLfL CRbQ== X-Gm-Message-State: AOAM530YOfZADJV0r0H7xVGJzRkDQ5AKv33F/fjcILP9o3jNqssBAWTM vwH3KH8pRyHgk3JON5l3x7XxHpW7wZOdi/HmrvBSEvHd X-Google-Smtp-Source: ABdhPJw6twN7E8umEFpoWFfhQFY37+tFD6YrLqzDkwsh0/kTBojpSGapfIrQGm3oJUriWBHaVJ/Q8iZjVrlZiJmGNgA= X-Received: by 2002:a05:6830:18fb:: with SMTP id d27mr7821397otf.235.1622910071049; Sat, 05 Jun 2021 09:21:11 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:d2d1:0:0:0:0:0 with HTTP; Sat, 5 Jun 2021 09:21:10 -0700 (PDT) In-Reply-To: <162293739.qyZAu42AHI@omega> References: <3040583.kt1Z02HjJg@omega> <162293739.qyZAu42AHI@omega> From: Ozkan Sezer Date: Sat, 5 Jun 2021 19:21:10 +0300 Message-ID: Subject: Re: [PATCH] make gl_VISIBILITY to reject unsupported configurations with newer gcc To: Bruno Haible Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=sezeroz@gmail.com; helo=mail-ot1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On 6/5/21, Bruno Haible wrote: > Ozkan Sezer wrote: >> >> The attached patch makes gl_VISIBILITY to reject unsupported >> >> configurations >> >> with newer gcc: In its current form, mingw gcc-4.5.4 rejects the >> >> attributes >> >> but gcc-7.5 does not, apparently because the attributes are applied to >> >> func >> >> prototypes without their definitions. Attaching a hidden visibility >> >> attrib >> >> to dummyfunc() makes gcc-7.5 to reject it properly. >> > >> > I don't fully understand why we should apply the patch. >> > >> > With gcc 7.5 on mingw and the visibility.m4 that is in gnulib now: >> > What is the result of the >> > checking for simple visibility declarations... >> > test? What are the effects: warnings? compilation errors? link errors? >> > too >> > many exported symbols? too few exported symbols? >> >> No warnings from the testcase in m4. In real-life, it results in >> warnings, >> see e.g.: https://github.com/libsndfile/libsamplerate/issues/154 > > OK, I understand better now. > > In the GCC source code I see that the > "visibility attribute not supported in this configuration; ignored" > warning is emitted when a definition is emitted. Therefore I think the > safest patch is to add a definition for each declaration in the test code. > > > 2021-06-05 Bruno Haible > > lib-symbol-visibility: Make configure check work for newer GCC. > Reported by Ozkan Sezer in > . > * m4/visibility.m4 (gl_VISIBILITY): Add a function definition for each > declaration in the test program. > > diff --git a/m4/visibility.m4 b/m4/visibility.m4 > index 8f27a12..d161bd7 100644 > --- a/m4/visibility.m4 > +++ b/m4/visibility.m4 > @@ -1,4 +1,4 @@ > -# visibility.m4 serial 7 > +# visibility.m4 serial 8 > dnl Copyright (C) 2005, 2008, 2010-2021 Free Software Foundation, Inc. > dnl This file is free software; the Free Software Foundation > dnl gives unlimited permission to copy and/or distribute it, > @@ -59,6 +59,10 @@ AC_DEFUN([gl_VISIBILITY], > extern __attribute__((__visibility__("hidden"))) int > hiddenfunc (void); > extern __attribute__((__visibility__("default"))) int > exportedfunc (void); > void dummyfunc (void); > + int hiddenvar; > + int exportedvar; > + int hiddenfunc (void) { return 51; } > + int exportedfunc (void) { return 1225736919; } > void dummyfunc (void) {} > ]], > [[]])], > > Works for me: configure:13230: checking for simple visibility declarations configure:13261: x86_64-w64-mingw32-gcc -c -g -O2 -Wall -fvisibility=hidden -Werror conftest.c >&5 conftest.c: In function 'hiddenfunc': conftest.c:37:15: error: visibility attribute not supported in this configuration; ignored [-Werror=attributes] int hiddenfunc (void) { return 51; } ^~~ conftest.c: At top level: conftest.c:47:1: error: visibility attribute not supported in this configuration; ignored [-Werror=attributes] } ^ cc1: all warnings being treated as errors configure:13261: $? = 1