git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Makefile: enable DEVELOPER by default

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 5, 2018, 07:57 UTC
Message-ID
<20180805075736.GF44140@aiede.svl.corp.google.com>
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:
Show 21 quoted lines
>>> 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
Previous: Eric SunshineNext: Eric Sunshine
Message 21 of 26 in “Makefile: enable DEVELOPER by default”
  1. Makefile: enable DEVELOPER by defaultStefan Beller, Aug 4, 2018
  2. Makefile: enable DEVELOPER by defaultStefan Beller, Aug 4, 2018
  3. Jonathan NiederAug 4, 2018
  4. Duy NguyenAug 4, 2018
  5. Junio C HamanoAug 4, 2018
  6. Ævar Arnfjörð BjarmasonAug 6, 2018
  7. Jeff KingAug 6, 2018
  8. Randall S. BeckerAug 6, 2018
  9. Jonathan NiederAug 6, 2018
  10. Jeff KingAug 6, 2018
  11. Ævar Arnfjörð BjarmasonAug 6, 2018
  12. Stefan BellerAug 6, 2018
  13. Randall S. BeckerAug 6, 2018
  14. Ævar Arnfjörð BjarmasonAug 6, 2018
  15. Randall S. BeckerAug 6, 2018
  16. Kaartic SivaraamSep 1, 2018
  17. Eric SunshineAug 5, 2018
  18. Jonathan NiederAug 5, 2018
  19. Eric SunshineAug 5, 2018
  20. Eric SunshineAug 5, 2018
  21. Jonathan NiederAug 5, 2018
  22. config.mak.uname: resolve FreeBSD iconv-related compilation warningEric Sunshine, Aug 31, 2018
  23. Ævar Arnfjörð BjarmasonAug 31, 2018
  24. Eric SunshineAug 31, 2018
  25. Jonathan NiederAug 31, 2018
  26. Eric SunshineAug 31, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.