Skip to content

Commit

Permalink
new build system
Browse files Browse the repository at this point in the history
  • Loading branch information
vinissou committed Sep 29, 2024
1 parent 19a35c2 commit 1a46b65
Show file tree
Hide file tree
Showing 15 changed files with 418 additions and 375 deletions.
1 change: 0 additions & 1 deletion BUILD.bat

This file was deleted.

47 changes: 47 additions & 0 deletions BUILD.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/***********************************************************
* Name: builder.c
*
* Experimental C only buid system, idea inspired by:
* https://github.com/tsoding
*
*
* Creator: Vinícius Souza
* Site: https://github.com/vinissou
***********************************************************/

#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>

//this will become a compiler selector in the future
//might add cl one day
#if defined(_WIN32) || defined(_WIN64)
#define OUT retriever.exe
char *compiler = "clang";
char *os = "WIN32";
char *input = ".\\src\\app.c";
char *output = "retriever.exe";
#else
#define OUT retriever
char *compiler = "cc";
char *os = "else"; //for now
char *input = "./src/app.c";
char *output = "retriever";
#endif


int main(int argc, char **argv) {
char command[200];

if (strcmp(os, "WIN32") != 0){
system("dos2unix *"); //TODO make it portable
system("dos2unix modules/*");
}

sprintf(command,"%s -Wall -Wextra -pedantic -std=c99 -O3 %s -o %s", compiler,
input, output);
printf("\n%s\n", command);
system(command);
return 0;
}

4 changes: 0 additions & 4 deletions BUILD.sh

This file was deleted.

5 changes: 3 additions & 2 deletions LINTERS_CHECK/LINTERS_CHECK.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Clang-Tidy -extra-arg=-std=c99 ..\app.c >> .\TODO_CLANG-TIDY.txt
cppcheck ..\app.c --output-file=TODO_CPPCHECK.txt
del *.txt
Clang-Tidy -extra-arg=-std=c99 ..\src\app.c >> .\TODO_CLANG-TIDY.txt
cppcheck ..\src\app.c --output-file=TODO_CPPCHECK.txt
720 changes: 360 additions & 360 deletions LINTERS_CHECK/TODO_CLANG-TIDY.txt

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions LINTERS_CHECK/TODO_CPPCHECK.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
..\app.c:0:0: information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]
..\src\app.c:0:0: information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

^
..\modules\output.c:42:5: error: Common realloc mistake: 'output_buffer' nulled but not freed upon failure [memleakOnRealloc]
..\src\modules\output.c:42:5: error: Common realloc mistake: 'output_buffer' nulled but not freed upon failure [memleakOnRealloc]
output_buffer = realloc(output_buffer, OUTPUT_MAX);
^
..\modules\search.h:175:5: error: Common realloc mistake: 'good_suffix_ptr' nulled but not freed upon failure [memleakOnRealloc]
..\src\modules\search.h:175:5: error: Common realloc mistake: 'good_suffix_ptr' nulled but not freed upon failure [memleakOnRealloc]
good_suffix_ptr = realloc(good_suffix_ptr, sizeof(g_suffix_table));
^
..\modules\search.h:250:15: error: Null pointer dereference: buffer [nullPointer]
..\src\modules\search.h:250:15: error: Null pointer dereference: buffer [nullPointer]
fread(buffer, 1, (TERM.LENGHT -1), file);
^
..\modules\search.h:242:21: note: Assignment 'buffer=NULL', assigned value is 0
..\src\modules\search.h:242:21: note: Assignment 'buffer=NULL', assigned value is 0
char * buffer = NULL;
^
..\modules\search.h:250:15: note: Null pointer dereference
..\src\modules\search.h:250:15: note: Null pointer dereference
fread(buffer, 1, (TERM.LENGHT -1), file);
^
..\modules\search.h:250:15: error: Null pointer dereference [nullPointer]
..\src\modules\search.h:250:15: error: Null pointer dereference [nullPointer]
fread(buffer, 1, (TERM.LENGHT -1), file);
^
..\modules\search.h:130:57: warning: Uninitialized variable: f [uninitvar]
..\src\modules\search.h:130:57: warning: Uninitialized variable: f [uninitvar]
if (i > g && suffix_table[i + term_lenght - 1 - f] < i - g)
^
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1a46b65

Please sign in to comment.