Stephen Kelly <steve...@gmail.com> writes:

> Raphael Kubo da Costa wrote:
>
>> Adjust the GCC feature detection code to only consider C11 support to
>> exist on GCC >= 4.9.
>
> If you do that you must remove the definition of
> CMAKE_CXX11_STANDARD_COMPILE_OPTION for GNU < 4.8.1 too.
[...]
> sys/cdefs.h requires that if you use -std=c11, your compiler must have the
> c_thread_local feature. Therefore, you must not use -std=c11 with GNU < 4.9.
[...]
> Of course, the actual bug is in sys/cdefs.h as comment #2 in
>  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203066
> describes.

I don't think comment #2 acknowledges there's a bug in cdefs.h; I see it
as more of an acknowledgment that adding an additional check there would
help work around/solve the issue.

> The __STDC_VERSION__ macro on its own (just like the __cplusplus macro on
> its own) is not suitable for feature testing. You must check the compiler
> vendor and version (or use SD-6 for C++).
[...]
> So, in summary, there is no bug in CMake, but either your package needs to
> change (to add CMake_NO_C_STANDARD=TRUE), or sys/cdefs.h needs to change, or
> both.

I see your point, and building with CMake_NO_C_STANDARD=TRUE or
CMAKE_C_STANDARD=99 is definitely an option. I wouldn't count on cdefs.h
being changed, and even if it was it wouldn't solve the issue on
existing systems.

Especially if you take into account the
CMAKE_CXX11_STANDARD_COMPILE_OPTION argument, one could argue that this
is about choosing how strict CMake should be when determining whether a
compiler implements a standard: enabling C++11 support only with GCC 4.8
looks limiting and leaves out all the cases where it actually works fine
with earlier versions. Is this patch too broad for C11 and GCC, or is it
different from the C++11 case? It sounded like Brad was in favor of the
former, whereas you'd like the change not to be merged.

I am fine with just changing the way CMake is packaged on FreeBSD, but
it still leaves it broken with third-party software (even outside
FreeBSD in case they use an older GCC and _Thread_local) like you
mentioned.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to