@@ -656,16 +656,16 @@ cc_version_metadata1 = cc_version["metadata1"]
656656
657657if cc_version_major == - 1 :
658658 print_warning (
659- "Couldn't detect compiler version, skipping version checks. "
660- "Build may fail if the compiler doesn't support C++17 fully."
659+ "Couldn't detect compiler version, skipping version checks. Build may "
660+ "fail if the compiler doesn't support C++20 fully."
661661 )
662662elif methods .using_gcc (env ):
663- if cc_version_major < 9 :
663+ if cc_version_major < 11 :
664664 print_error (
665- "Detected GCC version older than 9 , which does not fully support "
666- "C++17, or has bugs when compiling Godot. Supported versions are 9 "
667- "and later. Use a newer GCC version, or Clang 6 or later by passing "
668- '"use_llvm=yes" to the SCons command line.'
665+ "Detected GCC version older than 11 , which does not fully support "
666+ "C++20. Supported versions are GCC 11 and later. Use a newer GCC "
667+ ' version, or Clang 13 or later by passing "use_llvm=yes" to the '
668+ " SCons command line."
669669 )
670670 Exit (255 )
671671 elif cc_version_metadata1 == "win32" :
@@ -680,47 +680,31 @@ elif methods.using_clang(env):
680680 # Apple LLVM versions differ from upstream LLVM version \o/, compare
681681 # in https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
682682 if methods .is_apple_clang (env ):
683- if cc_version_major < 10 :
683+ if cc_version_major < 15 :
684684 print_error (
685- "Detected Apple Clang version older than 10 , which does not fully "
686- "support C++17 . Supported versions are Apple Clang 10 and later."
685+ "Detected Apple Clang version older than 15 , which does not fully "
686+ "support C++20 . Supported versions are Apple Clang 15 and later."
687687 )
688688 Exit (255 )
689- elif env ["debug_paths_relative" ] and cc_version_major < 12 :
690- print_warning (
691- "Apple Clang < 12 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option."
692- )
693- env ["debug_paths_relative" ] = False
694689 else :
695- if cc_version_major < 6 :
690+ if cc_version_major < 13 :
696691 print_error (
697- "Detected Clang version older than 6 , which does not fully support "
698- "C++17 . Supported versions are Clang 6 and later."
692+ "Detected Clang version older than 13 , which does not fully support "
693+ "C++20 . Supported versions are Clang 13 and later."
699694 )
700695 Exit (255 )
701- elif env ["debug_paths_relative" ] and cc_version_major < 10 :
702- print_warning ("Clang < 10 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option." )
703- env ["debug_paths_relative" ] = False
704696
705697elif env .msvc :
706- # Ensure latest minor builds of Visual Studio 2017/2019.
707- # https://github.com/godotengine/godot/pull/94995#issuecomment-2336464574
708- if cc_version_major == 16 and cc_version_minor < 11 :
709- print_error (
710- "Detected Visual Studio 2019 version older than 16.11, which has bugs "
711- "when compiling Godot. Use a newer VS2019 version, or VS2022."
712- )
713- Exit (255 )
714- if cc_version_major == 15 and cc_version_minor < 9 :
698+ if cc_version_major < 16 :
715699 print_error (
716- "Detected Visual Studio 2017 version older than 15.9 , which has bugs "
717- "when compiling Godot. Use a newer VS2017 version, or VS2019/VS2022 ."
700+ "Detected Visual Studio version older than 2019 , which does not fully "
701+ "support C++20. Supported versions are Visual Studio 2019 and later ."
718702 )
719703 Exit (255 )
720- if cc_version_major < 15 :
704+ elif cc_version_major == 16 and cc_version_minor < 11 :
721705 print_error (
722- "Detected Visual Studio 2015 or earlier , which is unsupported in Godot. "
723- "Supported versions are Visual Studio 2017 and later ."
706+ "Detected Visual Studio 2019 version older than 16.11 , which does not "
707+ "fully support C++20. Use a newer VS2019 version, or VS2022 ."
724708 )
725709 Exit (255 )
726710
@@ -831,22 +815,17 @@ if env["lto"] != "none":
831815 print ("Using LTO: " + env ["lto" ])
832816
833817# Set our C and C++ standard requirements.
834- # C++17 is required as we need guaranteed copy elision as per GH-36436.
835- # Prepending to make it possible to override.
836818# This needs to come after `configure`, otherwise we don't have env.msvc.
837819if not env .msvc :
838820 # Specifying GNU extensions support explicitly, which are supported by
839- # both GCC and Clang. Both currently default to gnu17 and gnu++17 .
821+ # both GCC and Clang. Both currently default to gnu17 and gnu++20 .
840822 env .Prepend (CFLAGS = ["-std=gnu17" ])
841- env .Prepend (CXXFLAGS = ["-std=gnu++17 " ])
823+ env .Prepend (CXXFLAGS = ["-std=gnu++20 " ])
842824else :
843825 # MSVC started offering C standard support with Visual Studio 2019 16.8, which covers all
844- # of our supported VS2019 & VS2022 versions; VS2017 will only pass the C++ standard.
845- env .Prepend (CXXFLAGS = ["/std:c++17" ])
846- if cc_version_major < 16 :
847- print_warning ("Visual Studio 2017 cannot specify a C-Standard." )
848- else :
849- env .Prepend (CFLAGS = ["/std:c17" ])
826+ # of our supported VS2019 & VS2022 versions.
827+ env .Prepend (CFLAGS = ["/std:c17" ])
828+ env .Prepend (CXXFLAGS = ["/std:c++20" ])
850829 # MSVC is non-conforming with the C++ standard by default, so we enable more conformance.
851830 # Note that this is still not complete conformance, as certain Windows-related headers
852831 # don't compile under complete conformance.
@@ -904,22 +883,15 @@ if env.msvc and not methods.using_clang(env): # MSVC
904883else : # GCC, Clang
905884 common_warnings = []
906885 if methods .using_gcc (env ):
907- common_warnings += ["-Wshadow" , "-Wno-misleading-indentation" ]
908- if cc_version_major < 11 :
909- # Regression in GCC 9/10, spams so much in our variadic templates
910- # that we need to outright disable it.
911- common_warnings += ["-Wno-type-limits" ]
886+ common_warnings += ["-Wshadow" , "-Wno-misleading-indentation" , "-Wenum-conversion" ]
912887 if cc_version_major == 12 :
913888 # Regression in GCC 12, false positives in our error macros, see GH-58747.
914889 common_warnings += ["-Wno-return-type" ]
915- if cc_version_major >= 11 :
916- common_warnings += ["-Wenum-conversion" ]
917890 elif methods .using_clang (env ) or methods .using_emcc (env ):
918- common_warnings += ["-Wshadow-field-in-constructor" , "-Wshadow-uncaptured-local" ]
891+ common_warnings += ["-Wshadow-field-in-constructor" , "-Wshadow-uncaptured-local" , "-Wenum-conversion" ]
919892 # We often implement `operator<` for structs of pointers as a requirement
920893 # for putting them in `Set` or `Map`. We don't mind about unreliable ordering.
921894 common_warnings += ["-Wno-ordered-compare-function-pointers" ]
922- common_warnings += ["-Wenum-conversion" ]
923895
924896 # clang-cl will interpret `-Wall` as `-Weverything`, workaround with compatibility cast.
925897 env ["WARNLEVEL" ] = "-Wall" if not env .msvc else "-W3"
@@ -931,19 +903,14 @@ else: # GCC, Clang
931903 env .AppendUnique (
932904 CCFLAGS = [
933905 "-Walloc-zero" ,
906+ "-Wattribute-alias=2" ,
934907 "-Wduplicated-branches" ,
935908 "-Wduplicated-cond" ,
909+ "-Wlogical-op" ,
936910 "-Wstringop-overflow=4" ,
937911 ]
938912 )
939913 env .AppendUnique (CXXFLAGS = ["-Wplacement-new=1" , "-Wvirtual-inheritance" ])
940- # Need to fix a warning with AudioServer lambdas before enabling.
941- # if cc_version_major != 9: # GCC 9 had a regression (GH-36325).
942- # env.Append(CXXFLAGS=["-Wnoexcept"])
943- if cc_version_major >= 9 :
944- env .AppendUnique (CCFLAGS = ["-Wattribute-alias=2" ])
945- if cc_version_major >= 11 : # Broke on MethodBind templates before GCC 11.
946- env .AppendUnique (CCFLAGS = ["-Wlogical-op" ])
947914 elif methods .using_clang (env ) or methods .using_emcc (env ):
948915 env .AppendUnique (CCFLAGS = ["-Wimplicit-fallthrough" ])
949916 elif env ["warnings" ] == "all" :
0 commit comments