On Fri, Jan 14 2022, Junio C Hamano wrote: > "brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> writes: > >>> DEVELOPER=1 will now die because its core libraries use C11-specific >>> code: >>> >>> archive.c:337:35: error: '_Generic' is a C11 extension [-Werror,-Wc11-extensions] >>> strbuf_addstr(&path_in_archive, basename(path)); >>> ^ >>> /usr/include/libgen.h:61:21: note: expanded from macro 'basename' >>> #define basename(x) __generic(x, const char *, __old_basename, basename)(x) >>> ^ >>> /usr/include/sys/cdefs.h:325:2: note: expanded from macro '__generic' >>> _Generic(expr, t: yes, default: no) >>> ^ > > Wow, that sounds horribly broken. Yes, but it's also working as designed :) We're erroring because the C library headers on the OS aren't C99-compliant. That it would apply to only git.git's sources was only ever wishful thinking. >> I think we had this discussion about FreeBSD before and that's why I >> specifically dropped that option from the main makefile. We can either >> drop that patch, or we can set it to -std=gnu11 and tell folks setting >> DEVELOPER to use a system released in the last five years. I think we >> can be a little stricter with what we require in the case of DEVELOPER >> than we might be otherwise. > > But that is not being stricter, but looser, no? I thought that the > point of -std=gnu99 was to allow us to use C99 features while catching > use of language features newer than that, and use of -std=gnu11 will > defeat half the point, wouldn't it? Indeed. But also as noted in my side-thread reply in <220114.86a6fytte9.gmgdl@xxxxxxxxxxxxxxxxxxx> I think that being able to use it like this was always wishful thinking. I.e. to brian's "tell folks setting DEVELOPER to use a system released in the last five years". This is the exact opposite of that. We are implicitly expecting that the OS will forever be using the 20+-year old C99 standard, and not trying out fetures in C11 standardized 10+ years ago. The FreeBSD 13.0 release is less than a year old[1]. When I went looking I found that the change to use __generic in its libgen.h just so happens to have been made in FreeBSD sources around 5 years ago: [2]. 1. https://www.freebsd.org/releases/13.0R/announce/ 2. https://github.com/freebsd/freebsd-src/commit/34168b28e99b0bb328c7bb49cd91cb942181056f