Skip to content

Commit

Permalink
Suppress enum-enum conversion warning on Linux cross compilers
Browse files Browse the repository at this point in the history
We now only support GCC 11+, so we can remove the conditional flag
inclusion.
  • Loading branch information
calcmogul committed Dec 7, 2024
1 parent b9c6572 commit 1bc792e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ java {

allprojects {
group = "edu.wpi.first"
version = "2025.8.0"
version = "2025.9.0"

if (project.hasProperty('publishVersion')) {
version = project.publishVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ public static class DefaultArguments {

public final String unixSymbolArg = "-g";

// -Wdeprecated-enum-enum-conversion was introduced in GCC 11
public final List<String> linuxCrossCompilerArgs = List.of("-std=c++20", "-Wformat=2", "-pedantic",
"-Wno-psabi", "-Wno-unused-parameter", "-fPIC", "-pthread");
public final List<String> linuxCrossCompilerExtraArgs11 = List.of("-Wno-error=deprecated-enum-enum-conversion");
public final List<String> linuxCrossCompilerExtraArgs10 = List.of("-Wno-error=deprecated-declarations");
"-Wno-psabi", "-Wno-unused-parameter", "-Wno-error=deprecated-enum-enum-conversion", "-fPIC",
"-pthread");
public final List<String> linuxCrossCCompilerArgs = List.of("-Wformat=2", "-pedantic", "-Wno-psabi",
"-Wno-unused-parameter", "-fPIC", "-pthread");
public final List<String> linuxCrossLinkerArgs = List.of("-rdynamic", "-pthread", "-ldl", "-latomic", "-Wl,-rpath,'$ORIGIN'");
Expand Down Expand Up @@ -115,13 +113,8 @@ public static class Platforms {
private final Map<String, PlatformConfig> windowsPlatforms = new HashMap<>();
private final Map<String, PlatformConfig> unixPlatforms = new HashMap<>();

public void addLinuxCrossArgs(PlatformConfig platform, int gccMajor) {
public void addLinuxCrossArgs(PlatformConfig platform) {
platform.getCppCompiler().getArgs().addAll(defaultArguments.linuxCrossCompilerArgs);
if (gccMajor >= 11) {
platform.getCppCompiler().getArgs().addAll(defaultArguments.linuxCrossCompilerExtraArgs11);
} else {
platform.getCppCompiler().getArgs().addAll(defaultArguments.linuxCrossCompilerExtraArgs10);
}
platform.getcCompiler().getArgs().addAll(defaultArguments.linuxCrossCCompilerArgs);
platform.getLinker().getArgs().addAll(defaultArguments.linuxCrossLinkerArgs);
platform.getCppCompiler().getDebugArgs().addAll(defaultArguments.linuxCrossDebugCompilerArgs);
Expand Down Expand Up @@ -229,16 +222,16 @@ public WPINativeUtilsExtension(NativeUtilsExtension nativeExt, Project project)
unixPlatforms.put(platforms.systemcore, linuxsystemcore);

linuxathena.getPlatformPath().set("linux/athena");
addLinuxCrossArgs(linuxathena, 12);
addLinuxCrossArgs(linuxathena);

linuxsystemcore.getPlatformPath().set("linux/systemcore");
addLinuxCrossArgs(linuxsystemcore, 12);
addLinuxCrossArgs(linuxsystemcore);

linuxarm32.getPlatformPath().set("linux/arm32");
addLinuxCrossArgs(linuxarm32, 10);
addLinuxCrossArgs(linuxarm32);

linuxarm64.getPlatformPath().set("linux/arm64");
addLinuxCrossArgs(linuxarm64, 10);
addLinuxCrossArgs(linuxarm64);

windowsx86.getPlatformPath().set("windows/x86");
addWindowsArgs(windowsx86);
Expand All @@ -256,13 +249,6 @@ public WPINativeUtilsExtension(NativeUtilsExtension nativeExt, Project project)
addMacArgs(osxuniversal);
}

public void addGcc11CrossArgs(String platform) {
PlatformConfig config = unixPlatforms.get(platform);
if (config != null) {
config.getCppCompiler().getArgs().addAll(defaultArguments.linuxCrossCompilerExtraArgs11);
}
}

public void addMacMinimumVersionArg() {
PlatformConfig platform = unixPlatforms.get(platforms.osxuniversal);
platform.getcCompiler().getArgs().add(defaultArguments.macMinimumVersionArg);
Expand Down
2 changes: 1 addition & 1 deletion testing/cpp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import edu.wpi.first.nativeutils.vendordeps.WPIVendorDepsPlugin

plugins {
id "cpp"
id "edu.wpi.first.NativeUtils" version "2025.8.0"
id "edu.wpi.first.NativeUtils" version "2025.9.0"
}

nativeUtils.addWpiNativeUtils()
Expand Down

0 comments on commit 1bc792e

Please sign in to comment.