Re: git: cd0727ec709b - main - libc: Add <stdio.h> C23 feature test macro
- Reply: Mark Millard : "Re: git: cd0727ec709b - main - libc: Add <stdio.h> C23 feature test macro"
- Reply: John Baldwin : "Re: git: cd0727ec709b - main - libc: Add <stdio.h> C23 feature test macro"
- In reply to: Dimitry Andric : "Re: git: cd0727ec709b - main - libc: Add <stdio.h> C23 feature test macro"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 15 Aug 2026 18:37:36 UTC
Hello Dimitry, Thanks for the report. >> The test used by this package seems defective. >> I don't think we should try to support such defective code. >> Perhaps the gmp source can be patched to check for >> __STDC_VERSION_STDIO_H__? > > Of course it could, and the patch is pretty simple. But I do not agree > that the code is "defective". Before C23, there was no standard way of > checking whether you had FILE declared. The approach is neither portable nor standard, and therefore I believe we should not contaminate our libc with an unnecessary compatibility macro. If gmp requires FILE, including <stdio.h> would be sufficient, and if for any reason it prefers not to include it and instead relies on some indication, that issue should be addressed therein. We can patch the port and, in parallel, submit a fix upstream. I honestly expected that we might encounter a case like this, but I would appreciate it if we could avoid defining an unnecessary macro solely to accommodate an approach that is not standards-compliant. > That said, I have applied such a patch locally, and it seems to work. > But obviously a maintainer of a port would say "this has worked for 20 > years, why change it now" ? :) I agree that it is a reasonable argument for a port maintainer, but it doesn’t really establish that the approach is correct or portable. It only establishes that the particular set of libc implementations the port has encountered happened to expose the macro it was looking for. If the port is relying on an implementation-defined include guard, then a libc changing that guard is not, strictly speaking, breaking a supported interface. Consequently, the appropriate fix is for the port to fix it rather than for libc to preserve it indefinitely as a compatibility interface that is neither established nor widely recognised. Cheers, Faraz