Change compiler flags to C++17 (#1723)

The current versions of the RoboRIO and Raspbian compilers support the flag but have
minimal actual C++17 support.  Changing the flag is the first step.
This commit is contained in:
Peter Johnson
2019-06-20 22:32:50 -07:00
committed by GitHub
parent ee8a33c568
commit 55cb683db4
2 changed files with 5 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ def windowsDebugCompilerArgs = ['/Od', '/MDd']
def windowsLinkerArgs = ['/DEBUG:FULL']
def windowsReleaseLinkerArgs = ['/OPT:REF', '/OPT:ICF']
def linuxCrossCompilerArgs = ['-std=c++14', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
def linuxCrossCompilerArgs = ['-std=c++17', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
'-Wno-unused-parameter', '-Wno-error=deprecated-declarations', '-fPIC', '-rdynamic',
'-pthread']
def linuxCrossCCompilerArgs = ['-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
@@ -17,7 +17,7 @@ def linuxCrossLinkerArgs = ['-rdynamic', '-pthread', '-ldl']
def linuxCrossReleaseCompilerArgs = ['-O2']
def linuxCrossDebugCompilerArgs = ['-Og']
def linuxCompilerArgs = ['-std=c++14', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
def linuxCompilerArgs = ['-std=c++17', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
'-Wno-unused-parameter', '-Wno-error=deprecated-declarations', '-fPIC', '-rdynamic',
'-pthread']
def linuxCCompilerArgs = ['-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
@@ -27,12 +27,12 @@ def linuxReleaseCompilerArgs = ['-O2']
def linuxDebugCompilerArgs = ['-O0']
def linux32BitArg = '-m32'
def macCompilerArgs = ['-std=c++14', '-Wall', '-Wextra', '-Werror', '-pedantic-errors', '-fPIC', '-g',
def macCompilerArgs = ['-std=c++17', '-Wall', '-Wextra', '-Werror', '-pedantic-errors', '-fPIC', '-g',
'-Wno-unused-parameter', '-Wno-error=deprecated-declarations', '-Wno-missing-field-initializers',
'-Wno-unused-private-field', '-Wno-unused-const-variable', '-pthread']
def macCCompilerArgs = ['-Wall', '-Wextra', '-Werror', '-pedantic-errors', '-fPIC', '-g',
'-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wno-unused-private-field']
def macObjCLinkerArgs = ['-std=c++14', '-stdlib=libc++','-fobjc-arc', '-g', '-fPIC', '-Wall', '-Wextra', '-Werror']
def macObjCLinkerArgs = ['-std=c++17', '-stdlib=libc++','-fobjc-arc', '-g', '-fPIC', '-Wall', '-Wextra', '-Werror']
def macReleaseCompilerArgs = ['-O2']
def macDebugCompilerArgs = ['-O0']
def macLinkerArgs = ['-framework', 'CoreFoundation', '-framework', 'AVFoundation', '-framework', 'Foundation', '-framework', 'CoreMedia', '-framework', 'CoreVideo']

View File

@@ -77,13 +77,12 @@ set_target_properties(wpiutil PROPERTIES DEBUG_POSTFIX "d")
set_property(TARGET wpiutil PROPERTY FOLDER "libraries")
target_compile_features(wpiutil PUBLIC cxx_std_17)
if (NOT MSVC)
target_compile_options(wpiutil PUBLIC $<BUILD_INTERFACE:-Wall -pedantic -Wextra -Werror -Wno-unused-parameter>)
target_compile_features(wpiutil PUBLIC cxx_std_14)
else()
target_compile_options(wpiutil PUBLIC /wd4244 /wd4267 /wd4146)
target_compile_options(wpiutil PUBLIC $<BUILD_INTERFACE:/WX /wd4996 /permissive- /Zc:throwingNew>)
target_compile_features(wpiutil PUBLIC cxx_std_17)
target_compile_options(wpiutil PRIVATE -D_CRT_SECURE_NO_WARNINGS)
endif()