From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111808 invoked by alias); 29 May 2016 14:58:44 -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 111793 invoked by uid 89); 29 May 2016 14:58:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=netherlands, Netherlands, HX-HELO:sk:mail-yw, solving X-HELO: mail-yw0-f181.google.com Received: from mail-yw0-f181.google.com (HELO mail-yw0-f181.google.com) (209.85.161.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 29 May 2016 14:58:30 +0000 Received: by mail-yw0-f181.google.com with SMTP id h19so144762470ywc.0 for ; Sun, 29 May 2016 07:58:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=lK10SnDl1JHFLvIHjPwRpReHr6Qv56hPGW0yPvJTYK8=; b=U4Jh+vTz3xVjjUhuVOY0HXSXdc3tDIVfdXUZhYCY/HBKXb4Cu/GIht0zyJXZAk8skg c+xHK3kIBKlwoOYdpgvQivMnElGXYP1R1tT8DD97ddusBkwiWgCcZl/uHaBarx+gcxcJ FZNV67dBWxF5X6YuC45p6qnsidbHfsYOV5GuPU5TykmPsF0krHkvIgXAq7Rt/wm/5THt v9Rtrc1rRgDM9okhm4nPL0NQlt3P4Lu9DYYUMxLVjas6UPRpandPxMF9fUttJqxK7tb5 ghv+kPY1a4VAuHqkNmtT5goSgtf7VDIkcS7QHXMxwAAYdiw/0obcuHVnB8l1ZhUOXrul 5znQ== X-Gm-Message-State: ALyK8tLG9viWM7Ao+7+O93GvOpgrKbsyfvQgTMn/Jv2YtIyr10tUAk2qIpyYrvEoDI9WhVRBVLjAXLBXd3bTIg== MIME-Version: 1.0 X-Received: by 10.129.53.70 with SMTP id c67mr15482998ywa.149.1464533908648; Sun, 29 May 2016 07:58:28 -0700 (PDT) Received: by 10.13.201.199 with HTTP; Sun, 29 May 2016 07:58:28 -0700 (PDT) Date: Sun, 29 May 2016 14:58:00 -0000 Message-ID: Subject: Likely incorrect patch: remove the faulty basename() prototype from libiberty From: Ed Schouten To: gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2016-05/txt/msg00522.txt.bz2 Hi there, Libiberty has the prototype of basename() declared in its libiberty.h. Unfortunately, it has it declared with a different prototype as standardized by POSIX. POSIX requires that its argument is of type "char *', while the one in libiberty.h uses "char *". Normally this problem is not exposed at all, because none of the GDB code includes the header file with the actual prototype (libgen.h). I'm currently working on patching up FreeBSD to also use the prototype as standardized by POSIX, as opposed to the BSD-specific one that has "const char *'. In FreeBSD we have some utilities built against GDB (e.g., our kernel debugger kgdb) that ends up including both libiberty.h and libgen.h. meaning we get compiler errors due to different declarations for the same function. For now I'm solving this by simply patching up libiberty to pull in the declaration from libgen.h. This seems to make everything build again. diff --git a/include/libiberty.h b/include/libiberty.h index 8e096a0..403e690 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -109,7 +109,7 @@ extern int countargv (char**); || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \ || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \ || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) -extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); +#include #else /* Do not allow basename to be used if there is no prototype seen. We either need to use the above prototype or have one from I guess that this is not the right way of solving this. I'd guess that we should just remove all of the basename() specific bits from all of libiberty and just include libgen.h in the source files that actually need it. What do you folks think? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717