summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Zabka <zabkaste@hu-berlin.de>2020-05-21 17:46:07 +0200
committerStefan Zabka <zabkaste@hu-berlin.de>2020-05-21 17:46:07 +0200
commit0465e79da49900bbd66216d979876654f8977e30 (patch)
tree0a88c6c1b7d593ebb492e3f55b751991ca92432c
parent47f29d306e120f8233e87d43bccd8c97ccf88831 (diff)
downloadbetriebssysteme-0465e79da49900bbd66216d979876654f8977e30.tar.gz
betriebssysteme-0465e79da49900bbd66216d979876654f8977e30.zip
Cmake should use gcc
-rw-r--r--02_exercise/CMakeLists.txt10
-rw-r--r--02_exercise/shell.c11
2 files changed, 4 insertions, 17 deletions
diff --git a/02_exercise/CMakeLists.txt b/02_exercise/CMakeLists.txt
index c2fa8d5..ee20a4a 100644
--- a/02_exercise/CMakeLists.txt
+++ b/02_exercise/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.5)
-project(shell)
+project(shell C)
+add_executable(prog prog.c)
add_executable(shell shell.c)
target_link_libraries(shell PRIVATE array prompt_utils)
add_compile_definitions(_GNU_SOURCE)
@@ -10,7 +11,7 @@ add_library(array array.c)
add_library(prompt_utils prompt_utils.c)
target_link_libraries(prompt_utils PRIVATE array)
-
+set(CMAKE_C_COMPILER gcc)
set(CMAKE_C_STANDARD gnu11)
set(CMAKE_C_STANDARD_REQUIRED True)
set(CLANG_WARNINGS
@@ -20,8 +21,6 @@ set(CLANG_WARNINGS
# parent context
-Wcast-align # warn for potential performance problem casts
-Wunused # warn on anything being unused
- -Woverloaded-virtual # warn if you overload (not override) a virtual
- # function
-Wpedantic # warn if non-standard C++ is used
-Wconversion # warn on type conversions that may lose data
-Wsign-conversion # warn on sign conversions
@@ -39,8 +38,7 @@ set(GCC_WARNINGS
-Wduplicated-branches # warn if if / else branches have duplicated code
-Wlogical-op # warn about logical operations being used where bitwise were
# probably wanted
- -Wuseless-cast # warn if you perform a cast to the same type
)
-set(PROJECT_WARNINGS ${CLANG_WARNINGS})
+set(PROJECT_WARNINGS ${GCC_WARNINGS})
target_compile_options(shell INTERFACE ${PROJECT_WARNINGS})
target_compile_options(prompt_utils INTERFACE ${PROJECT_WARNINGS}) \ No newline at end of file
diff --git a/02_exercise/shell.c b/02_exercise/shell.c
index ed53897..41378f4 100644
--- a/02_exercise/shell.c
+++ b/02_exercise/shell.c
@@ -106,17 +106,6 @@ int parse_line(char const *line, char ***parts, size_t *part_count) {
return 0;
}
-void print_prompt() {
- size_t length = 1024;
- char *buffer = malloc(length * sizeof(char));
- getcwd(buffer, length);
- if (buffer == NULL) {
- printf(".> ");
- } else {
- printf("%s > ", buffer);
- }
-}
-
int exec_command(const char *path, char *const argv[], unsigned timeout) {
timeout = timeout ^ timeout;
int pid;