[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
nalvarez added a comment. This might be better solved by a krazy-like check, instead of making the compilation fail... REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks, #build_system, ivan Cc: nalvarez, thomasp, rakuco, elvisangelaccio
[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
kfunk added a comment. I start to agree that it's probably better to revert this patch, for the simple reason: We might break compilation of a project using boost if boost decides to add code which uses alternative tokens to any of its headers. This is not under our control. On the other hand, alternative tokens are indeed *rarely* used (at least in KDE they are mostly used b/c of simple typos) and only cause harm when code is being ported to MSVC. I'd like to avoid running into issues like that whenever possible. In general It'd be better to have a compiler *warning* instead when alternative tokens are used, but there isn't. I'm undecided -- Apparently we've already fixed all issues in KDE land (/me didn't hear any more complaints so far), so we're good in that are. But problems from upgrading versions of dependent libraries can still be a problem -- though still easily fixed by stripping the flag inside CMake user code... REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks, #build_system, ivan Cc: thomasp, rakuco, elvisangelaccio
[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
elvisangelaccio added a comment. In https://phabricator.kde.org/D3850#72081, @kfunk wrote: > In https://phabricator.kde.org/D3850#72077, @elvisangelaccio wrote: > > > What about adding a way (cmake variable?) to opt-in if one wants to use the alternative operators? Personally I like and use them whenever I start something from scratch... > > > Hmm... You could overwrite the setting by just doing this after `include(KDECompilerSettings)`: > > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -foperator-names") > > > But I just learned that clang++ (Clang 3.9) does not support -foperator-names. GCC does support it... > > I'd like to hear some more opinions (from Ivan maybe) first. Making the use of alternative tokens opt-in is an option of course. For the record, if anyone wants to override this flag, the following works also with clang 3.9: include(KDECompilerSettings) ... string(REPLACE "-fno-operator-names" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks, #buildsystem, ivan Cc: rakuco, elvisangelaccio
[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
kfunk added a comment. Note: I'll push this after the imminent KF5 release if no-one objects. REPOSITORY R240 Extra CMake Modules BRANCH master REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks, #buildsystem, ivan Cc: rakuco, elvisangelaccio
[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
kfunk added a comment. In https://phabricator.kde.org/D3850#72308, @rakuco wrote: > Isn't it better to use `check_cxx_compiler_flag` to see if the flag is supported and enable it in case it is? -fno-operator-names is an ancient compiler flag, supported by GCC since at least 2000 [1]. I've also tested Clang, it's supported from at *least* Clang 3.5 there. Intel compiler also supports it since at least 2005 [2]. I don't think we need a `check_cxx_compiler_flag` here. [1] https://gcc.gnu.org/ml/gcc-patches/2000-04/msg00333.html [2] https://software.intel.com/en-us/forums/intel-c-compiler/topic/308561 REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks, ivan, #buildsystem Cc: rakuco, elvisangelaccio
[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
rakuco added a comment. Isn't it better to use `check_cxx_compiler_flag` to see if the flag is supported and enable it in case it is? REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks, ivan, #buildsystem Cc: rakuco, elvisangelaccio
[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
kfunk added a comment. In https://phabricator.kde.org/D3850#72077, @elvisangelaccio wrote: > What about adding a way (cmake variable?) to opt-in if one wants to use the alternative operators? Personally I like and use them whenever I start something from scratch... Hmm... You could overwrite the setting by just doing this after `include(KDECompilerSettings)`: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -foperator-names") But I just learned that clang++ (Clang 3.9) does not support -foperator-names. GCC does support it... I'd like to hear some more opinions (from Ivan maybe) first. Making the use of alternative tokens opt-in is an option of course. REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks, ivan Cc: elvisangelaccio
[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
elvisangelaccio added a comment. What about adding a way (cmake variable?) to opt-in if one wants to use the alternative operators? Personally I like and use them whenever I start something from scratch... REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks, ivan Cc: elvisangelaccio
[Differential] [Commented On] D3850: Pass -fno-operator-names when supported
kfunk added a comment. Note: Just refreshing my complete KF5 build to test the change. kactivities fails: /home/kfunk/devel/src/kf5/kactivities/autotests/common/test.h:143:25: error: token is not a valid binary operator in a preprocessor subexpression #if defined(Q_NO_DEBUG) or (not defined(Q_OS_LINUX)) ~~~ ^ 1 error generated. REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D3850 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: kfunk, #frameworks