git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Stefan Beller" <sbeller@google.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Git List" <git@vger.kernel.org>,
	git-packagers@googlegroups.com,
	"Han-Wen Nienhuys" <hanwen@google.com>
Subject: Re: [PATCH] Makefile: enable DEVELOPER by default
Date: Sun, 5 Aug 2018 00:57:36 -0700	[thread overview]
Message-ID: <20180805075736.GF44140@aiede.svl.corp.google.com> (raw)
In-Reply-To: <CAPig+cRjxLgGZbROZAuH-VF3xLVUxQTRj7gKPFurypbwz2zzjg@mail.gmail.com>

Hi,

Eric Sunshine wrote:
> On Sat, Aug 4, 2018 at 11:17 PM Jonathan Nieder <jrnieder@gmail.com> wrote:

>>> utf8.c:486:28: warning: passing 'iconv_ibp *' (aka 'const char **') to parameter
>>>       of type 'char **' discards qualifiers in nested pointer types
>>>       [-Wincompatible-pointer-types-discards-qualifiers]
>>
>> Oh, good catch!  POSIX documents iconv has having signature
>>
>>         size_t iconv(iconv_t cd, char **restrict inbuf,
>>                size_t *restrict inbytesleft, char **restrict outbuf,
>>                size_t *restrict outbytesleft);
>>
>> config.mak.uname contains
>>
>>         ifeq ($(uname_S),FreeBSD)
>>                 NEEDS_LIBICONV = YesPlease
>>                 OLD_ICONV = YesPlease
>>
>> So it looks like FreeBSD has modernized and we need to make that
>> conditional in config.mak.uname on $(uname_R).  Do you know which
>> version of FreeBSD changed the signature?  Care to write a patch?
>
> Unfortunately, I don't know in which version of FreeBSD that changed.

"git blame" tells me it's from r281550[1] (Remove the const qualifier
from iconv(3) to comply with POSIX, 2015-04-15), which was part of
FreeBSD 11.  r282275[2] (2015-04-30) backported the same change to
FreeBSD 10 and is part of 10.2.

FreeBSD 9 has

	#define iconv(cd, in, insize, out, outsize)    libiconv(cd, __DECONST(char **, in), insize, out, outsize)

from r219019[3] (2011-02-25).  I don't know what to make of it.  The
underlying libiconv function it calls takes char ** (the modern thing)
but the macro does the __DECONST thing for compatibility with GNU
libiconv.

Older versions, going back at least as far as FreeBSD 3, behave the
same way as FreeBSD 9.  So that must be what was tested with
OLD_ICONV=YesPlease.

FreeBSD 10.1.0 and 10.0.0 have

	size_t  iconv(iconv_t, const char ** __restrict,
		      size_t * __restrict, char ** __restrict,
		      size_t * __restrict);

which also needs OLD_ICONV.  If I assume everyone on 10.x is using
10.2 or newer, then the patch could be something like this (completely
untested):

diff --git i/config.mak.uname w/config.mak.uname
index 684fc5bf026..8078c099313 100644
--- i/config.mak.uname
+++ w/config.mak.uname
@@ -192,7 +192,9 @@ ifeq ($(uname_O),Cygwin)
 endif
 ifeq ($(uname_S),FreeBSD)
 	NEEDS_LIBICONV = YesPlease
-	OLD_ICONV = YesPlease
+	ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
+		OLD_ICONV = YesPlease
+	endif
 	NO_MEMMEM = YesPlease
 	BASIC_CFLAGS += -I/usr/local/include
 	BASIC_LDFLAGS += -L/usr/local/lib

Deciding whether to fix the pattern matching to also include 10.0 and
10.1 (and doing so if warranted) is left as an exercise to the reader.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

[1] https://github.com/freebsd/freebsd/commit/b0813ee288f64f677a2cebf7815754b027a8215b
[2] https://github.com/freebsd/freebsd/commit/b709ec868adb5170d09bc5a66b18d0e0d5987ab6
[3] https://github.com/freebsd/freebsd/commit/c91ab1769b1237e3663d59888cebe31ceee47570

  parent reply	other threads:[~2018-08-05  7:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-04  2:00 [PATCH] Makefile: enable DEVELOPER by default Stefan Beller
2018-08-04  2:02 ` Stefan Beller
2018-08-04  6:09   ` Jonathan Nieder
2018-08-04  6:38     ` Duy Nguyen
2018-08-04 17:19       ` Junio C Hamano
2018-08-06 16:40         ` Ævar Arnfjörð Bjarmason
2018-08-06 17:02           ` Jeff King
2018-08-06 17:04             ` Randall S. Becker
2018-08-06 17:11             ` Jonathan Nieder
2018-08-06 18:59               ` Jeff King
2018-08-06 17:39             ` Ævar Arnfjörð Bjarmason
2018-08-06 18:38             ` Stefan Beller
2018-08-06 17:02           ` Randall S. Becker
2018-08-06 17:41             ` Ævar Arnfjörð Bjarmason
2018-08-06 19:20               ` Randall S. Becker
2018-09-01 21:01             ` Kaartic Sivaraam
2018-08-05  2:42       ` Eric Sunshine
2018-08-05  3:17         ` Jonathan Nieder
2018-08-05  3:33           ` Eric Sunshine
2018-08-05  4:58             ` Eric Sunshine
2018-08-05  7:57             ` Jonathan Nieder [this message]
2018-08-31  8:33               ` [PATCH] config.mak.uname: resolve FreeBSD iconv-related compilation warning Eric Sunshine
2018-08-31 11:54                 ` Ævar Arnfjörð Bjarmason
2018-08-31 18:31                   ` Eric Sunshine
2018-08-31 17:00                 ` Jonathan Nieder
2018-08-31 20:59                   ` Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180805075736.GF44140@aiede.svl.corp.google.com \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git-packagers@googlegroups.com \
    --cc=git@vger.kernel.org \
    --cc=hanwen@google.com \
    --cc=pclouds@gmail.com \
    --cc=sbeller@google.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).