more C90 strictness; move dos stuff into a dosbox folder

This commit is contained in:
Gregory Gauthier 2025-12-18 10:03:02 +00:00
parent 9a6f8e16d5
commit 6cbe401022
12 changed files with 34 additions and 3 deletions

25
.clang-tidy Normal file
View File

@ -0,0 +1,25 @@
Checks: >
-*,
clang-diagnostic-*,
clang-analyzer-*,
readability-*,
-readability-identifier-length,
-readability-magic-numbers,
-readability-function-cognitive-complexity,
bugprone-*,
-bugprone-easily-swappable-parameters,
misc-*,
-misc-unused-parameters,
portability-*
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
CheckOptions:
- key: readability-function-size.LineThreshold
value: '100'
- key: readability-function-size.StatementThreshold
value: '50'
FormatStyle: none

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea/
build/
cmake-build-debug/
cmake-build-release/

View File

@ -3,6 +3,7 @@ project(cordle C)
set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c90 -pedantic")
# Find ncurses library
find_package(Curses REQUIRED)
@ -27,5 +28,5 @@ target_link_libraries(cordle ${CURSES_LIBRARIES})
# Set compiler flags for C90 compliance
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(cordle PRIVATE -Wall -Wextra -pedantic)
target_compile_options(cordle PRIVATE -Wpedantic -Wextra -pedantic)
endif()

View File

@ -3,11 +3,15 @@
mkdir -p build/cordle
echo "Building application."
gcc -std=c90 -pedantic -Wall -o build/cordle/cordle src/*.c -Iinclude -lncurses
gcc -v -std=c90 -pedantic -Wpedantic -o build/cordle/cordle src/*.c -Iinclude -lncurses > build/cordle-build.log 2>&1
export RESULT=$?
if (( RESULT == 0 )); then
echo "Compile successful. Copying wordlists..."
cp -R wordlists build/cordle
echo "Build completed."
rm build/cordle-build.log
else
echo "Something went wrong..."
cat build/cordle-build.log
fi

View File

@ -76,7 +76,7 @@ void check_guess(GameState *game, const char *guess, int *colors) {
break;
}
}
/* If still absent, mark letter as not in word */
/* If still absent, mark a letter as not in word */
if (colors[i] == COLOR_ABSENT) {
if (game->letter_status[guess_copy[i] - 'A'] == STATUS_UNUSED) {
game->letter_status[guess_copy[i] - 'A'] = STATUS_ABSENT;