View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015526CMakeModulespublic2015-04-21 19:372015-11-02 09:13
ReporterDan Kegel 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformApple MacOSOS XOS Version10.4.10
Product VersionCMake 3.2.2 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0015526: check_c_compiler_flag does not recognize some Clang messages
DescriptionPer http://stackoverflow.com/questions/26108606/no-support-to-finline-functions-in-clang-3-5 [^]
XCode 6 has dropped support for -finline-functions:

$ clang -finline-functions -c foo.c -Werror
clang: error: optimization flag '-finline-functions' is not supported

so projects that use -Werror must not use that flag.

But check_c_compiler_flag doesn't use -Werror, and the output:
$ clang -finline-functions -c foo.c
clang: warning: optimization flag '-finline-functions' is not supported
clang: warning: argument unused during compilation: '-finline-functions'
sails right by its regex, so the flag is listed as supported. D'oh.
Steps To Reproduce$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12)
include(CheckCCompilerFlag)
check_c_compiler_flag(-finline-functions FOOBARC)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-finline-functions FOOBARCXX)
$ cmake
-- The C compiler identification is AppleClang 6.1.0.6020049
-- The CXX compiler identification is AppleClang 6.1.0.6020049
-- Performing Test FOOBARC
-- Performing Test FOOBARC - Success
-- Performing Test FOOBARCXX
-- Performing Test FOOBARCXX - Success

But I expected 'Failed', not success, as that flag is not really supported and
will cause build error if used with -Werror.
Additional InformationPatch sent to cmake-developers, but I guess I'm not subscribed yet, so I'll attach it here too.

Also affects older versions of cmake.
TagsNo tags attached.
Attached Filespatch file icon opt.patch [^] (1,498 bytes) 2015-04-21 19:37 [Show Content]
patch file icon opt3.patch [^] (845 bytes) 2015-04-22 10:55 [Show Content]

 Relationships

  Notes
(0038579)
Brad King (manager)
2015-04-22 09:54

Thanks. FYI, subscription to cmake-developers may be done here:

 http://www.cmake.org/mailman/listinfo/cmake-developers [^]

With Xcode 6.2 the AppleClang version still reports as 6.0 and the -finline-functions flag is not rejected. I've updated the description to refer to Xcode 6.3.

The pattern you propose appears to be the same for C and C+, so pleaes look at modifying CMakeCheckCompilerFlagCommonPatterns instead.
(0038582)
Dan Kegel (reporter)
2015-04-22 10:48

Also affects older versions of clang, for instance:

$ clang -c foo.c -mno-fused-madd
clang: warning: argument unused during compilation: '-mno-fused-madd'
$ echo $?
0
$ clang -v
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)

Will attach patch that addresses your review, thanks.
(0038583)
Brad King (manager)
2015-04-22 10:56

Re 0015526:0038582: Right, it's Xcode 6.3 that dropped -finline-functions but the warning match regex needs to be updated for this Clang in general. Thanks.
(0038584)
Dan Kegel (reporter)
2015-04-22 11:05

Here's another test case that should illustrate the general problem on
Apple LLVM version 6.0 (clang-600.0.56):

cmake_minimum_required(VERSION 2.8.12)
include(CheckCCompilerFlag)
check_c_compiler_flag("--param max-inline-insns-single=1800" FOOBARC)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("--param max-inline-insns-single=1800" FOOBARCXX)
(0038585)
Brad King (manager)
2015-04-22 12:55

Thanks for the updated patch. I've applied it with one of the two lines:

 Check*CompilerFlag: Add another pattern for Clang
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=680ebebc [^]

The "argument unused during compilation" warning is not reliable for this purpose because it actually means that Clang does know about the flag but happens to not use it in the check's test project.
(0039787)
Robert Maynard (manager)
2015-11-02 09:13

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-04-21 19:37 Dan Kegel New Issue
2015-04-21 19:37 Dan Kegel File Added: opt.patch
2015-04-21 20:00 Dan Kegel Note Added: 0038576
2015-04-21 20:13 Dan Kegel Note Deleted: 0038576
2015-04-22 09:54 Brad King Note Added: 0038579
2015-04-22 09:54 Brad King Summary check_c_compiler_flag gives wrong answer on Mac => check_c_compiler_flag not implemented for Xcode 6.3
2015-04-22 09:55 Brad King Assigned To => Brad King
2015-04-22 09:55 Brad King Status new => assigned
2015-04-22 09:55 Brad King Target Version => CMake 3.3
2015-04-22 10:48 Dan Kegel Note Added: 0038582
2015-04-22 10:55 Dan Kegel File Added: opt3.patch
2015-04-22 10:56 Brad King Note Added: 0038583
2015-04-22 11:05 Dan Kegel Note Added: 0038584
2015-04-22 11:08 Brad King Summary check_c_compiler_flag not implemented for Xcode 6.3 => check_c_compiler_flag does not recognize some Clang messages
2015-04-22 12:55 Brad King Note Added: 0038585
2015-04-22 12:55 Brad King Status assigned => resolved
2015-04-22 12:55 Brad King Resolution open => fixed
2015-04-22 12:55 Brad King Fixed in Version => CMake 3.3
2015-11-02 09:13 Robert Maynard Note Added: 0039787
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team