@@ -665,16 +665,16 @@ cc_version_metadata1 = cc_version["metadata1"]
665665
666666if cc_version_major == - 1 :
667667 print_warning (
668- "Couldn't detect compiler version, skipping version checks. "
669- "Build may fail if the compiler doesn't support C++17 fully."
668+ "Couldn't detect compiler version, skipping version checks. Build may "
669+ "fail if the compiler doesn't support C++20 fully."
670670 )
671671elif methods .using_gcc (env ):
672- if cc_version_major < 9 :
672+ if cc_version_major < 11 :
673673 print_error (
674- "Detected GCC version older than 9 , which does not fully support "
675- "C++17, or has bugs when compiling Godot. Supported versions are 9 "
676- "and later. Use a newer GCC version, or Clang 6 or later by passing "
677- '"use_llvm=yes" to the SCons command line.'
674+ "Detected GCC version older than 11 , which does not fully support "
675+ "C++20. Supported versions are GCC 11 and later. Use a newer GCC "
676+ ' version, or Clang 16 or later by passing "use_llvm=yes" to the '
677+ " SCons command line."
678678 )
679679 Exit (255 )
680680 elif cc_version_metadata1 == "win32" :
@@ -689,47 +689,33 @@ elif methods.using_clang(env):
689689 # Apple LLVM versions differ from upstream LLVM version \o/, compare
690690 # in https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
691691 if methods .is_apple_clang (env ):
692- if cc_version_major < 10 :
692+ if cc_version_major < 15 :
693693 print_error (
694- "Detected Apple Clang version older than 10 , which does not fully "
695- "support C++17 . Supported versions are Apple Clang 10 and later."
694+ "Detected Apple Clang version older than 15 , which does not fully "
695+ "support C++20 . Supported versions are Apple Clang 15 and later."
696696 )
697697 Exit (255 )
698- elif env ["debug_paths_relative" ] and cc_version_major < 12 :
699- print_warning (
700- "Apple Clang < 12 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option."
701- )
702- env ["debug_paths_relative" ] = False
703698 else :
704- if cc_version_major < 6 :
699+ if cc_version_major < 16 :
705700 print_error (
706- "Detected Clang version older than 6 , which does not fully support "
707- "C++17 . Supported versions are Clang 6 and later."
701+ "Detected Clang version older than 16 , which does not fully support "
702+ "C++20 . Supported versions are Clang 16 and later."
708703 )
709704 Exit (255 )
710- elif env ["debug_paths_relative" ] and cc_version_major < 10 :
711- print_warning ("Clang < 10 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option." )
712- env ["debug_paths_relative" ] = False
713705
714706elif env .msvc :
715707 # Ensure latest minor builds of Visual Studio 2017/2019.
716708 # https://github.com/godotengine/godot/pull/94995#issuecomment-2336464574
717- if cc_version_major == 16 and cc_version_minor < 11 :
718- print_error (
719- "Detected Visual Studio 2019 version older than 16.11, which has bugs "
720- "when compiling Godot. Use a newer VS2019 version, or VS2022."
721- )
722- Exit (255 )
723- if cc_version_major == 15 and cc_version_minor < 9 :
709+ if cc_version_major < 16 :
724710 print_error (
725- "Detected Visual Studio 2017 version older than 15.9 , which has bugs "
726- "when compiling Godot. Use a newer VS2017 version, or VS2019/VS2022 ."
711+ "Detected Visual Studio version older than 2019 , which does not fully "
712+ "support C++20. Supported versions are Visual Studio 2019 and later ."
727713 )
728714 Exit (255 )
729- if cc_version_major < 15 :
715+ elif cc_version_major == 16 and cc_version_minor < 11 :
730716 print_error (
731- "Detected Visual Studio 2015 or earlier , which is unsupported in Godot. "
732- "Supported versions are Visual Studio 2017 and later ."
717+ "Detected Visual Studio 2019 version older than 16.11 , which has bugs "
718+ "when compiling Godot. Use a newer VS2019 version, or VS2022 ."
733719 )
734720 Exit (255 )
735721
@@ -840,22 +826,17 @@ if env["lto"] != "none":
840826 print ("Using LTO: " + env ["lto" ])
841827
842828# Set our C and C++ standard requirements.
843- # C++17 is required as we need guaranteed copy elision as per GH-36436.
844- # Prepending to make it possible to override.
845829# This needs to come after `configure`, otherwise we don't have env.msvc.
846830if not env .msvc :
847831 # Specifying GNU extensions support explicitly, which are supported by
848- # both GCC and Clang. Both currently default to gnu17 and gnu++17 .
832+ # both GCC and Clang. Both currently default to gnu17 and gnu++20 .
849833 env .Prepend (CFLAGS = ["-std=gnu17" ])
850- env .Prepend (CXXFLAGS = ["-std=gnu++17 " ])
834+ env .Prepend (CXXFLAGS = ["-std=gnu++20 " ])
851835else :
852836 # MSVC started offering C standard support with Visual Studio 2019 16.8, which covers all
853- # of our supported VS2019 & VS2022 versions; VS2017 will only pass the C++ standard.
854- env .Prepend (CXXFLAGS = ["/std:c++17" ])
855- if cc_version_major < 16 :
856- print_warning ("Visual Studio 2017 cannot specify a C-Standard." )
857- else :
858- env .Prepend (CFLAGS = ["/std:c17" ])
837+ # of our supported VS2019 & VS2022 versions.
838+ env .Prepend (CFLAGS = ["/std:c17" ])
839+ env .Prepend (CXXFLAGS = ["/std:c++20" ])
859840 # MSVC is non-conforming with the C++ standard by default, so we enable more conformance.
860841 # Note that this is still not complete conformance, as certain Windows-related headers
861842 # don't compile under complete conformance.
@@ -913,22 +894,15 @@ if env.msvc and not methods.using_clang(env): # MSVC
913894else : # GCC, Clang
914895 common_warnings = []
915896 if methods .using_gcc (env ):
916- common_warnings += ["-Wshadow" , "-Wno-misleading-indentation" ]
917- if cc_version_major < 11 :
918- # Regression in GCC 9/10, spams so much in our variadic templates
919- # that we need to outright disable it.
920- common_warnings += ["-Wno-type-limits" ]
897+ common_warnings += ["-Wshadow" , "-Wno-misleading-indentation" , "-Wenum-conversion" ]
921898 if cc_version_major == 12 :
922899 # Regression in GCC 12, false positives in our error macros, see GH-58747.
923900 common_warnings += ["-Wno-return-type" ]
924- if cc_version_major >= 11 :
925- common_warnings += ["-Wenum-conversion" ]
926901 elif methods .using_clang (env ) or methods .using_emcc (env ):
927- common_warnings += ["-Wshadow-field-in-constructor" , "-Wshadow-uncaptured-local" ]
902+ common_warnings += ["-Wshadow-field-in-constructor" , "-Wshadow-uncaptured-local" , "-Wenum-conversion" ]
928903 # We often implement `operator<` for structs of pointers as a requirement
929904 # for putting them in `Set` or `Map`. We don't mind about unreliable ordering.
930905 common_warnings += ["-Wno-ordered-compare-function-pointers" ]
931- common_warnings += ["-Wenum-conversion" ]
932906
933907 # clang-cl will interpret `-Wall` as `-Weverything`, workaround with compatibility cast.
934908 env ["WARNLEVEL" ] = "-Wall" if not env .msvc else "-W3"
@@ -940,19 +914,14 @@ else: # GCC, Clang
940914 env .AppendUnique (
941915 CCFLAGS = [
942916 "-Walloc-zero" ,
917+ "-Wattribute-alias=2" ,
943918 "-Wduplicated-branches" ,
944919 "-Wduplicated-cond" ,
920+ "-Wlogical-op" ,
945921 "-Wstringop-overflow=4" ,
946922 ]
947923 )
948924 env .AppendUnique (CXXFLAGS = ["-Wplacement-new=1" , "-Wvirtual-inheritance" ])
949- # Need to fix a warning with AudioServer lambdas before enabling.
950- # if cc_version_major != 9: # GCC 9 had a regression (GH-36325).
951- # env.Append(CXXFLAGS=["-Wnoexcept"])
952- if cc_version_major >= 9 :
953- env .AppendUnique (CCFLAGS = ["-Wattribute-alias=2" ])
954- if cc_version_major >= 11 : # Broke on MethodBind templates before GCC 11.
955- env .AppendUnique (CCFLAGS = ["-Wlogical-op" ])
956925 elif methods .using_clang (env ) or methods .using_emcc (env ):
957926 env .AppendUnique (CCFLAGS = ["-Wimplicit-fallthrough" ])
958927 elif env ["warnings" ] == "all" :
@@ -968,8 +937,6 @@ else: # GCC, Clang
968937# Configure external includes.
969938if env .msvc :
970939 if not methods .using_clang (env ):
971- if cc_version_major < 16 or (cc_version_major == 16 and cc_version_minor < 10 ):
972- env .AppendUnique (CCFLAGS = ["/experimental:external" ])
973940 env .AppendUnique (CCFLAGS = ["/external:anglebrackets" ])
974941 env .AppendUnique (CCFLAGS = ["/external:W0" ])
975942 env ["EXTINCPREFIX" ] = "/external:I"
0 commit comments