MantisBT - CMake
View Issue Details
0015741CMakeCMakepublic2015-09-13 14:142016-02-01 09:10
Raphael Kubo da Costa 
Brad King 
normalmajorN/A
closedfixed 
FreeBSD
CMake 3.3.1 
CMake 3.4CMake 3.4 
0015741: GCC < 4.9 does not have full C11 support
As of version 3.3.1, CMake sets CMAKE_C11_{STANDARD,EXTENSION}_COMPILE_OPTION for GCC >= 4.7, and checks for C11 features for GCC >= 4.6. Additionally, it means CMake itself will be built with -std=gnu11 if GCC >= 4.7 is used.

However, GCC only has full C11 support with the 4.9 release (https://gcc.gnu.org/wiki/C11Status [^]). Specifically, support for C11's _Thread_local is only present on GCC >= 4.9. This combination makes CMake fail to build with GCC 4.7 and 4.8 on FreeBSD, as runetype.h uses _Thread_local and the fact that -std=gnu11 is passed makes it not be a typedef or define for something else that would work. In https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203066, [^] it was argued that this is GCC's fault for advertising C11 support in 4.7 and 4.8 before it was fully ready.

Before sending a patch to GNU-C.cmake, I'd like to check if it makes sense or what the best approach would be.
No tags attached.
Issue History
2015-09-13 14:14Raphael Kubo da CostaNew Issue
2015-09-14 08:57Brad KingNote Added: 0039411
2015-09-14 09:57Raphael Kubo da CostaNote Added: 0039417
2015-09-14 13:19Brad KingNote Added: 0039421
2015-09-15 10:54Brad KingNote Added: 0039426
2015-09-15 16:06Brad KingNote Added: 0039427
2015-09-15 16:06Brad KingAssigned To => Brad King
2015-09-15 16:06Brad KingStatusnew => resolved
2015-09-15 16:06Brad KingResolutionopen => fixed
2015-09-15 16:06Brad KingFixed in Version => CMake 3.4
2015-09-15 16:06Brad KingTarget Version => CMake 3.4
2016-02-01 09:10Robert MaynardNote Added: 0040405
2016-02-01 09:10Robert MaynardStatusresolved => closed

Notes
(0039411)
Brad King   
2015-09-14 08:57   
I think we should simply change CMake's table to not expect C11 support until GCC 4.9.
(0039417)
Raphael Kubo da Costa   
2015-09-14 09:57   
Alright, I'll send the patch I've prepared to the list then.
(0039421)
Brad King   
2015-09-14 13:19   
Relevant mailing list thread:

 [PATCH] Features: Only enable C11 support on GCC >= 4.9
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14367 [^]
(0039426)
Brad King   
2015-09-15 10:54   
Relevant mailing list thread:

 [PATCH] Do not build CMake in C11 mode if _Thread_local support is broken.
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14394 [^]
(0039427)
Brad King   
2015-09-15 16:06   
Patch from 0015741:0039426 applied:

 Avoid using C11 to build CMake if _Thread_local support is broken
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ffa6f057 [^]
(0040405)
Robert Maynard   
2016-02-01 09:10   
Closing resolved issues that have not been updated in more than 4 months.