Re: Removing unneeded USES=compiler:c11 (?)

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Thu, 06 Jul 2023 22:15:20 UTC
On 6 Jul 2023, at 22:41, Nuno Teixeira <eduardo@freebsd.org> wrote:
> 
> Could USES=compiler:c11 be removed from ports presuming that available compilers support c11? (Do they ?)

There are probably older versions of gcc and clang that don't support C11 yet, but I think all recent versions do. But it couldn't hurt to leave this in, I guess.

This does not automatically mean that -std=c11 is added to the C compiler command line, for that you have to specify USE_CSTD=c11 in the port Makefile.


> I'm confused because some aws CMakeLists.txt have:
> 
> if(NOT CMAKE_CXX_STANDARD)
>     set(CMAKE_CXX_STANDARD 11)
> endif()
> 
> But c++11 have nothing to do with c11 (for what wikipedia says)....

Yes, that is only specifying for some CMake files that if the end-user does not explicitly specify a C++ standard, it will use C++11. In practice, this will put -std=c++11 on the C++ compiler (${CMAKE_CXX_COMPILER}) command line.

For ports you can achieve the same result by adding USE_CXXSTD=c++11 in the port Makefile.

-Dimitry