D5865: Add missing KDE_ENABLE_NAMED_OPERATORS function

Kevin Funk noreply at phabricator.kde.org
Mon May 29 10:07:12 UTC 2017


kfunk requested changes to this revision.
kfunk added a comment.
This revision now requires changes to proceed.


  Can't go in as-is, as it breaks compilation on MSVC 2015.
  
  But interesting to see that `/Za` is actually problematic. Which proves my point: Just don't use named operators in code which claims to be cross-platform.

INLINE COMMENTS

> KDECompilerSettings.cmake:230
> +        if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 19.0.24210)
> +            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Za")
> +        elseif()

Doesn't work, breaks compilation inside WinSDK 10:

  FAILED: src/CMakeFiles/KF5Parts.dir/readwritepart.cpp.obj
  C:\PROGRA~2\MICROS~2.0\VC\bin\amd64\cl.exe   /nologo /TP -DKCOREADDONS_LIB -DKF5Parts_EXPORTS -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_SIG
  NALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"kparts5\" -DUNICODE -DWIN32_LEAN_AND_MEAN -DW
  INVER=0x0600 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D_USE_MATH_DEFINES -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0600 -Isrc -
  IZ:\kderoot\download\git\kparts\src -I. -IZ:\kderoot\include\KF5\KIOWidgets -IZ:\kderoot\include\KF5 -IZ:\kderoot\include\KF5\KIOCore -IZ:\kderoot\include\KF5\KCoreAddons -IZ:\kderoot\include\qt5 -IZ
  :\kderoot\include\qt5\QtCore -IZ:\kderoot\.\mkspecs\win32-msvc2015 -IZ:\kderoot\include\KF5\KService -IZ:\kderoot\include\KF5\KConfigCore -IZ:\kderoot\include\KF5\KJobWidgets -IZ:\kderoot\include\qt5
  \QtWidgets -IZ:\kderoot\include\qt5\QtGui -IZ:\kderoot\include\qt5\QtNetwork -IZ:\kderoot\include\KF5\KCompletion -IZ:\kderoot\include\KF5\KWidgetsAddons -IZ:\kderoot\include\KF5\KXmlGui -IZ:\kderoot
  \include\qt5\QtDBus -IZ:\kderoot\include\qt5\QtXml -IZ:\kderoot\include\KF5\KConfigWidgets -IZ:\kderoot\include\KF5\KCodecs -IZ:\kderoot\include\KF5\KConfigGui -IZ:\kderoot\include\KF5\KAuth -IZ:\kde
  root\include\KF5\KTextWidgets -IZ:\kderoot\include\KF5\SonnetUi -IZ:\kderoot\include\KF5\KI18n -IZ:\kderoot\include\KF5\KIconThemes /DWIN32 /D_WINDOWS /W3 /GR /EHsc /wd4250 /wd4251 /wd4396 /wd4661 /Z
  a /MD /Zi /O2 /Ob1 /DNDEBUG /showIncludes /Fosrc\CMakeFiles\KF5Parts.dir\readwritepart.cpp.obj /Fdsrc\CMakeFiles\KF5Parts.dir\ /FS -c Z:\kderoot\download\git\kparts\src\readwritepart.cpp
  C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(12128): error C2467: illegal declaration of anonymous 'struct'

Known issue: https://stackoverflow.com/questions/5489326/za-compiler-directive-does-not-compile-system-headers-in-vs2010

Apparently Microsoft doesn't even test their own headers against compiling with `/Za`

> KDECompilerSettings.cmake:231
> +            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Za")
> +        elseif()
> +            # /permissive- became the preferred switch to obtain standards-compliant

Typo: `else()` then this branch is actually executed.

> KDECompilerSettings.cmake:239
> +            # https://sourceforge.net/p/predef/wiki/Compilers/
> +            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
> +        endif()

Doesn't work on MSVC 2015 Update 3:

  cl : Command line warning D9002 : ignoring unknown option '/permissive-'

My Version:

  Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D5865

To: rjvbb, #frameworks, #build_system, cgilles, kfunk
Cc: kfunk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170529/4b44e05c/attachment.html>


More information about the Kde-frameworks-devel mailing list