Skip to content

Commit

Permalink
Use clang on OSX (#2686)
Browse files Browse the repository at this point in the history
* Use clang on OSX

Fixes: #2681

* Retrigger jenkins

Co-authored-by: Radu Mereuta <radumereuta@runtimeverification.com>
  • Loading branch information
radumereuta and Radu Mereuta authored Jun 28, 2022
1 parent 6f12ca3 commit f132621
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kernel/src/main/java/org/kframework/parser/KRead.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void createBisonParser(Module mod, Sort sort, File outputFile, boolean gl
}
List<String> command = new ArrayList<>();
command.addAll(Arrays.asList(
"gcc",
Scanner.COMPILER,
files.resolveKInclude("cparser/main.c").getAbsolutePath(),
files.resolveTemp("lex.yy.c").getAbsolutePath(),
files.resolveTemp("parser.tab.c").getAbsolutePath(),
Expand All @@ -114,7 +114,7 @@ public void createBisonParser(Module mod, Sort sort, File outputFile, boolean gl
.start()
.waitFor();
if (exit != 0) {
throw KEMException.internalError("gcc returned nonzero exit code: " + exit + "\n");
throw KEMException.internalError(Scanner.COMPILER + " returned nonzero exit code: " + exit + "\n");
}
} catch(IOException | InterruptedException e) {
throw KEMException.internalError("Failed to execute process.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class Scanner implements AutoCloseable {
private final Module module;
private GlobalOptions go = new GlobalOptions();

private static final String EXE_EXTENSION = OS.current().equals(OS.WINDOWS) ? ".exe" : "";
public static final String COMPILER = OS.current().equals(OS.OSX) ? "clang" : "gcc";

public static Map<TerminalLike, Tuple2<Integer, Integer>> getTokens(Module module) {
Map<TerminalLike, Integer> tokens = new TreeMap<>();
Expand Down Expand Up @@ -289,16 +289,16 @@ public File getScanner() {
throw KEMException.internalError(
"Flex returned nonzero exit code. See output for details. flex command: " + pb.command());
}
scanner = File.createTempFile("tmp-kompile-", EXE_EXTENSION);
scanner = File.createTempFile("tmp-kompile-", "");
scanner.deleteOnExit();
//Option -lfl unnecessary. Same effect achieved by --noyywrap above.
pb = new ProcessBuilder("gcc", scannerCSource.getAbsolutePath(), "-o", scanner.getAbsolutePath(), "-Wno-unused-result");
pb = new ProcessBuilder(COMPILER, scannerCSource.getAbsolutePath(), "-o", scanner.getAbsolutePath(), "-Wno-unused-result");
pb.inheritIO();
exit = pb.start().waitFor();
scanner.setExecutable(true);
if (exit != 0) {
throw KEMException.internalError(
"gcc returned nonzero exit code. See output for details. gcc command: " + pb.command());
COMPILER + " returned nonzero exit code. See output for details. " + COMPILER + " command: " + pb.command());
}
} catch (IOException | InterruptedException e) {
throw KEMException.internalError("Failed to write file for scanner", e);
Expand Down

0 comments on commit f132621

Please sign in to comment.