From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3279 invoked by alias); 4 May 2018 17:20:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3266 invoked by uid 89); 4 May 2018 17:20:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=our, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 May 2018 17:20:28 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1F2B8117C4A; Fri, 4 May 2018 13:20:27 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TMjmkD8hngnQ; Fri, 4 May 2018 13:20:27 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E2A33117C49; Fri, 4 May 2018 13:20:26 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 0F1E883055; Fri, 4 May 2018 10:20:25 -0700 (PDT) Date: Fri, 04 May 2018 17:20:00 -0000 From: Joel Brobecker To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Define GNULIB_NAMESPACE in unittests/string_view-selftests.c Message-ID: <20180504172024.oftwmo7ikifetquo@adacore.com> References: <1525382648-30186-1-git-send-email-simon.marchi@ericsson.com> <20180504165552.f4y7zcxzmgvwngel@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2018-05/txt/msg00105.txt.bz2 > > What worries me is that I don't see what's preventing us from hitting > > that issue outside of the unittests code? We know we can adjust our > > own classes, but this problem occured with a system class, so we had > > no choice but to use GNULIB_NAMESPACE. I worry that the transition > > from no GNULIB_NAMESPACE to using GNULIB_NAMESPACE in a given unit > > will leave some C system calls that should normally be covered by > > gnulib silently now reverting to the system (buggy) version. > > Actually, gnulib seems to poison the function it replaces, so we won't be > able to use it by mistake. Let's say I add a "close" call: > > CXX unittests/string_view-selftests.o > /home/emaisin/src/binutils-gdb/gdb/unittests/string_view-selftests.c: In function ‘void selftests::string_view::run_tests()’: > /home/emaisin/src/binutils-gdb/gdb/unittests/string_view-selftests.c:169:12: error: call to ‘close’ declared with attribute warning: The symbol ::close refers to the system function. Use gnulib::close instead. [-Werror] > close (0); > ^ > > And since we can enable GNULIB_NAMESPACE per compilation unit, we can > do it progressively. Once we are done, we can remove all those > GNULIB_NAMESPACE defines and have a single one in common-defs.h, just > before including gnulib. Aha! This completely reassures me. Thanks! -- Joel